This guide is for creating a notification for an inbound message (SMS or WhatsApp) using task notifications. There is an out-the-box notification in the CTI but this guide is for a more obvious notification. This is what the out-the-box CTI notification looks like:
This is the notification you will get from implementing this guide:
(Or similar message)
How to configure this:
Navigate to the Routing Policy tab.
Create a new routing policy that is a ‘Data Analytics’ policy.
‘Click here to START’ and then select ‘Add Event’
Click into the blue container that appears, click ‘Select Event’ and then check ‘Inbound Message Publish’.
Leave the retry duration as the default.
Add a new action container after the blue event container.
Add a script engine app inside the container
Name this item: Script for Time Now.
Lua Script:
local dateTime = os.date("!%Y-%m-%dT%H:%M:%SZ") session.set('TimeNow', tostring(dateTime))
Add a new action container and connect both the top and bottom container from the previous action container.
Add a ‘Query Object’ app
Name this item: Query NB User
Result Set: NBUser
Trigger When: ‘Records not found’ AND ‘Error Returned’ [‘Records found’ is not checked]
Record Type: Natterbox User
Filter Results:
Field: External Id
Operator: =
Value: $(Payload_Event.event.userId)
Return Fields:
Record ID
Salesforce User
Leave everything else as default.
Add a ‘Create a Record’ app
Name this item: Create Task
Result Set: ‘MyData’
[This is default. Usually it should be changed but because it’s not being used for anything else, this is not necessary].Trigger When: [Leave as default]
Record Type: Task
Owner ID: $(SForce_NBUser.nbavs__User__c)
This is the result of the query app.Set Field Values:
Description: $(Payload_Event.event.textPayload)
This is the message content.Due Date Only: $(Custom_TimeNow)
Reminder Date/Time: $(Custom_TimeNow)
Reminder Set: true
Subject: You have a new SMS!
Customise this message to your desire.
Save your policy!
Optional: you could also look at adding in an email notification in addition or as an alternative to the task notification.
When querying the Natterbox User above, make sure to return ‘Email Address’ as well (step 8.f.). This will be the address for the email to be sent to
Add a ‘Notify’ app. It needs to be below the ‘Query NB User’ but above the ‘Create Task’ (if you are doing both).
Choose ‘Email’ and configure like this:
Send email on: All attempts
To Email Addresses: $(SForce_NBUser.nbavs__Username__c) [macro for the email address from the Natterbox User]
Subject: Inbound Message received
Email body: Text body: $(Payload_Event.event.textPayload)
Save the policy!