Use Case - Sending SMS through ACS in Nimbus

Set up a service workflow which asks customers to opt in for the SMS notification service.

This use case demonstrates the capability of sending SMS to customers using Azure Communication Services. We will set up a service workflow which asks customers to opt in for the SMS notification service. 
🔍 This use case is about sending SMS only, which means, it's a one-way flow of information from Nimbus to callers. Any response to a SMS notification will be ignored. Callers can opt out from the service by calling a SMS notification opt out service number.

PRECONDITIONS

You require tenant administrator rights to set up the Azure Communication Services and service owner rights to create the service workflow and parameters in Nimbus.

 

Show Icon Legend

💡 = A hint to signal learnings, improvements or useful information in context. 🔍 = Info points out essential notes or related page in context.
☝ = Notifies you about fallacies and tricky parts that help avoid problems. 🤔 = Asks and answers common questions and troubleshooting points.
❌ = Warns you of actions with irreversible / data-destructive consequence. ✅ = Intructs you to perform a certain (prerequired) action to complete a related step.
 
 

Set-up Azure Communication Services for sending SMS

  1. Go to the Azure admin portal with your tenant admin and create a new ACS resource.
  2. Generate application keys for it
  3. You also need to purchase/assign a phone number to it.
  4. Once you've received your number, open the Azure CLI and execute to test SMS
az communication SMS send --sender "{Your Azure Resource phone number}" --recipient "{Your destination number}" --message "Hello world via SMS for Azure CLI!" --connection-string "{your endpoint}"

You can get a fake destination for testing purposes online. (i.e. https://SMSreceivefree.com/)

☝ Please keep in mind from which country you want to send the SMS and which country is the destination. Microsoft does not cover all countries yet. Please find a table of capabilities per country here: SMS concepts in Azure Communication Services - An Azure Communication Services concept document | Microsoft Learn

Our set-up is a US number (the service) sending to a US number (the caller).

Please also note, that we do not handle opt ins and opt outs via SMS in this use case. We handle these via an IVR.

Prepare in Nimbus

In our example, we have 3 Nimbus services: a call center service which can directly be reached by customers, a SMS opt in service which cannot be reached directly by customers, and a SMS opt out service which can be reached by customers.

1. Create the parameters

In Nimbus, create the following parameters

Name
ID
Default Value
SMSNotificationOptIn
 
SMSNotificationOptIn false
SMSNotificationPhoneNumber SMSNotificationPhoneNumber NULL
NotifySubscribers NotifySubscribers NULL

2. Contact Center Service

The Contact Center service triggers the "notify subscribers" power automate flow if the call volume is low and thus the CC capacity is high. If no agents are available to answer a call, the caller will be transferred to a second service, the SMS notification opt in service, to get the option to subscribe to the notifications about the call center capacity. Here is the Nimbus workflow:

Overview of the workflow for the Contact Center Service

 
 

3. SMS opt in service

The SMS notification opt in service handles opt ins of callers. Here is an overview of the workflow:

Overview of the workflow for the SMS opt in Service

 
 

4. SMS opt out service

The SMS notification opt out service handles opt outs of callers. It needs to have an assigned phone number so that callers can reach the service externally to easily opt out. Callers will be automatically opt out when they have received 5 notifications. Depending on your country's legislation, the number needs might need to be toll-free. Here is an overview of the workflow:

Overview of the workflow for the SMS opt out Service

 
 

Create the Opt In Power Automate Flow

This flow is triggerd by a parameter update within a Nimbus workflow. If a caller opts-in using the IVR in Nimbus, we want to create an entry in the subscribers list with the subscribers phone number.

Description
Screenshot

Start with the GetOnUpdatedTasks trigger of the Nimbus Connector.

The flow starts by listening to the ParameterUpdated event.

Add an initialize variable element to the flow and set

  • Name = SMSNotificationOptIn
  • Type = String
  • Value = triggerOutputs()?['body/customContextParameters/SMSNotificationOptIn']

The flow should only run, once the parameter SMSNotificationPhoneNumber is set.

Add a condition element to the flow and set the following conditions

  • UpdatedParameterName is equal to SMSNotificationPhoneNumber

length(triggerOutputs()?['body/updatedParameterValue']) is greater than 1

  • variables('SMSNotificationOptIn') is equal to true

Continue in the IF YES branch.

Add a Send SMS element from Azure Communications Services SMS Connector to the flow and set

  • From Phonw Number = Choose the phone number from the list
  • Recepients to = MicrosoftCallerId of the flow trigger
  • Message = Your message
  • DeliveryReport = Yes
 

Finally add a "Create item" element form the Sharepoint connector to the flow and set 

  • Site Address = Your Sharepoint site
  • List Name = Your opt in list name
  • Title = MicrosoftCallerId of the flow trigger
  • Subscribed at = utcNow()
  • ONLY FOR TEST Box = omit
  • RceeivedNotifications = 1

Create the Notification Power Automate Flow

Description
Screenshot

Start with the GetOnUpdatedTasks trigger of the Nimbus Connector.

The flow starts by listening to the ParameterUpdated event.

Add a condition element to the flow and set the following conditions

  • triggerOutputs()?['body/updatedParameterName'] is euqal to "NotifySubscribers"

In the IF TRUE branch, 

Add a Get Items element

Then iterate through the list of subscribers and send an SMS

Create the Opt Out Power Automate Flow

This flow is triggerd by a parameter update within a Nimbus workflow. If a caller opts-out using the IVR in Nimbus, we want to we want to delete the entry from the subscribers list and opt out the subscriber. Even if the notification via SMS did not work, we need to perform the opt out.

Description
Screenshot

Start with the GetOnUpdatedTasks trigger of the Nimbus Connector.

The flow starts by listening to the ParameterUpdated event.

Add an initialize variable element to the flow and set

  • Name = SMSNotificationOptIn
  • Type = String
  • Value = triggerOutputs()?['body/customContextParameters/SMSNotificationOptIn']

Add a condition element to the flow and set the following conditions

  • variables('SMSNotificationOptIn') is equal to false

TODO

In the IF TRUE branch, 

Send the opt out message to the subscriber.

Then delete the list entry in the sharepoint list.

Finally configure the last element to run in any case.

Create an Automatic Opt Out Power Automate Flow

This is a different option. If you do not want to deal with a specific on demand opt out service, you could imagine opt out subscribers automatically, as soon as they have received 5 messages. We need to listen to changes on the notification list. As soon as the ReceivedMessages hits the number 5, we want to delete the entry and opt out the subscriber.

Description
Screenshot

Trigger the flow with the Sharepoint trigger "When an item is created or modified"

Set List Name to your SMS Notification opt in list.

Add a condition element to the flow and set

  • ReceivedMessages is greater than or equals 5

Add a Send SMS element from Azure Communications Services SMS Connector to the flow and set

  • From Phone Number = Choose the phone number from the list
  • Recepients to = Title of the Sharepoint list (which contains the phone number)
  • Message = Your message
  • DeliveryReport = No

Add a "Delete item" element form the Sharepoint connector to the flow and set 

  • Site Address = Your Sharepoint site
  • List Name = Your opt in list name
  • Id = Id of the Sharepoint list element

Table of Contents