22.6.3. Notifications for Inbound Messages

Prev Next

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:

Natterbox interface showing notifications for a new message

This is the notification you will get from implementing this guide:

Notification indicating a new SMS received

(Or similar message)

How to configure this:

  1. Navigate to the Routing Policy tab.

  2. Create a new routing policy that is a ‘Data Analytics’ policy.

  3. ‘Click here to START’ and then select ‘Add Event’

  4. Click into the blue container that appears, click ‘Select Event’ and then check ‘Inbound Message Publish’.

    1. Leave the retry duration as the default.

  5. Add a new action container after the blue event container.

  6. Add a script engine app inside the container

    1. Name this item: Script for Time Now.

    2. Lua Script:

      local dateTime = os.date("!%Y-%m-%dT%H:%M:%SZ")
      session.set('TimeNow', tostring(dateTime))


  7. Add a new action container and connect both the top and bottom container from the previous action container.

  8. Add a ‘Query Object’ app

    1. Name this item: Query NB User

    2. Result Set: NBUser

    3. Trigger When: ‘Records not found’ AND ‘Error Returned’ [‘Records found’ is not checked]

    4. Record Type: Natterbox User

    5. Filter Results:

      1. Field: External Id

      2. Operator: =

      3. Value: $(Payload_Event.event.userId)

    6. Return Fields:

      1. Record ID

      2. Salesforce User

    7. Leave everything else as default.


  9. Add a ‘Create a Record’ app

    1. Name this item: Create Task

    2. 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].

    3. Trigger When: [Leave as default]

    4. Record Type: Task

    5. Owner ID: $(SForce_NBUser.nbavs__User__c)
      This is the result of the query app.

    6. Set Field Values:

      1. Description: $(Payload_Event.event.textPayload)
        This is the message content.

      2. Due Date Only: $(Custom_TimeNow)

      3. Reminder Date/Time: $(Custom_TimeNow)

      4. Reminder Set: true

      5. Subject:  You have a new SMS!
        Customise this message to your desire.




  10. Save your policy!

  11. Optional: you could also look at adding in an email notification in addition or as an alternative to the task notification.

    1. 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

    2. Add a ‘Notify’ app. It needs to be below the ‘Query NB User’ but above the ‘Create Task’ (if you are doing both).

      Flowchart illustrating event-driven actions including email notifications and task creation.

    3. Choose ‘Email’ and configure like this:

      1. Send email on: All attempts

      2. To Email Addresses: $(SForce_NBUser.nbavs__Username__c) [macro for the email address from the Natterbox User]

      3. Subject: Inbound Message received

      4. Email body: Text body: $(Payload_Event.event.textPayload)

        Configuration settings for email notifications including recipient details and subject line.

  12. Save the policy!