Formulayt supports sending form submission data to external services via webhooks. Although our primary example is Zapier, the webhook system itself is open-ended and can be integrated with any endpoint that can receive and process JSON over HTTP. This guide will walk you through the steps to activate webhook integration on your account, create and manage webhook subscriptions, and handle form submission data in your own code or third-party service.


1. Activate the Webhook Integration and Retrieve Your Credentials


Before your Formulayt forms can send data to your custom endpoint, you must:

  1. Activate the Zapier/Webhook integration in your Formulayt account.
    1. This is done in the Apps section of your Formulayt dashboard.
    2. As soon as the integration is active, and you set your account or inidividual form type(s) to start submitting to it, Formulayt will attempt to send form submission data through any valid webhooks you have registered.
  2. Obtain your Formulayt account ID and the secret API key.
    1. Your account ID uniquely identifies your Formulayt account.
    2. The secret API key is used to authenticate requests to Formulayt’s subscription management endpoints (it must be kept private).
    3. If you suspect your API key has been exposed, please revoke it in Formulayt and generate a new one to maintain security.


Important: Once the webhook integration is active and being used by one or more form types form submission, if you do not register any valid subscriptions, form submissions will result in an error (NO_VALID_WEBHOOKS), and your users will be unable to submit forms.


2. Build Your Endpoint to Accept Incoming Form Submissions


Next, you need to implement a listener (endpoint) on your server or application to handle the HTTP POST requests that Formulayt will send. This endpoint can be written in any language or framework as long as it can:

    •    Accept HTTP POST requests.

    •    Parse incoming JSON data.

    •    Respond with an appropriate HTTP status code (usually 2xx on success or 4xx/5xx on errors).


2.1 Understanding the Payload


When a user submits a form, Formulayt will POST a JSON payload to your configured target_url. The exact structure is account-specific (since every Formulayt account may have different default fields), but it is generally a flat JSON object containing:

    •    One or more form fields from the submitted form (keys match your configured field names in Formulayt).

    •    A serverTimestamp field indicating the time at which the submission was processed on Formulayt’s servers.


Below is a generic example of what a form submission payload might look like. Actual field names will depend on the form fields you configure in Formulayt:

{
  "firstName": "John",
  "lastName": "Smith",
  "email": "john.smith@test.com",
  "company": "Test Company",
  "country": "GB",
  "phone": "+441234567890",
  "jobTitle": "Manager",
  "serverTimestamp": "2024-02-01T12:34:56.789Z"
}

2.2 Basic Endpoint Example


Below is a very simple, language-agnostic pseudocode for an endpoint that might receive and log the incoming submission:

POST /my-webhook-endpoint

function handleFormulaytWebhook(request):
    // Parse the JSON body
    data = parseJSON(request.body)

    // Log or handle the data
    log("Received form submission from Formulayt:", data)

    // Return a success response
    return HTTP 200 OK

You can adapt this to your preferred language or web framework.


3. Register Your Endpoint with Formulayt


Once your endpoint is ready to accept data, you must inform Formulayt where to send form submissions. You do this by creating a subscription to a particular event (in this case, "form.submission").


3.1 Create a Subscription


Send a POST request, formatted in JSON, to Formulayt’s subscription creation endpoint:

POST https://app.gatedcontent.com/api/v1/subscriptions


Body JSON FieldTypeRequiredDescription
account_idStringYesYour Formulayt account ID.
api_keyStringYesYour secret Formulayt API key.
eventStringYesform.submission
target_urlStringYesThe full URL of the endpoint that will receive the submission payload.


Example Request (cURL):

curl -X POST "https://app.gatedcontent.com/api/v1/subscriptions" \
     -H "Content-Type: application/json" \
     -d '{
       "account_id": "YOUR_ACCOUNT_ID",
       "api_key": "YOUR_API_KEY",
       "event": "form.submission",
       "target_url": "https://myapi.example.com/formulayt-webhook"
     }'

Sample Response: A successful response (HTTP 200 / 201) returns a JSON object with the subscription ID as the body property, which you should store if you need to manage or remove the subscription later. In the example below, the subscription is 1.

{
    "Error": false,
    "Message": "SUCCESS",
    "Body": 1
}


Important: Formulayt will also attempt to send a sample payload to your endpoint soon after this call, so ensure your endpoint is live and ready.


4. Testing and Obtaining a Sample Payload


If you want to preview what data your endpoint will receive, you can retrieve a sample payload. This payload is generated based on some of your Formulayt account’s key configured fields (first name, last name, email address etc.):

GET https://app.gatedcontent.com/api/v1/subscriptions/sample
Query Parameter TypeRequiredDescription
account_idStringYesYour Formulayt account ID.
api_keyStringYesYour secret Formulayt API key.
eventStringYesform.submission


Sample Response The sample payload is contained in the Body property of the response (the exact fields will differ based on your account’s form configuration). Note that for an actual form submission, you will only receive the contents of Body, not the wrapping object (see section 2.1 above). The sample is formatted in this way to indicate that the sample was generated successfully.

{
    "Error": false,
    "Message": "SUCCESS",
    "Body": {
       "firstName": "John",
       "lastName": "Smith",
       "email": "john.smith@test.com",
       "company": "Test Company",
       "country": "GB",
       "phone": "+441234567890",
       "jobTitle": "Manager",
       "serverTimestamp": "2025-02-06T13:45:12.345Z"
     }
}

5. Deleting a Subscription


If you ever need to stop receiving form submissions at a particular endpoint, you can delete the subscription by its ID:

DELETE https://app.gatedcontent.com/api/v1/subscriptions/:id
ParameterTypeRequiredDescription
:id (URL) StringYesThe unique identifier of the subscription.
account_idStringYesYour Formulayt account ID (in JSON body/query).
api_keyStringYes Your Formulayt API key (in JSON body/query).


5.1 Example Request (cURL)

curl -X DELETE "https://app.gatedcontent.com/api/v1/subscriptions/SUBSCRIPTION_ID" \
     -H "Content-Type: application/json" \
     -d '{
       "account_id": "YOUR_ACCOUNT_ID",
       "api_key": "YOUR_API_KEY"
     }'

Sample Response: A successful response should indicate "Subscription deleted".

{
    "Error": false,
    "Message": "SUCCESS",
    "Body": "Subscription deleted"
}


Additional Notes

  1. Data Handling

    1. Formulayt only relays your submission data and does not store it. If your endpoint is misconfigured, or if you delete your subscription prematurely, submissions will be lost and cannot be retrieved later.
  2. Error Handling

    1. If your endpoint is down or returns a non-2xx status code, Formulayt will consider the submission delivery as failed.
    2. Formulayt does not implement an automatic retry mechanism, so ensure your endpoint is stable or implement your own failure handling.
  3. Security

    1. Treat your Formulayt api_key like a password.
    2. You can use Google reCAPTCHA alongside your webhook to reduce spam submissions. Formulayt will handle the reCAPTCHA check for you once you have activated this App. Refer to this article for further information.
  4. Integration Priority

    1. Once the webhook integration is active and you have at least one valid subscription, your forms will attempt to submit data to that subscription’s target_url. If you also have Zapier configured, Formulayt will attempt to deliver to both (or multiple) active subscriptions.
  5. Testing

    1. When you first create a subscription, Formulayt sends a sample payload to your target_url.
    2. You can also manually retrieve samples at any time using the GET /subscriptions/sample endpoint, as shown above.