Send a message to the customer after a campaign call

In this example, we'll send a message to the customer after a campaign call.

For this integration, you'll need to configure the following:

  • Channel type: Phone
  • Endpoint URL: The URL of your Restful Contact Management Interface's (CMI) messages resource
  • Conversation Direction: You can only use this example for outbound conversations.
  • Events: To send the survey after a conversation is over, select Ended. This is the only supported event for campaign calls.
  • Queues: Use the queue configured for your campaign. This queue should be used even if the campaign call is transferred to another queue.
    Note: In contact data and in conditions, the current queue is the queue configured for your campaign even in transfer cases, not the queue used for queueing the conversation. The current agent exists only if an agent has classified the call.
  • Authentications: In this example, you must use:
    • basic authentication credentials

      Make sure your service account has permission for Messaging for the queue used.

    • the API key of your restful interfaces
  • JSON for Configuration

    This example uses basic authentication and the POST method to send an SMS to the customer if the agent has classified the campaign call as Subscribed. The message is sent with a delay between 10 and 20 seconds.

    {
      "request": {
        "authentication": {
          "type": "basic"
        },
        "condition": "contact.get_campaign_result() == 'SUCCESS' and contact.get_campaign_classifier() == 'Subscribed'",
        "method": "POST",
        "headers": {
          "x-api-key": "{authentications.api-key}"
        },
        "delay": 10,
        "delayMax": 20,
        "body": {
          "destinations": {
            "destination": [
              {
                "address": "{contact.destination}"
              }
            ]
          },
          "message": "Thank you for your order! If you have any questions about your subscription, please contact our customer support at +0123456789.",
          "source": "01RZD7PIWTNW9AZA6VKLDRTDHE@whatsapp.sinchconversation.com",
          "subType": "sms"
        }
      }
    }