[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make WhatsApp ChatBot and use WhatsApp API to send the WhatsApp messages in php .

License

Notifications You must be signed in to change notification settings

ultramsg/php-whatsapp-chatbot

Repository files navigation

Ultramsg.com WhatsApp Bot using WhatsApp API and ultramsg

Demo WhatsApp API ChatBot using Ultramsg API with php.

Chatbot tasks:

  • 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 .

Getting Started

  • 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 .

 

webhook json format

To see how the received JSON will look this video .

 

Run a chatbot

step1

put your instance ID and Token in example.php

new ultraMsgChatBot("token", "instance_id");

step2

activate the "Webhook on Received" option and Set URL Webhook in Instance settings in ultramsg for example : https://yourwebsite.com/chatbot/example.php

step3

Upload the project/folder to your server or website .

** Congratulations.. you can now talk to your chatbot **

 

Functions

sendChatMessage

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 .

sendImageMessage

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 .

sendDocumentMessage

Send a document to phone number or group

$this->client->sendDocumentMessage($to, "cv.pdf", "https://file-example.s3-accelerate.amazonaws.com/documents/cv.pdf");

sendVideoMessage

Send a Video to phone number or group

$this->client->sendVideoMessage($to, "https://file-example.s3-accelerate.amazonaws.com/video/test.mp4");

sendAudioMessage

Send a audio file to phone number or group

$this->client->sendAudioMessage($to, "https://file-example.s3-accelerate.amazonaws.com/audio/2.mp3");

sendVoiceMessage

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");

sendContactMessage

Sending one contact or contact list to phone number or group

$this->client->sendContactMessage($to, "14000000001@c.us");

 

WhatsApp API PHP SDK

You can see Lightweight PHP library for WhatsApp API to send the whatsappp messages in PHP provided by Ultramsg.com WhatsApp API PHP SDK

 

Youtube | WhatsApp api using PHP SDK

Send Message by WhatsApp api using PHP SDK | Ultramsg PHP SDK