SurveyMonkey adding webhooks

1.8k Views Asked by At

We were under the impression that we could add a webhook/url with each recipient we added using recipients/bulk. So if our recipients looked like the below, we would just be able to add the webhook data with each one of the entries. After looking around the docs for a little while, it doesn't appear this is the case.:

{
    "contacts" :[{
        "email":"[email protected]",
        "first_name": "John",
        "last_name": "Doe",
        "custom_fields": {
            "1": "2428156"
        }
    },
    {
        "email":"[email protected]",
        "first_name": "Somebody",
        "last_name": "Else",
        "custom_fields": {
            "1": "2428143"
        }
    }]
}

Does anybody know if this is possible? If not, how does everybody else send recipients in bulk and have each one in that list go to the proper webhook URL to parse the responses?

Thanks in advance, Whoopah

1

There are 1 best solutions below

8
On BEST ANSWER

The webhook events available are for responses not recipients. What you would probably want to do is have one webhook for all your responses, example:

POST /v3/webhooks
{
    "name": "Test Webhook",
    "event_type": "response_completed",
    "object_type": "survey",
    "object_ids": ["<survey_id>"],
    "subscription_url": "http://example.com/mywebhook"
}

Then for every completed message for the specified surveys, you'll get a notification with a body something like this to your subscription_url:

{
    "respondent_id": "<response_id>",
    "recipient_id": "<recipient_id>",
    "survey_id": "<survey_id>",
    "user_id": "<user_id>",
    "collector_id": "<collector_id>"
}

The recipient_id will let you know which recipient that particular response was for which you can use for whatever your use case is. If you need more information then you can make a request to get the response details

GET /v3/surveys/<survey_id>/responses/<response_id>/details

Or don't include the /details if you don't want the answers, just want the metadata for that response.

Or if you want specifically more details about that recipient and not the responses you can fetch the recipient details

GET /v3/collectors/<collector_id>/recipients/<recipient_id>

Which gives you information you may have stored in extra_fields or whatnot.