Documentation Index
Fetch the complete documentation index at: https://docs.sprig.com/llms.txt
Use this file to discover all available pages before exploring further.
What is a Webhook?
A webhook is an HTTP request triggered by an event in a source system (in this case, Sprig) and sent to a destination system with a payload of data. Webhook requests are automatically sent out when their event is triggered in Sprig.
What Webhook Events Does Sprig Support?
Sprig supports webhooks triggered by the following events:
- Answer submitted - a user submits an answer to a specific question in a study.
- Study submitted - a user completes and submits a study.
- Study sent - Sprig has triggered and delivered a study.
- Study seen - a user has viewed a study.
- Theme identified - Sprig identifies a new theme associated with a study.
- Study status changed - a study becomes paused, completed, etc.
Currently, Sprig supports Bearer Tokens for webhook authentication. The webhook is sent as an HTTP POST request to the specified endpoint, in JSON format.
You can have different Webhook configurations for each Product and Environment.
Configuring Webhooks in Sprig
To receive webhooks from Sprig to a destination system:
- Navigate to Integrations > Destinations > Webhook and click Configure.
- Select the Production or Development environment.
- Enter the destination system’s Payload URL.
- Enter the Bearer Token API Secret (Bearer_is automatically prepended to the_authorization: header field).
- Check which events in Sprig you want to trigger a Webhook request.
- Click Test Webhook to see if the request posts to the destination system.
- Click Save to save the configuration.
Example cURL equivalent of the Test Webhook request
curl -X 'POST' 'https://webhook.site/96255364-4d38-4be5-a6e4-795881dc5b6b?' -H 'connection: close' -H 'host: webhook.site' -H 'content-length: 92' -H 'user-agent: axios/0.21.2' -H 'authorization: Bearer APIsecret' -H 'content-type: application/json' -H 'accept: application/json, text/plain, */*' -d $'{"id":1,"environmentId":"abc123","surveyId":1,"surveyName":"TEST_SURVEY","eventType":"TEST"}'
Example Payloads for Each Event
Answer Submitted
| Property | Type | Description | | | |
|---|
| id | Integer | Webhook ID | | | |
| environmentId | String | Internal Environment ID | | | |
| createdAt | Datetime | Creation date and time | | | |
| responseGroupUid | String | UUID for the Group of Responses sent by a User | | | |
| response | String \ | Integer \ | List \ | Object | Response Text or Option to the Question. This can be an Integer, String, or List, or Object. |
| surveyId | Integer | Unique Survey ID | | | |
| surveyName | String | Survey name/title | | | |
| question | String | Question wording | | | |
| questionType | String | Question type (open, nps, multipleselect, matrix, etc.) | | | |
| visitorId | String | Visitor ID | | | |
| oldVisitorId | integer | Legacy Vistor ID | | | |
| userId | String | User ID | | | |
| anonymousId | String | Segment data not used by Sprig | | | |
| triggeringEvent | String | Event name of event that initiated study for visitor | | | |
| timestamp | Timestamp | Time of response in UTC unix milliseconds epoch | | | |
| email | String | Email address of the user | | | |
| attributes | map | A key-value map of custom attributes you can set on the user | | | |
| href | String | URL where study was activated if web study | | | |
| os | String | Operating system of device if collected from SDK | | | |
| browser | String | Browser that study was activated if web study | | | |
| userAgent | String | Information about platform visitor used if collected from SDK | | | |
| customMetadata | Object | A key-value map of custom metadata you can set on the url of link studies, empty map otherwise | | | |
| selectedIndexes | Integer \ | List | This field can either be an Integer of a List of Integers, depending on the question type. If the question type is “multiplechoice”, this field will be an Integer. If the question type is “multipleselect”, this field will be a List of Integers. | | |
| eventType | String | The type of event that triggers the webhook | | | |
| eventName | String | Name of Event under the Event Type | | | |
| eventProperties | Object | A key-value map of event properties that were set to target this visitor, empty map otherwise. | | | |
Theme Identified
| Property | Type | Description |
|---|
| themename | string | Theme Name |
| updatedAt | date/time | date and time |
| productId | string | ID of the product |
| environmentId | string | Environment ID |
| questionText | string | Question body text |
| questionType | string | Type of Question |
Study Submitted
| Property | Type | Description |
|---|
| visitorId | string | unique ID of the survey respondent |
| platform | string | Study delivery method |
| surveyId | string | ID of the survey |
| timestamp | Time | UTC timestamp of when survey was completed |
| environmentId | string | Enironment ID |
| eventDate | date / time | Datestamp of when survey was completed in UTC |
| recordType | string | Will always be Survey |
| action | string | will always be completed |
| responseGroupUid | integer | UUID of Response Group (used for debugging purposes) |
| productName | string | Name of Sprig Product configured by the Customer |
| productId | integer | Internal Numeric Id of Product (used for debugging) |
| questions | string | All the questions in the survey with responses if available |
| question | string | Question instance |
| response | string | Response to the question |
| order | string | order of question in the survey |
| eventType | string | Event type |
Study Status Changed
| Property | Type | Description |
|---|
| surveyId | string | unique ID of the survey (used for debugging) |
| surveyName | string | Name of the Survey |
| oldStatus | string | Old status of the survey |
| status | string | Updated status of the survey (possible values are “NEW”, “IN_PROGRESS”, “PAUSED”, “COMPLETED”) |
| environmentId | string | Environment ID |
| productName | string | Name of Sprig Product configured by the Customer |
| productId | integer | Internal Numeric Id of Product (used for debugging) |
| eventName | string | Name of Event under the Event Type |
| questions | string | All the questions in the survey |
| question | string | Question text |
| questionTypeId | integer | Type of question |
| eventType | string | Event type (will always be product message in this json object) |
Study Sent
| Property | Type | Description |
|---|
| isUserInterviews | boolean | True if Link Study with User Interviews integration enabled |
| platform | string | Study delivery method |
| timestamp | time | UTC timestamp of when survey was completed |
| recordType | string | record type will always be “survey” |
| eventDate | date/time | Datestamp of when survey was completed in UTC |
| visitorId | string | unique ID of the survey respondent |
| environmentId | string | Environment ID |
| surveyId | integer | survey ID |
| action | string | will always be completed |
| responseGroupUid | integer | UUID of Response Group (used for debugging purposes) |
| productName | string | Name of Sprig Product configured by the Customer |
| productId | integer | Internal Numeric Id of Product (used for debugging) |
| eventName | string | Name of Event under the Event Type |
| triggeringEvent | string | Event name of event that initiated study for visitor |
| surveyName | string | Name of the Sprig Study |
| attributes | object | Object of attributes set on the visitor if available |
| email | string | Email address if set |
| oldVisitorId | null | Deprecated |
| userId | string | User ID if set |
| anonymousId | string | Segment Anonymous ID if set |
| customMetadata | object | Custom metadata if set for Link Study response |
| eventType | string | Event type |
Study Seen
| Property | Type | Description |
|---|
| visitorId | string | unique ID of the survey respondent |
| timestamp | Time | UTC timestamp of when survey was completed |
| environmentId | string | Environment ID |
| platform | string | Study delivery method |
| recordType | string | record type will always be “survey” |
| eventDate | date/time | Datestamp of when survey was completed in UTC |
| surveyId | integer | Will always be Survey |
| action | string | be completed ID |
| responseGroupUid | integer | UUID of Response Group (used for debugging purposes) |
| productName | string | Name of Sprig Product configured by the Customer |
| productId | integer | Internal Numeric Id of Product (used for debugging) |
| eventName | string | Name of Event under the Event Type |
| triggeringEvent | string | Event name of event that initiated study for visitor |
| surveyName | string | Name of the Sprig Study |
| attributes | object | Object of attributes set on the visitor if available |
| email | string | Email address if set |
| oldVisitorId | null | Deprecated |
| userId | string | User ID if set |
| anonymousId | string | Segment Anonymous ID if set |
| customMetadata | object | Custom metadata if set for Link Study response |
| eventType | string | Event type |