Ultramsg.com WhatsApp Bot using WhatsApp API and ultramsg
Demo WhatsApp API ChatBot using Ultramsg API with php.
- The output of the command list .
- The output of the server time of the bot running on .
- Sending image to phone number or group .
- Sending audio file .
- Sending ppt audio recording .
- Sending Video File.
- Sending contact .
- Sending Random Sentence .
- Sending Random Joke .
- Sending Random Image .
- Ultramsg account is required to run examples. Log in or Create Account if you don't have one ultramsg.com.
- go to your instance or Create one if you haven't already.
- Scan Qr and make sure that instance Auth Status : authenticated .
To see how the received JSON will look this video .
put your instance ID and Token in example.php
new ultraMsgChatBot("token", "instance_id");
activate the "Webhook on Received" option and Set URL Webhook in Instance settings in ultramsg for example : https://yourwebsite.com/chatbot/example.php
Upload the project/folder to your server or website .
** Congratulations.. you can now talk to your chatbot **
Used to send WhatsApp text messages
$this->client->sendChatMessage($to, date('d.m.Y H:i:s'));
- $to – ID of the chat where the message should be sent for him, e.g 14155552671@c.us .
Send a image to phone number or group
$this->client->sendImageMessage($to, "https://file-example.s3-accelerate.amazonaws.com/images/test.jpg", "image Caption");
- $to – ID of the chat where the message should be sent for him, e.g 14155552671@c.us .
Send a document to phone number or group
$this->client->sendDocumentMessage($to, "cv.pdf", "https://file-example.s3-accelerate.amazonaws.com/documents/cv.pdf");
Send a Video to phone number or group
$this->client->sendVideoMessage($to, "https://file-example.s3-accelerate.amazonaws.com/video/test.mp4");
Send a audio file to phone number or group
$this->client->sendAudioMessage($to, "https://file-example.s3-accelerate.amazonaws.com/audio/2.mp3");
Send a ppt audio recording to phone number or group
$this->client->sendVoiceMessage($to, "https://file-example.s3-accelerate.amazonaws.com/voice/oog_example.ogg");
Sending one contact or contact list to phone number or group
$this->client->sendContactMessage($to, "14000000001@c.us");
You can see Lightweight PHP library for WhatsApp API to send the whatsappp messages in PHP provided by Ultramsg.com WhatsApp API PHP SDK