Create Webhook
create_webhookCreates a webhook: the survey's events are POSTed as JSON to your https URL from then on. Standing configuration with side effects — confirm with the user first: call WITHOUT confirm for a PREVIEW, then again with confirm:true. The preview creates no webhook, but sends one sample HTTPS POST to targetURL to check reachability — preview only against addresses you own or trust. Health grading: 2xx = healthy, 0 = unreachable, other codes = the endpoint refused the sample. An unreachable target (0) blocks creation unless force:true is passed; other non-2xx answers warn but create. eventType: ResponseRecieved (a response was submitted or updated — payload carries the answers) or SurveyPublished (the survey was (re)started). Personal/contact fields are NEVER sent — only question answers: includeFields accepts question variable names as returned by get_survey (Q1, Q3.2, …); left empty, it is expanded to the explicit list of ALL question variables, so contact columns stay out of the payload by construction. Verified by readback: the created hook is re-read from the survey's webhook list before success is reported. Fire a sample with test_webhook and watch health with get_webhook_deliveries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Survey publication code — the 8-character code from the survey's public link (e.g. 1a2b3c4d). Returned by list_surveys. | |
| force | No | true = create even when the health ping says the target is UNREACHABLE (statusCode 0). Use only when the user insists, e.g. the receiver goes live later. | |
| confirm | No | Omit or false → preview: no webhook is created, but one sample HTTPS POST is sent to targetURL to check reachability. true → actually create the webhook (only after the user explicitly agreed). | |
| eventType | Yes | Event to subscribe to: ResponseRecieved or SurveyPublished (exact spelling — the historic 'Recieved' is intentional). | |
| targetURL | Yes | Absolute https:// URL the events are POSTed to. Plain http is refused. | |
| useCustomID | No | true = use the questions' custom IDs as payload property names. | |
| answersAsText | No | true = push answers as labels instead of numeric codes. | |
| includeFields | No | Question variables to include in ResponseRecieved payloads, by the names get_survey returns (e.g. ["Q1","Q2.3"]). Omit for ALL question variables. Contact/unknown names are refused. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | What the call did, verified, refused or previewed — the complete human-readable outcome. | |
| preview | No | true when the call was a preview (confirm not passed): nothing was changed. |