Gravity Form integration

Published October 27, 2021
Modules
Difficulty

Industry

If you use the Gravity Form plugin for building custom forms in WordPress, you can use webhooks to send data from forms to Synerise. In this use case, the answers from the form are saved as the event parameters on a customer’s profile.

Note: Completing this procedure requires some knowledge on sending API requests using cURL, Postman, or similar tools.
Tip: You may want to split your browser window into two. In one browser window, open the WordPress account, in the other, log in to the Synerise application.

Prerequisites


  • Create a form in Gravity Form plugin. The example form used in this use case contains three pieces of information:
    • Email address of a user who submits the form
    • The name of the form
    • A question about a vehicle condition
  • Install and activate the webhooks add-on in your WordPress account.

Process


In this use case, you will go through the following steps:

  1. Create an incoming webhook.
  2. Create a webhook in Gravity Form.
  3. Finish incoming integration.
  4. Create a workflow.
  5. Testing.

Create an incoming webhook


In this part of the process, create an incoming webhook to which you will send the data submitted through Gravity forms.

  1. In Synerise, go to Automation > Incoming > New integration.
  2. Enter the name of the webhook.
  3. In the Endpoint section, click Define.
    Important: The URL field is already is filled in with the endpoint to which the data submitted through the form will be sent.
    1. Optionally, you can add an icon to this integration.
    2. Confirm by clicking Apply.
  4. Click Finish later.
    Result: The incoming webhook is saved as a draft.

Create a webhook in Gravity Form


In this part of the process, you need to configure the webhook which will send data from the form to Synerise.

  1. In the WordPress account, go to Form Settings > Webhooks tab, and then click the Add New button.
  2. Fill in the form:
    1. In the Name field, enter a name for your form.
    2. In the Request URL, enter the Synerise endpoint URL from step 3 in Creating an incoming webhook procedure.
    3. From the Request method dropdown list, select POST method.
    4. From the Requested Format dropdown list, select JSON format.
    5. In the Request body input, choose Select fields (recommended set-up).
      Note:
      • The Select Fields option displays the field values setting which let you define what you send to Synerise.
      • The All Fields option sends the entire unformatted entry.
    6. In the Field Values inputs, define how each entry from the survey should be sent in the webhook response.
      • In the Key column, enter the name of variables visible in the webhook response.
        WARNING: Use letters only without diacritical characters.
      • In the Value column, enter the question in the form that is assigned to the key.
  3. Confirm the settings by clicking Update settings.
    Result: From now, everytime somebody submits the survey, the request will be sent to the Synerise endpoint.
    Configuration of the Gravity form webhooks
    Configuration of the Gravity form webhooks

Finish incoming integration


Go back to creating the incoming webhook in Synerise.

  1. In Synerise, go to Automation > Incoming.

  2. On the list, find the draft incoming integration you created in step Create an incoming webhook.

  3. In the Incoming data section, click Define.

  4. Fill in the form you created in Gravity Forms and submit it. Alternatively, you can send a request in Postman to this endpoint.

    Example request:

    Important: Replace the body of the request with a sample of the data you will send from the form
        curl --location --request POST 'ENDPOINT_URL_FROM_STEP_3' \
        --header 'Content-Type: application/json' \
        --data-raw '{
            "email": "john.doe@example.com",
            "formType": "formTitle",
            "VehicleCondition": "neutral",
        }' 
  5. In the Incoming data section in Synerise, click Retrieve data. The system waits for the incoming request for 1 minute and 30 seconds.

Create a workflow


In this part of the process, you create a workflow in Synerise. The workflow starts with the business event trigger that is launched every time a customer submits the form. In response to that, on the profile of the customer who submitted the form, an event is saved with the answers in the survey in the form of parameters.

  1. Go to Automation > Workflows > New workflow.
  2. Enter the name of the workflow.
  3. As the first node, select Business Event. In the configuration of the node:
    1. Select the incoming webhook you created as the first part of this use case.
    2. Confirm by clicking Apply.
      Configuring the Business Event node
      Configuring the Business Event node
  4. Add the Ougtoing integration to the workflow. In the configuration of the node:
    1. Enter the name of the webhook. This name will be used as the value of the name parameter of the webhook.response event.

    2. Select the POST method.

    3. Enter the endpoint URL:

      • For workspaces hosted in Microsoft Azure: https://api.synerise.com/v4/events/custom
      • For workspaces hosted in Google Cloud Platform: https://api.geb.synerise.com/v4/events/custom
    4. Enter the following headers:

      • set the content-type header to application/json (default),
      • set the accept header to application/json,
      • set the api-version header to 4.4
    5. Enter the request body. For the form used in this case, the body is as follows:

      {
          "action": "form.submit",
          "label": "Customer submitted a survey",
          "client": {
              "email": "{{request.body.email}}"
          },
          "params": {
              "formTitle": "{{request.body.formTitle}}",
              "VehicleCondition": "{{request.body.VehicleCondition}}"
          }
      }
             
      Note: Learn more about reusing data from incoming integrations in the Outgoing Integration node here

    6. In the Authorization section, select By API key.

    7. From the dropdown list, select a workspace’s API key that has permissions to send custom events.

      Tip: You can read more about API keys here and you can find more information about the endpoint and required API key permissions here.

  5. Confirm by clicking Apply.
    Configuring the Outgoing Integration node
    Configuring the Outgoing Integration node
  6. Add the End node.
  7. Activate your workflow by clicking Save & Run.
    Final workflow configuration
    Final workflow configuration

Testing


Fill in your survey and check if data is collected in Synerise properly. Open the workflow statistics and the survey. Fill in the survey, send it, and observe the statistics. If the Entered and Executed counters increment, your survey triggered the workflow and completed it.

Final workflow configuration
Final workflow configuration

The profile whose identifier was entered in the survey is updated.

Event with survey on a customer's profile
Event with survey on a customer's profile

Read more


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker