Using Webhooks

Webhooks allow you to trigger external services in response to events in MyDataHelps. When one such event occurs, the system will make a HTTP POST request to the URL configured in the webhook. The payload of the POST will contain details about the event, such as the event type and the participant that triggered it.

Webhook Example

One way to use webhooks is by leveraging Amazon Web Services (AWS). For example, you might implement some logic in an AWS Lambda that is triggered whenever a survey is completed. The workflow might be:

  • A participant completes a survey in MyDataHelps.
  • MyDataHelps triggers the configured webhook with information about the survey and participant.
  • An AWS API Gateway provides an endpoint for the webhook to activate.
  • The API Gateway triggers an AWS Lambda to execute the desired action. This may utilize other AWS services, such as a database to store app-specific information. For more information about how to trigger Lambdas with webhooks, see the AWS Documentation.

You can also implement a webhook endpoint in your own web application. All it takes is an endpoint that the webhook can send a REST POST request to.

Webhook Events

The following MyDataHelps events can trigger webhooks. View each event for details about how the event is triggered and what data is included in the webhook request payload.

Event Trigger
Survey Submitted A survey has been completed.

Setting Up a Webhook

To set up a webhook, open up your Project Settings screen and select the “Webhooks” section.

  1. Select “Add” to create a new webhook.
  2. Enter the webhook endpoint URL.
  3. Select the webhook event and (if applicable) a survey you want to trigger on. If you want the same webhook endpoint triggered for multiple surveys, you will need to create multiple webhooks.
  4. Select whether this webhook is “live” (used for your real project data) or “test” (used for testing). See more on testing webhooks in the next section.
  5. Click “Save” to save your webhook configuration.

Delete a webhook by clicking the trash icon.

Testing Webhooks

When a webhook is set to “Test” mode, a test button appears next to it. This lets you to test your webhook by making a POST request with sample data to your webhook endpoint when you click the “Send Sample” button.

You can switch a webhook between “Live” mode and “Test” mode at will, though it is suggested that you maintain separate endpoints for testing and your live project to avoid mingling test data with your real data.