

It is required to run the check and send messages to your messengers chat.

You can view the JSON structure in the testing section of the “Check WebHook” item. Dict_messages – Dictionary containing information from the message in the JSON file that we have received. In this section, we assign values to class attributes. You can also test WebHook requests in it. To see how the received JSON will look like, you can enter the easy-to-use Testing section, available in your cabinet. We will describe the class constructor, the default one that will accept JSON, which will contain information about incoming messages (it will be received by WebHook and forwarded to the class). Requests – We need it to access the website API. The JSON library handles the JSON format. We will have to import the data from the library: Let's create a file “wabot.py” and describe the class for our bot in it. The FLASK server allows us to conveniently respond to incoming requests and process them. While writing this article, we deployed the server using the FLASK microframework. So we need a server to make the bot run and this server will accept and process this information. The WebHook URL is a link to which JSON-data containing information about incoming messages or notifications will be sent using the POST method.

Then we open messengers on your mobile phone, go to Settings → messengers Web → Scan the QR code.Īt this point, the WebHook URL must be provided for the server to trigger our script for incoming messages. To do so, we will switch to our account and get a QR code there. Getting StartedĪt first, let's link up the messengers with our script at once so that we can check the way code works while we're writing one. Your phone should not be used for the messengers Web at the same time. Sending files of different formats (PDF, jpg, doc, mp3, etc.)Īttention: To make the bot fully functional, please, always keep your phone online.The output of the actual server time of the bot running on.At the moment our demo chatbot has the following functionality: The demo bot will be able to react to and reply to commands sent to messengers as regular messages. We will explain the way to write a simple messengers bot on Python using the messengers API. Now the Chat API offers the most accessible and automated messengers Business API on the market with Multi-Agent messengers Inbox, No-Code Chatbot Builder, ready-to-use apps integrations and other features. Please read the documentation before starting work. The functionality from this guide has been transferred to the messengers Business API, with which you can also make mailings, create chat bots and much more, but without the risk of being blocked.ĭue to changes in the working conditions of the API, this guide may partially use outdated information.
