Webhook Integration

Webhooks are events that trigger an action. In most cases, they are used for communication between systems. This is the simplest way of getting an alert when something happens in another system.

How to add

  • You can create a webhook by clicking create new webhook under platform webhooks.

  • You will need 2 things here.

  • The content you want to use the webhook first.

  • The second is the endpoint of the webhook.

Webhook Endpoint

  https://yourapp.com/webhook-endpoint

Webhook Settings

  • Name
    Delay
    Description

    Delay in seconds between event trigger (set finish) and webhook fire in seconds. This will be usefull if you have leads on the result page and you want to give your visitors some time to get the lead data with your webhook.

  • Name
    Send Answers
    Description

    Send all the votes with the data.

  • Name
    Send Leads
    Description

    Send all user input leads with the data.

  • Name
    Send Incomplete
    Description

    Triggers webhook even if user did not see the end result.

  • Name
    Incomplete Delay
    Description

    Delay in seconds between set start and webhook fire. For example if you set this field as 120, Poltio will send votes up till 120 seconds after your visitor starts the set. If that visitor will complete the set after 120 seconds, you will also recieve another webhook event for that.


Example webhook payload

Request

POST
yourapp.com/webhook-endpoint
 {
  "poltio_user_id": 1234,
  "session_id": "Poltio Session ID",
  "session_start_date": "Start date of session (ISO format date (2024-01-23T11:59:33.000000Z))",
  "session_end_date": "End date of session (ISO format date (2024-01-23T11:59:59.000000Z))",
  "publisher_uuid": "Publisher UUID",
  "custom_id": "Custom Publisher ID",
  "event_time": 1568624875,
  "content_type": "Content type",
  "content_id": 12345,
  "complete_session": true,
  "answers": [
      {
         "question_id": 1234,
         "question": "Question Title",
         "answers": [
             {
                  "answer_id": 1234,
                 "answer": "Voted answer title"
              }
          ]
       }
    ],
  "result": {
    "result_id": 1234,
    "result_title": "Result Title",
    "result_image": "content/gcp/1678957893.2458.png",
    "result_desc": "Result Description",
    "time_spent": 16789 (ms),
    "right_answer": 0,
    "calculator_result": "0",
    },
  "leads": [
      {
         "user_id": 1234,
         "phone": "+1231231234",
         "email": "example@example.com",
         "name": "Name",
         "comment": "Comment",
         "created_at": "Lead Create Date (ISO format date (2024-01-23T11:59:43.000000Z))",
         "tc_checked": true,
         "content_type": "Content type",
         "content_id": 12345
      }
     ]
  }

Note

If you want to use result_image, you need to add Poltio CDN Path + width x height at the beginning.( You can use width and height 0 for original size. ) Example: https://cdn.poltio.com/100x100/content/gcp/1693828810.3228.jpeg)