


$availableFiles is an array in which the keys are the function parameters and the values are the file names.'caption'=>'Get your file '.$availableFiles The parameter is the format of the file to be sent. This function is most interesting, since it works with the parameter. The file() function sends a file using the "file" command. The me() function display the name of the interlocutor using the "me" command. Now let’s produce a whatsappbot.php file to make a following class: class whatsAppBot You can’t indicate server IP only, but you can indicate the port. Indicate a direct link to your script, e.g. Now we need to indicate a WebHook URL so the server can run the scrip when new messages arrive. Next, open WhatsApp on your smartphone, go to Settings -> WhatsApp Web -> Scan a QR code.
#Chatbot api code
To do this, go to your personal account and get a QR code there. Preparatory workĪt the very beginning, we need to connect whatsapp with our script, so as we write the code, we check its operation. It’s more convenient to use a separate smartphone for coding. Sending geo-coordinates (geo-locations)Īttention: to make the bot running, the phone must be connected to the Internet and mustn’t be used for Whatsapp Web.Sending files of different formats (pdf, jpg, doc, mp3, etc.).Now our demo bot features the following functions:
#Chatbot api how to
We’ll tell you how to write a simple bot on PHP using API WhatsApp.Ī demo bot will react on commands of ordinary Whatsapp messages to answer them. Now the Chat API offers the most accessible and automated WhatsApp Business API on the market with Multi-Agent WhatsApp 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 WhatsApp 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.
