Webhook Survey Event Push Format
Introduction
Monitor survey events under a specific user/team. When an event occurs, the server sends an HTTP request using the POST method to one or more specified URLs, with JSON format data and an application/json content-type header.
Supported events:
action | Description |
---|---|
survey.created | New survey added under user or team |
survey.updated | Survey content modified |
survey.deleted | Survey deleted |
Configuration Steps
Register events for users or teams through the API, see API Documentation.
Data Format
Parameter Description
Parameter | Type | Description |
---|---|---|
id | string | uuid |
object | string | Object type |
action | string | Event type |
created_at | string | Push time |
payload | object | Specific content |
payload.object | string | Object type |
payload.id | integer | Survey ID |
payload.hash | string | Survey Hash |
payload.title | string | Survey title |
payload.owner_user_id | integer | Survey owner user ID or team ID |
payload.editor_user_id | integer | User ID who operated the survey |
payload.state | integer | Survey status (2: Collecting, 3: Collection Paused) |
payload.created_at | string | Survey creation time |
payload.updated_at | string | Survey update time |
payload.trace_id | string | For third-party survey tracking |
trace_id Additional Information
- Guide users to open the edit page link: https://wesurvey.com/edit/v2.html?org=60016179293&trace_id=1fd3d87f-b7f9-44fd-af6e-90801620160a
- Surveys created under this link will include the trace_id in event pushbacks
Note: org is the team ID, trace_id is a random string in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12), which can be generated using UUID-related tool libraries. Users should record the trace_id usage scenario for event tracking purposes.
Data Example
{
"id": "33cc555f-056f-4242-a97c-46f3e7d2016f",
"object": "Survey",
"action": "survey.created",
"created_at": "2022-01-26 14:00:00",
"payload": {
"object": "Survey",
"id": 123456,
"hash": "abcd",
"title": "Survey Title",
"owner_user_id": 60000000004,
"editor_user_id": 60000000005,
"created_at": "2022-01-26 14:00:00",
"updated_at": "2022-01-26 14:00:00",
"trace_id": "1fd3d87f-b7f9-44fd-af6e-90801620160a"
}
}
Server-side Debugging Example
Here's an example using PHP
:
<?php
// Accept request parameters
$event = json_decode(file_get_contents("php://input"));
// Write to file
$myfile = fopen("wesurvey.com.log", "w") or die("Unable to open file!");
fwrite($myfile, json_encode($event));
fclose($myfile);
Check if wesurvey.com.log contains the received test request data
Retry Mechanism
After successfully receiving Webhook content, the server should return HTTP status code 200 within 5 seconds, otherwise, it will be considered a push failure. Failed Webhook events will enter the retry queue with a maximum of 7 retries.
Retry rules:
- First retry: 2 minutes after initial failure
- Second retry: 10 minutes after initial failure
- Third retry: 30 minutes after initial failure
- Fourth retry: 1 hour after initial failure
- Fifth retry: 2 hours after initial failure
- Sixth retry: 6 hours after initial failure
- Seventh retry: 15 hours after initial failure
Security
Verifying if Webhook Requests are from Wesurvey
Webhook requests will be initiated from a set of IP addresses, which receivers can use to verify request authenticity. Please obtain the IP list through the IP List API.