How to embed Twilio conversations in a DronaHQ app to send SMSs and WhatsApp messages.
Tags: twilio, lowcode, developers, personalization
Published: 2023-08-07 06:39:10

[DronaHQ](https://www.dronahq.com/?utm_source=dev.to&utm_medium=twilio-blog&utm_campaign=smit) is a low-code platform that allows you to build enterprise applications quickly and easily. One of the most common use cases for enterprise applications is sending SMSs and WhatsApp messages to customers, employees, or other stakeholders. Twilio is a cloud communications platform that provides APIs for sending SMSs and WhatsApp messages. In this blog, we’ll show you how to embed Twilio Conversations in a custom DronaHQ app to capture customer ratings and send SMSs.

**Tools:**

1. Twilio – a cloud communications platform

2. DronaHQ – a low-code platform for building custom applications

**Prerequisites:**

1. Twilio account

2. DronaHQ account

## Twilio Setup
1. Verify your phone number
Twilio Conversations, you must first verify the phone number you plan to use for outbound messaging. This verification step is mandatory only for Twilio trial accounts. Twilio Conversations also supports several other messaging channels, including in-app messaging, Facebook Messenger that you can configure for your use case.

2. Obtaining the Account SID and Auth Token for your project.
a. Create an API Key
[Create an API Key](https://www.twilio.com/docs/glossary/what-is-an-api-key#how-can-i-create-api-keys) and note the API Key **SID** (string identifier) and **Secret** for later. The API Key will authenticate and authorize you to interact with Twilio APIs.
b. Create a Twilio Conversations Service
[Create a Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) and note the Conversation Service **SID** for later. A Conversation Service is a top-level container for other resources in the Twilio Conversations REST API.

## DronaHQ Setup
1. Configuring the DronaHQ REST API connector for Twilio
a. Once logged in to your DronaHQ account, head over to ‘Connectors’ and look for the Twilio icon.
![adding connector](https://cdn1.dronahq.com/wp-content/uploads/2023/07/NEW-1024x650.png)
b. Enter the Account SID and Auth Token generated in the above steps and click on Save. Your Twilio connector is now configured and ready to be used to send SMSs.
![twilio connector ui](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689771903507-1024x539.png)
2. Creating the UI in DronaHQ
a. Create a blank application, and add two text input controls for the user name and email. Add a phone control for the phone number to which we want to send the messages to. Also, add rating and text area control for rating and feedback description respectively. At the end add a button, on whose “button_click” action we will configure the Twilio send SMS event.
![twilio demo](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689772062010-1024x620.png)
b. To configure the Twilio SMS event, click on the “Submit Form” button and then the flash icon on the right.
![twilio_button_event](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689772271674-1024x457.png)

–Firstly add a Validate Screen action, which will check for all the validations and mandatory fields have been filled or not.
![select action](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689772565143-1024x664.png)
-Then add a “Compute” action which will be used to concatenate our phone number to the country code provided by the Phone control. You can use the CONCATENATE() function here like “CONCATENATE( phone.country , phone.number)”
![searching computeconcatenating](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689772723995-1024x497.png)
![s2cc](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689772827544-1024x498.png)
–Then, add a “Set Message” action to set a message for your SMS with dynamic values.
![search message](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689772972891-1024x499.png)
![set message action](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773070010-1024x498.png)
–Add the Twilio connector from the server-side actions.
![twilio add](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773221911-1024x498.png)
–Then, select “Send Message” Ready API.
![select send message](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773358199.png)
-Select your account from the respective Environment.
![environment select](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773504053-1024x775.png)
-Then bind the “Message Text” with the “message” action we created, “Recipient’s Number” with the concatenated phone number from the action flow, and at the end add the “Sender’s Number” from Twilio.
![binding](https://cdn1.dronahq.com/wp-content/uploads/2023/07/XSSXZXXZCSCS.png)
–In the end, on the “SUCCESS” side of the Twilio action add a “Toast”, to be present on the screen when the Twilio Send Message action performs successfully.
![toast](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773741496-1024x622.png)
–Following a similar set of steps you can configure the Twilio connector once again to send WhatsApp messages. You will need to add “whatsapp: “ before adding the sender’s and recipient’s numbers.
![whatsapp](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773813294-1024x746.png)
![sendwhatsapp details](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773885943-1024x764.png)
–Now, you can preview your app and check by submitting the form that will send an SMS and WhatsApp message to the phone provided in the phone control.

![previewsms](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689773992580-1024x588.png) 
![check](https://cdn1.dronahq.com/wp-content/uploads/2023/07/screely-1689774044427-1024x851.png)

## Conclusion
In conclusion, by combining the power of Twilio’s cloud communications platform and DronaHQ’s low-code platform, you can create a personalized messaging app for enhancing the in-store customer experience. This tutorial has guided you through the process of embedding Twilio Conversations in a custom DronaHQ app to send SMS and WhatsApp messages.

You can configure the Twilio API to send WhatsApp messages, configure bidirectional SMSes, make a call and more. The UI design created in DronaHQ for capturing customer ratings and feedback can be easily repurposed to capture additional data as per the specific use case requirements. By integrating Twilio capabilities into your DronaHQ app, you have a powerful tool at your disposal to enable seamless communication and data capture with your customers.

[Sign up](https://www.dronahq.com/signup/?utm_source=dev.to&utm_medium=twilio-blog&utm_campaign=smit) and get started today!