WhatsApp Integration via Twilio (Notification only)

WhatsApp Integration via Twilio (Notification only)

WhatsApp Integration via Twilio

You can now integrate ServiceDesk Plus MSP with WhatsApp to trigger WhatsApp notifications to ServiceDesk Plus MSP technicians/users on the latest events that happen in the application. This can be done through Twilio and leveraging the already available Webhooks functionality in ServiceDesk Plus MSP.

Twilio
Twilio provides a link between the internet and telecom networks and helps establish a communication between the two entities. Twilio can be used to send SMS, WhatsApp messages and so on.

Twilio Configurations
In order for this integration to work, you need a Twilio account.
To create an account in Twilio, go to https://console.twilio.com and sign up using the on-screen instructions. If you already have an account, log in. Once you have logged in, copy the Account SID and the Auth Token and keep them in a file. They will be required further to notify users.

After you have copied,  locate Messaging  - > Settings - > WhatsApp Sandbox settings from the left pane




In WhatsApp sandbox settings, under Sandbox participants, add the WhatsApp number that needs to be notified. To add the number, simply send a WhatsApp message to the Twilio WhatsApp number provided in the instruction with the specified message.

As per the instruction in the image below, the message 'join now-will' has to be sent to the WhatsApp number '+1 415 523 8886'. This will add the required number to the Twilio Sandbox.



Twilio can now send WhatsApp messages to the number added. Make a note of the Twilio sandbox number (+1 415 523 8886 in this case). The number will be required to notify users.

(NOTE : Using sandbox for WhatsApp messaging is applicable only for Twilio trial account users. Paid account users can buy their own numbers and use it instead of the sandbox number.) 

ServiceDesk Plus MSP Configurations

Once the configurations in Twilio are done, you can head to ServiceDesk Plus MSP to configure Webhooks and trigger it through Custom trigger to faciliate Whatsapp notifications to users based on preset criteria.

To do this,
  1. Go to Admin > Developer Space > Webhooks. 
  1. Create a new Webhook and provide a name and description. 
  1. Choose the HTTP method as Post. 
  1. In the URL field, provide the URL in the format mentioned below:

Note: In the place of <TWILIO-ACCOUNT-SID>, use the account SID that was copied at the beginning.
For example, if the account SID is 'xxxx-xxxx-xxxx-xxxx',

In the Authentication field, choose Basic Authentication. The username will be the Account SID and the password will be the Auth Token of Twilio as mentioned here.

In the request payload, provide the JSON below :
 

In the above payload, the 'From' number is the Twilio sandbox number that was copied in the previous steps. Replace the number (14155238886) with your Sanbox number.

The 'Body' is the message that is to be sent to the user/technician. If a technician needs to be notified upon a request creation, then the above message body can be used. The message can be modified to your liking using the dollar variables and the criteria for the notification.

The 'To' number is the number to which the WhatsApp message has to be sent. If the mobile number of the technician assigned to the request is the same as the number subscribed to the Twilio sandbox, then the number can be dynamically fetched using '${{request.technician.mobile}}'. Else, the number can be hard-coded in the payload itself. Make sure to include the country code too in the number.

  1. Choose the Content Type as 'application/x-www-form-urlencoded'. A sample configuration of the web-hook is shown in the image below : 


  1. Save the Webhook.
  2. Once the Webhook is saved, you can proceed to create a custom trigger.

Creating a Custom Trigger

  1. To create a custom trigger, go to Admin > Automation > Custom Triggers. Click a new trigger and provide the name and description.
  2. Specify the fields 'Execute on actions', 'Execute during' and 'Cascade Execution' and the 'Criteria' as per your requirements.
  3. In the 'Actions' set, select Webhook and choose the webhook that was just created to notify on WhatsApp.
A sample configuration of the custom trigger is shown below : 


Save the trigger. Now when a request is created with the criteria specified in the trigger, the WhatsApp user will be notified with the message specified in the web-hook. Please note that this is just an one-way notification integration. Replying to the messages will initiate a 24-hour chat window and nothing else. 
A sample of the message received in WhatsApp is shown below :


                    New to ADSelfService Plus?

                      • Related Articles

                      • How to integrate ServiceDesk Plus MSP with WhatsApp business.

                        This article provides steps for integrating ServiceDesk plus MSP with WhatsApp (business). Note: This integration is compatible with versions 14600 & above. Before you begin, ensure you've reviewed the following prerequisites: Ensure your ServiceDesk ...
                      • Assign Technician for the unassigned requests using Notification Custom Function

                        Requirement: When a technician addresses an unassigned request, the corresponding ticket is automatically assigned to that technician. Steps to configure: 1. Download the attached scripts. Copy the contents into Notification custom functions. 2. Goto ...
                      • Script to send notification to users on upcoming contracts

                        Please follow the below link to setup python on the server https://pitstop.manageengine.com/portal/en/kb/articles/how-to-setup-python-on-the-server-11-11-2019 Steps to configure 1.  Extract the attached zip file in <Home>/integration/custom_scripts ...
                      • Sending notification failed

                        In some scenarios the outgoing emails will error with Sending notification failed message in UI and in the logs you can see, 550 5.2.125 The sender has exceeded the maximum number of messages they are allowed to send via client submission either per ...
                      • How to stop requests from a domain and send notification to the user for a specific account

                        Use Case   When a particular account can only raise requests using Self Service Portal and not via email, the script will allow you to send a notification that the request is not raised and to create a request using Self Service Portal. Pre-requisite ...