Skip to main content

Webhook Survey Event Push Format

重要提示

This is a business. Please upgrade before using it.

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:

actionDescription
survey.createdNew survey added under user or team
survey.updatedSurvey content modified
survey.deletedSurvey deleted

Configuration Steps

Register events for users or teams through the API, see API Documentation.

Data Format

Parameter Description

ParameterTypeDescription
idstringuuid
objectstringObject type
actionstringEvent type
created_atstringPush time
payloadobjectSpecific content
payload.objectstringObject type
payload.idintegerSurvey ID
payload.hashstringSurvey Hash
payload.titlestringSurvey title
payload.owner_user_idintegerSurvey owner user ID or team ID
payload.editor_user_idintegerUser ID who operated the survey
payload.stateintegerSurvey status (2: Collecting, 3: Collection Paused)
payload.created_atstringSurvey creation time
payload.updated_atstringSurvey update time
payload.trace_idstringFor third-party survey tracking

trace_id Additional Information

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.