Skip to content

Webhook

Trigger a survey with a webhook

A webhook connection is a way to send real-time data between two different applications or systems. Using a webhook connection can be a powerful tool for automating workflows and triggering events for sending surveys with nps.today. Here's how to use the webhook connection:

Set up your webhook

Setting up your webhook to nps.today you need a webhook endpoint, which is a URL that your application can send data to. You may also need to configure your webhook to specify which events should trigger the webhook. The webhook endpoint is used to add a campaign member to a campaign in nps.today which triggers a survey to an email or phone number.

Endpoint:

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

Authentication

If a basic authentication by username and password is needed it will be the following:

Authentication:
Username: apikey
Password: {{apikey from your nps.today account}}

See here where to find or create your apikey.

Define your JSON payload

Not able to provide JSON payload?

If your webhook does not provide you with the ability to send a JSON payload, a third-party system can help you. Systems like Power Automate, Logic Apps and Zapier can listen to your webhook and send the payload.

Click here you see an example from a Dixa integration, where a third-party system (Logic Apps) is used for setting up the integration.

Before you can send data with a webhook, you will need to define the structure of your JSON payload. This will typically involve defining the fields that your payload will contain, as well as the data types of each field. Here you can define the data you need from your application and map it to the campaign member in nps.today. Here is an example of how a payload can look like:

Payload:

{
"respondent": {
      "firstName": "{{merged.first_name}}",
      "emailAddress": "{{merged.email.address}}",
      "externalID": "{{merged.unique.id}}",
      "phonenumber": "{{merged.phone.number}}"
    },
    "custom":
    {
    "segment":"{{A}}"
    }
}

See more information here.

Test your webhook

Before you start using your webhook in production, it's a good idea to test it to make sure that it's working correctly. You can do this by sending test data with your JSON payload to your webhook and verifying that your application receives the data as expected.

Use your webhook

Once your webhook is set up and tested, you can start using it to send data between your applications using your JSON payload. This may involve triggering workflows, syncing data between systems, or triggering events based on real-time data.

Sum up

To sum up this is basically what you need from nps.today to create a webhook connection:

Username: apikey
Password: {{apikey}}

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

Payload:

{
"respondent": {
      "firstName": "{{merged.first_name}}",
      "emailAddress": "{{merged.email.address}}",
      "externalID": "{{merged.unique.id}}",
      "phonenumber": "{{merged.phone.number}}"
    },
    "custom":
    {
    "segment":"{{A}}"
    }
}

Hope this will help you get up and running with your webhook. If not, please send an e-mail to support@npstoday.com for more information.

Get responses with a webhook

You can use a webhook to listen to specific campaigns. This will often be used to trigger certain task based on a new response.

You can create a webhook on a campaign by going to the "NPs Notification" setting in your campaign editor, add a Webhook alert, and save the campaign.

Webhook alert

See here to find more about how to set up NPS Notifications.

Use the "Test" feature to see if the webhook works.

Webhook raw content example

Below is a test example on how the raw content when using the alert webhook can look like:

    {
        "DoNotContact":false,
        "AgentRating":null,
        "IsPublic":false,
        "Sender":123,
        "SurveyOpenedTime":"2023-04-17T09:28:25.7821525+00:00",
        "ReminderOpenedTime":"2023-04-17T09:28:25.7821514+00:00",
        "SurveySendTime":"2023-04-17T09:28:25.7821523+00:00",
        "SurveyScheduledTime":"2023-04-17T09:28:25.7821523+00:00",
        "ReminderScheduledTime":"2023-04-17T09:28:25.7821508+00:00",
        "ReminderSendTime":"2023-04-17T09:28:25.7821508+00:00",
        "SurveyBouncedTime":"2023-04-17T09:28:25.7821524+00:00",
        "ReminderBouncedTime":"2023-04-17T09:28:25.7821513+00:00",
        "History":null,
        "OrgId":"7b923cd1-d919-4ad7-9e69-9bf13995438a",
        "Device":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
        "Answer1":"",
        "Answer2":"",
        "Answer3":"",
        "Answer4":"",
        "Answer5":"",
        "MsCrmId":"Some Id for MsCrm",
        "Custom":{},
        "AllowedForPublicUse":false,
        "SurveyAnswers":null,
        "SurveyAnswersSimple":null,
        "AdminComment":"Customer happy, no action required",
        "AdminCommentBy":"Jane Doe",
        "CampaignName":"Test Campaign",
        "CampaignMemberId":56789,
        "CampaignMembershipGuid":"4e1592e6-75b7-4f9b-9bb4-798636c234fc",
        "ResponsibleEmployee":1234,
        "Category":{
            "Id":65,
            "Name":"Payment"
        },
        "Respondent":{
            "Id":1234,
            "Address1":"Nowhere 1",
            "Address2":"",
            "City":"Notown",
            "Country":"Denmark",
            "ZipCode":"1234",
            "EmailAddress":"johndoe@example.com",
            "FirstName":"John",
            "LastName":"Doe",
            "Active":true,
            "Title":"Mr.",
            "Company":{
                "Id":1234,
                "Name":"Testers Inc",
                "EmailAddress":"testersinc@example.com",
                "Industry":"",
                "Address1":"Somewhere",
                "Address2":"",
                "City":"Notown",
                "Country":"",
                "ZipCode":"1234",
                "AccountNo":"1234",
                "Segment":"",
                "PhoneNumber":"12345678",
                "PrimaryEmployee":null,
                "Managers":null
            },
            "Employee":{
                "Id":1324,
                "Email":"janedoe@example.com",
                "FirstName":"Jane",
                "LastName":"Doe",
                "Title":"Ms",
                "Department":"Acme Denmark",
                "Team":"A-team",
                "Division":"Primary",
                "PhoneNumber":"12345678",
                "Active":true,
                "ExternalId":null
            },
            "Department":"Sales",
            "PhoneNumber":"12345678",
            "ExternalId":"677777685858"
        },
        "Id":1234567,
        "Rating":7,
        "RatingTime":"2023-04-17T09:28:25.7821482+00:00",
        "Anon":false,
        "RatingBy":"John Doe",
        "UserComment":"This is a webhook, it works!",
        "UserCommentBy":"John Doe",
        "CommentTime":"2023-04-17T09:28:25.78215+00:00"
        "CampaignId":1234,
        "Closed":false
        }