How to send a message to a Telegram channel using the HTTP bot sendMessage API

Here’s a practical example how to send a message to a Telegram channel using a Telegram Bot and the HTTP bot sendMessage API.

In order to be able to do so, you will have to the following:

  1. Create a Telegram public channel (we’ll make this private later)
  2. Create a Telegram BOT via BotFather
  3. Set the bot as administrator in your channel

After you’ve completed the steps above, we can now go ahead and send a message to the channel by issuing and HTTP GET request to the Telegram BOT API at the following URL (you can do this in your browser):[BOT_API_KEY]/sendMessage?chat_id=[CHANNEL_NAME]&text=[MESSAGE_TEXT]


BOT_API_KEY is the API Key generated by BotFather when you created your bot
CHANNEL_NAME is the handle of your public channel (e.g. @channel_name)
MESSAGE_TEXT is the message you want to send (URL-encoded)

Example HTTP API call response:

  "ok": true,
  "result": {
    "message_id": 2,
    "chat": {
      "id": -1001363941800,
      "title": "TestChannel",
      "username": "usefulmix_channel",
      "type": "channel"
    "date": 1538926255,
    "text": "Test message"

So far, so good, but let’s consider that you’ll want this new channel to be private so that only you and the bot (and whoever you decide to invite in the channel) will see the messages.

So we need to make the channel private, however in doing so our above HTTP API call will stop working and this is what trying to prublish a message will look like:

  "ok": false,
  "error_code": 400,
  "description": "Bad Request: chat not found"

To get around this, all you need to do is look at the public HTTP API call we made initially and pick up the "id": -1001363941800 as this is the unique id of our channel which we’ll be switching to after we make our channel private from public.

So now the API call becomes:[BOT_API_KEY]/sendMessage?chat_id=-1001363941800&text=[MESSAGE_TEXT]

And voila, you now have a private Telegram channel, where you can send messages via the HTTP bot sendMessage API. This can be very useful when you have some online services that provide you with a callback mechanism and can call you HTTP API endpoint so that you get notified of whatever in real time.

Delete a Github forked repository

Navigate to the repository you want to delete.

In the repository action bar, click Settings.


Under Danger Zone, click Delete this repository.


Read the warnings.

To verify that you’re deleting the correct repository, type the name of the repository you want to delete.


Click I understand the consequences, delete this repository.

Nginx Error – 413 Request Entity Too Large Fix

If you’re getting 413 Request Entity Too Large errors trying to upload files to your webserver, you need to increase the client body size limit in your nginx.conf configuration file.

Add ‘client_max_body_size xxM’ inside the server section, where xx is the size (in MB) that you want to allow for files upload to your webserver.

The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request.

To edit your nginx configuration, in your terminal type the following:

sudo nano /etc/nginx/nginx.conf
sudo nano /usr/local/nginx/conf/nginx.conf
and set the
# set client body size to 2M #
client_max_body_size 2M;

as per the example below:

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

server {
client_max_body_size 2M;
listen 80;
server_name localhost;

# Main location
location / {

Git – How to delete a local branch or remote

Git – delete a local branch:

git branch -d some_example_local_branch

Git – delete/remove a remote branch:

git push origin : some_example_remote_branch

In case of error after trying to remove remote branch, run:

git fetch -p

This is what the error message would look like:

error: unable to push to unqualified destination: some_example_remote_branch
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@repository_name'

and this is caused due to the fact that perhaps anyone else has already deleted the branch and you need to synchronize your branch list.