Formsort
Search…
Webhooks
The most robust way to receive data during a flow's progress and completion is to set up an endpoint for ingesting webhooks. Formsort can send data to this endpoint after each step (every_step), or only at the end of the flow (on_finalize) or after each step marked as save point (on_savepoint).

Assured delivery

To reduce the possibility of data loss, any unsuccessful call to the webhook endpoint will be retried up to 13 times in an exponential backdown fashion, starting with a wait of 1 second and delaying the last retry to about 2.5 hours.

Shape of the data

The webhook is a POST of JSON data in the following shape:
1
{
2
...answers,
3
"variant_label": string,
4
"variant_uuid": string,
5
"finalized": boolean
6
}
Copied!
If you'd like the responder uuid to be included, you can give it an alias in the webhook configuration.
It's possible to change the shape of the data, for example to nest the answers under their own key, or put them into an array.
The finalizedfield indicates that the flow has been completed. The value of finalized will betrue when any of the following conditions are met:
  1. 1.
    All questions in the final step of the form have been answered, submitted, and the user has clicked Next.
  2. 2.
    All questions in any step with the Is Terminal option toggled on have been answered, submitted, and the user has clicked Next.
  3. 3.
    The user is redirected in the current tab.
  4. 4.
    The user is redirected to a new tab AND either conditions 1 or 2 above are met. In other words, the current step is the final step of the form, or the current is step has the Is Terminal option toggled, and all answers have been answered, submitted, and the user has clicked Next.

Testing webhooks

You can send a test webhook with dummy data for a variant with the Send test webhook button, or just inspect a sample webhook body with the View webhook payload button.

Signing requests

If you'd like the requests to be signed to ensure that they are authentic requests from formsort, you can enable the sign security.
The payloads will be signed with the following Python code. You can obtain the key in the Integrations tab when this option is enabled.
1
def as_bytes(v):
2
return v.encode("utf8")
3
4
5
def hmac_sign(k, m):
6
key = as_bytes(k)
7
message = as_bytes(m)
8
return (
9
base64.urlsafe_b64encode(hmac.new(key, message, hashlib.sha256).digest())
10
.rstrip(b"=")
11
.decode("utf8")
Copied!
Last modified 4mo ago