Whatsapp / Twilio

Estimated reading: 2 minutes 4 views

Introduction

Wattyo is integrated out of the box with Twilio Whatsapp sending functionality. This way you can easily send Whatsapp from the application.

The Integration is built as an implementation of the NotificationChannelInterface what means that is fully integrated with the notification manager.

Twilio Environment

Twillio Whatsapp only works with the Production Environment. But you can simulate a Sandbox environment where you can test messaging for free by setting the Sandbox From Phone Number: +14155238886

Environment Description When to use
Production The real production environment. If you want to send test whatsapp you must settup the From Number to: +14155238886 Production Environments or specific tests/demos

Whatsapp Sandbox

In order to be able to send a Whatsapp to a specific Phone Number, the Phone Number must join a Whatsapp Channel and enter the join command. Otherwise, you won’t be able to send whatsapp to this number.

For mor information check Twilio Whatsapp Sandboxes

Setup

It’s necessary to setup the Twillio integration by:

  1. Setting the Named Principal parameters in the Twilio_Whatsapp External Credential
  2. Setting the Twilio Settings Custom Metadata Type.

External Credentials

In the Twilio Whatsapp External Credentials, go to Named Principal and set the correct values for user and password.

Both the user (API Key) and the password must be taken from the Twilio’s Control Panel.

For Whatsapp the credentials should be always the Production ones. In case you want to send test (and free) whatsapp you must set the From Phone to +14155238886

Twilio Setting CMT

In the Twilio Settings Custom Metadata you will need to configure the SMS record. Here you have to set two parameters:

Field Description Example
From Phone The Phone Number (with prefix) the system will send the sms from. In production you should set one of the numbers configured in the Twilio Conrtol Panel. For Sandboxes you shoud use +14155238886 +14155238886
User The User Token taken from Twilio Control Panel ACde26cba4f90fab17cc43cc66fbbe28ae

The User must be set here apart from the External Credential because Twilio API requires to pass the User in the URL and there is no way to achieve that with the Named Credential.

sendNotification()

The sendNotification() method from TwilioNotification class, simply builds the required request depending on the NotificationEnvelope. The same method also handle the SMS Notifications.

Leave a Comment

       
Euphoria, forever till the end of times

Euphoria

Share this Doc

Whatsapp / Twilio

Or copy link

CONTENTS