Skip to content

Trigger Dixa surveys with Power Automate

This documentation will guide you on how to trigger a survey from Dixa using Dixa webhook and a third party system to create the needed logic. This documentation will use Logic Apps.

Prerequisites

Create a campaign in nps.today and note its campaign ID. The campaign ID is the Internal ID in Campaign info. See Find campaign IDs.

The Campaign info dialog with Internal ID, Public ID and Campaign link ID

Also, an API key is required. See here where to find or create your API keys.

Create a webhook in Dixa

The first step is to send a nps.today survey after for example a closed conversation. The current solution for completing that task is to set up a Webhook like this:

Dixa webhook

See this chapter on how to generate the webhook URL.

See example of the webhook payload here
    {
        "event_id": "2ec6bb79-3951-4c56-9d32-66e6ba9381db",
        "event_fqn": "CONVERSATION_CLOSED",
        "event_version": "1",
        "event_timestamp": "2023-01-31T15:56:25.694Z",
        "organization": {
            "id": "4aac76a9-3b37-431a-9a05-a86605b5c3bb",
            "name": "NPS.Today"
        },
        "data": {
            "conversation": {
                "csid": 18,
                "channel": "EMAIL",
                "status": "CLOSED",
                "direction": "INBOUND",
                "queue": {
                    "id": "986359e5-e201-48ab-84af-c7799e03e58c",
                    "name": "Inbound support"
                },
                "contact_point": "[email protected]",
                "requester": {
                    "id": "d1bb9286-bf5a-42d6-b4d3-aaceef0d1e38",
                    "name": "John Doe",
                    "email": "[email protected]",
                    "phone": "+4512345678",
                    "roles": [
                        "Enduser"
                    ]
                },
                "assignee": {
                    "id": "c25bf883-9727-4632-81c3-8ec8f8ff26fd",
                    "name": "John Doe",
                    "email": "[email protected]",
                    "phone": null,
                    "roles": [
                        "Admin",
                        "Agent"
                    ]
                },
                "subject": "Low battery",
                "tags": [],
                "created_at": "2023-01-31T15:56:09.187Z"
            }
        }
    }

See this Dixa webhook guide to learn more about setting up webhook in Dixa.

Listen to the webhook

Now we need to listen to the webhook, to know when a conversation is closed. This is where we need a third-party system to help us. This guide uses Logic Apps, but other systems like Power Automate and Zapier can be used as well.

Create the logic

Create the Trigger

Start by creating a trigger using “When a HTTP request is received”. This will generate a URL that you need for your webhook in Dixa.
The webhook is generated when you save the Logic App.

Also use the payload from above as a “sample payload to generate schema”

HTTP request received

Create your Conditions

Now you need to create your conditions that will filter the relevant HTTP requests, that need to trigger a survey in nps.today.

Conditions in the Power Automate flow

In this case we have created 4 conditions:

  • Conversation status needs to be “CLOSED”
  • Phone number needs to contain a “+” (to make sure we have a phone number because we need to send out survey in a text message)
  • The requester name is grater than “a” (this is to make sure we have a name on the requester, if needed)
  • Channel needs to be a “PSTN_PHONE” (Phone channel)

If the conditions are not met, then stop the process.

If they are met create a new Condition. This Conditions is made to be sure, that the Conversation status is “CLOSED”

Condition 2

Create your Action

If the Status is still “CLOSED” create a HTTP request action.

HTTP request action in the Power Automate flow

Fill the fields with the following

Method: POST

URL:

https://api.nps.today/campaigns/{{campaignId}}/respondent

Headers:
Authorization: apikey {your nps.today API key}
Content-Type: application/json

Body (data you need on the recipient of the survey):

{
    "respondent": {
        "firstName": "{{merged.requester.first_name}}",
        "emailAddress": "{{merged.requester.email.address}}",
        "externalId": "{{merged.requester.id}}",
        "phoneNumber": "{{merged.requester.phone.number}}"
    },
    "employee": {
        "email": "{{merged.user.email.address}}",
        "firstName": "{{merged.user.first_name}}"
    },
    "custom": {
        "conversationid": "{{merged.conversation.csid}}"
    }
}

For all fields, see POST /campaigns/{campaignId}/respondent in the API reference and Trigger surveys.

Now save the process and activate it.

Verify it worked

  1. Close a test conversation in Dixa that meets the conditions in your flow. Use your own phone number or email address.
  2. Check the result in app.nps.today, as described in Test an integration. It also explains how to test with real customer data without sending surveys.

Sum-up

Now we have created a trigger in Dixa, that sends out a text message survey to the requester every time a conversation is Closed, that has phone number, is a Phone Channel, and have a requester name.