Polling refers to checking in the status of an external service/app for an event after a set time interval. How does Integry know that an event has occurred? There are two ways of knowing that:


There are many apps that do not support webhooks. In order to connect we need to poll i.e. we need to check the status of the event after set time intervals. Let's say there is an app XYZ that does not support webhooks, and a trigger of that app, "Project Added" is created in Integry. We will send a request after set time intervals and retrieve the list of projects every time. Once a new project is added the list will be updated, so we will run the corresponding integration.

Polling vs Webhooks

Polling is not a real-time update, the time interval between two Integry requests (polls) delays the real-time update of the event which means the corresponding integrations are delayed accordingly. Webhooks are more efficient as compared to polling, they are real-time updates. 

How does Integry implement Polling?

Consider we want to implement the trigger “Contact Added” for SendinBlue which does not support webhooks. The triggers are created under the Triggers tab in your app menu. The page shows the existing triggers and a button, Create Trigger as shown below. You click the button to create a new trigger.  

After adding the name and description of the trigger, we add the endpoint. Turn the Is Poll Based? toggle button on. When you select the Create a new endpoint option from the Poll Endpoint drop-down menu as shown below, you need to fill the endpoint creation form.

The basics of filling the form can be learned here. We will enter the name of the endpoint and select Outgoing endpoint type as we are going to poll with SendinBlue.

A few important points to keep in mind while working with polling triggers:

  • The values of the activity fields are available under the requestBody Twig object. Suppose we have a field with the machine name contact_id, to fetch the value of this field we will use requestBody.contact_id. 
  • The values of tokens or authorization details are available under the authorization object. For example, the value of access token can be fetched using authorization.token.access_token.
  • The remote response we receive is available under the response object. Using the response object you can transform the response the way you want using Twig in response template. We will see it in detail later.  
  • The response of the polling-trigger endpoint should be a top-level array, containing objects with at least one property that uniquely identify them. Also, it is important that the objects inside the array should be in the reverse chronological order i.e. the contact added at the last should be the first object in the array. This is the response requirement of the polling-trigger endpoint. We will dig into that later.

Let us see the individual fields in detail. 

Request URL

As we know from the SendinBlu API Docs to fetch the list of contacts we need to send a request to the following URL

GET  https://api.sendinblue.com/v3/contacts

The response SendinBlu sends is as follows

  "contacts": [
      "email": "contact1@example.com",
      "id": 247,
      "emailBlacklisted": true,
      "smsBlacklisted": true,
      "modifiedAt": "2017-05-01T17:05:03Z",
      "listIds": [
      "attributes": {
        "SMS": "33058407250",
        "IDENTIFICATION": "1-3RHQ-259",
        "CIV": "MS",
        "LAST_NAME": "Brennon",
        "FIRST_NAME": "Meg",
        "DOB": "1986-05-02",
        "ADDRESS": "1 5th avenue",
        "ZIP_CODE": "44300",
        "CITY": "New-York",
        "ACTION_CODE": "17HH98CH"
      "email": "33058407248@mailin-sms.com",
      "id": 245,
      "emailBlacklisted": true,
      "smsBlacklisted": false,
      "modifiedAt": "2017-05-01T17:05:03Z",
      "listIds": [
      "attributes": {
        "SMS": "33058407248",
        "IDENTIFICATION": "1-78JS-432",
        "CIV": "MS",
        "LAST_NAME": "Press",
        "FIRST_NAME": "Sophia",
        "DOB": "1980-09-11",
        "ADDRESS": "5 Flower Street",
        "ZIP_CODE": "44119",
        "CITY": "Seattle",
        "ACTION_CODE": "17HU765"
  "count": 3

Response Template

The remote response we received contains an array “contacts”. As the response is already in a form of an array with objects sorted in the reverse chronological order, we will leave it as it is. Our response template will be

{{ response.contacts | json_encode | raw }}

I json_encode: Generates the JSON representation of the array received

I raw: This prevents any escaping. 

Tracking Property Name 

This field takes in the object property name that uniquely identifies the object. As in this case, we will provide the “id” property (can be seen in the response). Every contact has a unique ID.

Header Details

This part takes the parameters that are sent along with the URL as headers. The headers can be specified as shown below.

After you add the headers , click the Create Endpoint buttonThe example above is specific to SendinBlue, the details of templates, endpoint URL, headers varies from app to app. The rest of the trigger creation steps can be learnt here

Did this answer your question?