Connect OneHash Chat with Twilio for WhatsApp/SMS Channel
Twilio Whatsapp/SMS
How to create a Whatsapp/SMS channel with Twilio?
Step 1. Click on "Add Inbox" button from Settings > Inboxes page.
Step 2. Click on "WhatsApp/SMS" icon.
Step 3. Configure the inbox.
These are the inputs required to create this channel:
Channel Name : This is the name inbox, this will be used across the application.
Channel Type : Select SMS, if you are integrating an SMS channel. Select Whatsapp, if you have a verified Whatsapp number in Twilio.
Phone Number : This is the number you will be using to communicate with your customer. This has to be verified in Twilio.Enter your number as in the Twilio Dashboard.
Account SID : Account SID in Twilio Console. Login to Twilio Console. Here, you would be able to see the Account SID and the Auth Token.
Auth Token : Auth token for the account. Login to the Twilio Console. Here, you would be able to see the Account SID and the Auth Token.
You can get the Auth Token and Account SID from Twilio Console. Refer the Image.
Step 4. "Add agents" to your inbox.
Step 6. Hooray! You have successfully created a whatsapp/sms inbox.
If it is an SMS Channel, then you don't need to do anything else. You will start receiving the messages in the dashboard whenever a customer sends you one.
If you are connecting a Whatsapp channel, you have to configure a callback URL in the Twilio inbox:
- Login to your Twilio Console.
- Go to Programmable SMS > Whatsapp > Senders.
- You will be able to see your phone number. Click on it, it will display a field like the one shown below.
- Provide https://chat.onehash.ai/twilio/callback as the value for WHEN A MESSAGE COMES IN input.
Step 7. If you want to update the agents who have access to the inbox, you can go to Settings > Inboxes.
Go to WhatsApp Inbox Twilio integrated and click Gear Icon as in the image and follow the image to upgrade the agents.
Configuring OneHash Chat with Twilio Studio
If you are using twilio studio for a custom conversation flow, Updating the webhook url directly will break your exising Integration.
For such cases you can follow the given steps.
Identify the step in your flow where you want the agent handoff to happen.
Add a make http request widget as shown below with the give values
REQUEST METHOD : POST
REQUEST URL: https://chat.onehash.ai/twilio/callback
CONTENT TYPE: Application/JSON
REQUEST BODY: {{trigger.message | to_json }} ( make changes as required based on your flow variables)
HTTP request widget will forward the message body to OneHash Chat. This will create a conversation in OneHash Chat from where the agent can reply.
Make sure that your flow can handle the user responses to Agent Replies.
Additional Inbox settings
Your freshly configured WhatsApp inbox should now appear in your list of inboxes. To see this and to make additional settings in your WhatsApp inbox, go to Settings → Inboxes → click the gear icon on the associated WhatsApp inbox.
All the Additional Settings available are the same as those in Add inbox in OneHash Chat. We recommend going through this link to understand the same.
Updated on: 13/10/2023
Thank you!