Building chatbot is very easy with Ultramsg API, you can build a customer service bot and best ai chatbot Through simple steps using the c# language.
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.
Dependencies
for local development purposes, a tunneling service is required. This example uses ngrok , you can download Ngrok from here.
Download project
You can download all project files from GitHub.
Set the instance ID and token
Set the instance ID and token in appsettings.json file.
run project
dotnet watch
Start NGROK
Run NGROK For Windows:
ngrok http https://localhost:6000
Run NGROK for mac:
./ngrok http https://localhost:6000
Set Webhook URL
Go to your ultramsg account to set Webhook URL after copying the ngrok url and add /api/ Route like this:
https://61-44-136-9.ngrok.io/api/
and enable this option “Webhook on Received”.
receive WhatsApp messages and command processing
Congratulations. Now you can try sending to WhatsApp number and testing the WhatsApp chatbot.
This is all you need to receive and read messages from users, and then respond to them. You can develop the list and add more complex commands such as querying from Database and updating records in the database etc.