Home Salesforce Customer Engagement Using SMS with Nexmo API

Customer Engagement Using SMS with Nexmo API

by Dhanik Lal Sahni

Salesforce has lot of features for customer engagement like IVR Call, Email, Social Media, Web Chat and Mobile App, Text Messaging. This post will give information about text messaging based customer engagement. We can send SMS or Whatsapp for use case of application like on order approval, order dispatch or delivery.

This post will give complete information about sending SMS using Salesforce with the help of Nexmo API. For sending SMS we have to follow below steps

  1. Register user in Nexmo for using API
  2. Create Apex class which will send SMS
  3. Create Lightning web component to send SMS

1. Register user in Nexmo for using API

Nexmo helps growing startups and agile enterprises enhance their customer experience and realize new business outcomes at scale.

We have to perform below steps to register and get API credential. Nexmo gives €2 free credit for test SMS service.

  1. Register at https://dashboard.nexmo.com/sign-up using email
  2. Verify email address
  3. Get API key and secret from https://dashboard.nexmo.com/settings
  4. Verify mobile numbers where you want to send SMS. This can be done at https://dashboard.nexmo.com/test-numbers
  5. Add https://rest.nexmo.com/sms/json in remote site setting

2. Create Apex class which will send SMS

Apex class is required for sending SMS in Salesforce. This class will be using above generated API details to send SMS. We will call Nexmo REST API using POST method.

We have created IMessageService to handle message. This message can be normal text message or whatsapp message. We have implemented  IMessageService to send SMS using Nexmo API. We can utilize other SMS APIs like Twilio, Amazon SNS and Pinpoint. We can create other implementation class for these implementation.

These will be generic implementation for sending SMS. We have to create controller class which will be called from lightning web component. Use @AuraEnabled attribute on method which need to called from Lightning component.

3. Create Lightning component to send SMS

We are ready with Apex class creation. Let us create lightning web component which will take SMS text to send it to customer.

Test Page

References:

https://dashboard.nexmo.com/getting-started-guide

You may also like

1 comment

Dhanik Lal Sahni May 3, 2020 - 8:09 am

Hello Abhinav,

You can use verify API of nexmo. Check link https://developer.nexmo.com/verify/code-snippets/send-verify-request for more detail.

Thank You,
Dhanik

Reply

Leave a Comment