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 by the “Survey Submitted” webhook whenever a survey is completed. The workflow would be:
- A participant completes a survey in MyDataHelps.
- MyDataHelps triggers the configured webhook with information about the survey and participant.
- An AWS API Gateway receives the webhook activation at its endpoint.
- 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 |
Description |
Survey Submitted |
This type of webhook can be activated when specific survey(s) are completed. |
Schedule Triggered |
This type of webhook can be activated from within a project schedule, such as on participant enrollment. |
Setting Up a Webhook
To set up a webhook, open up your Project Settings screen and select the “Webhooks” section.
- Select “Add” to create a new webhook.
- Enter the webhook endpoint URL.
- 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.
- 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.
- 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.