WhatsApp ChatBot Instruction
1. Twilio
- Register in Twilio: https://www.twilio.com/
- Top up the Twilio account, the minimum amount is 20 USD.
- In the WhatsApp Senders tab, create a new sender with a phone number
- If you do not have your own phone number, you can buy a Twilio phone number and use it to create a Messaging Service
2. Installation
- Install this module according to the us_messenger documentation
3. Configuration
In WhatsApp
Find the bot with the created phone number
In Odoo
- Activate Developer Mode
- Open the menu [[ Settings ]] >> Technical Settings >> System Parameters
- Check if the parameter web.base.url is set correctly and accessible via the internet (should not be localhost). Also, Twilio only accepts https addresses (i.e., not http). If you can only use localhost, use ngrok
- Open the menu [[ Messengers ]] >> Messengers
- Select the Kanban card with the WhatsApp icon and the project name 'Enter_bot_name'
- Enter the WhatsApp token, ID, phone number (must be like in the example, with "whatsapp:" at the beginning) into the appropriate fields, all of this is in the Twilio account, also enter the name in the field to create a Messaging Service
- Enter the bot name and select the operators with whom the user will communicate
- Unarchive the project
- Press the [Start] button in the top left corner
In Twilio
- Go to WhatsApp Senders, select your sender and assign the created Messaging Service to it
- Update WhatsApp Sender
4. Usage
Conversation in the Discuss menu
In WhatsApp:
- start a conversation with the created bot
- enter your email address (optional)
In Odoo:
- Open the menu [[ Discussion ]]
- RESULT: two contact records will be created, child and parent. Later, other children from different messengers can join the parent record
- RESULT: there is a channel named WhatsApp:<WHATSAPP NAME>.
- Open the channel and reply to messages
In WhatsApp:
- RESULT: the message will be delivered via the bot
You can continue chatting this way
Conversation in any document where there is a discussion
In Odoo:
- Make sure that in [[ Messengers ]] >> Messengers >> <Name of your bot> >> Settings you have written 'yes' in CHATTER
- Add subscribers to the discussion by pressing the button 'Add Subscribers'. Choose only parent contacts (without any bot name)
- Press the button 'Send Message'. Choose whom and in which messenger to send the message. Write the message and send it. Note: the message will be sent not only in the selected messenger but also by mail. To disable sending by mail, you can press the Followers button, select a follower, press 'Edit Subscription', and disable 'Discussion' and enable 'Note'
- In the menu [[ Discussion ]] you will see a message from the document with a signature, from which document it was written
In WhatsApp:
- RESULT: A new message will appear
- Reply to this message. Note: Reply to the message
In Odoo:
- RESULT: a message from WhatsApp that you will see in the chat document