How to send a messengers message in Python

messengers is practically the most popular messaging service widely used all over the world. The chat bots development market for messengers is growing rapidly. In this guide, we will show how to send messengers messages via ChatAPI using Python. This guide for programmers will help to take the first step in creating a bot.

So, how to send a messengers message to Python using the Chat API service

To start

If you do not already have Python installed on your computer, go to the Python downloads page and install the latest version.

Create your account at Chat-Api. It's free! 
After that you will be redirected to the admin panel where your personal instance will be created. You need to connect your phone number with our API.

Go to your personal account and get a QR code there. Then open messengers on your mobile phone, go to Settings -> messengers Web -> Scan QR Code.

Here is the script that will send the message:

import requests

url = ''
data = ({"phone": "15039740922"}, {"body": "Hello, World!"})
res =, json=data)
print res.text

Just copy and use it! By the way, do not use brackets, hyphens or any other formatting symbols in the telephone number. Use only numbers, as in our example.

Don't forget, you will need to substitute your token from your account and instance number (or replace the whole ApiURL)

What if I want to do this in another programming language?
You have just successfully sent your first messengers message, this is the first step to developing bots or integrations, and did it using Python, but what if you want to do this in PHP or JavaScript? We have other blog posts, you can study other material: How to send messengers message with PHP or Sending messengers message with Node.js

Request API key, try it yourself, it's easy!

Feel free to reach out and share your experiences or ask any questions.

To top