StrawPoll Integrations

Webhooks

Webhooks are callbacks that are sent to a URL when a certain event is triggered. They can be used to easily integrate StrawPoll with other services.
A webhook request will send JSON-data to the endpoint. Parts of the data strucutre depends on the event trigger type.
Event Triggers
Webhooks can currently be triggered by the following events:
  • Create Poll
  • Vote
  • Deadline Ends
  • Delete Poll
See below for various request payload examples based on different trigger types.
Example Request Payload ("Create" Trigger)
{ 
  "webhook": {
    "name": "Example Webhook #1",
    "url": "https://hook.integromat.com/e95yg8w...",
    "trigger": "create"
  },
  "content": {
    "id": "abcdefgh1",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
  },
  "create": { 
    "id": "abcdefgh1",
    "type": "poll",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
    "options": [ 
      { 
        "id": "abcdefghabcdefgh", 
        "name": "Answer #1", 
        "type": "text" 
      }, 
      { 
        "id": "ijklmnopijklmnop", 
        "name": "Answer #2", 
        "type": "text" 
      }, 
      { 
        "id": "qrstvwxyqrstvwxy", 
        "name": "Answer #3", 
        "type": "text" 
      }
    ]
  }
}
Example Request Payload ("Vote" Trigger)
{ 
  "webhook": {
    "name": "Example Webhook #1",
    "url": "https://hook.integromat.com/e95yg8w...",
    "trigger": "vote"
  },
  "content": {
    "id": "abcdefgh1",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
  },
  "vote": {
    "name": "Testuser",
    "voted_options": [ 
      { 
        "option_id": "abcdefghabcdefgh", 
        "name": "Answer #1", 
        "vote": 1 
      } 
    ]
  }
}
Example Request Payload ("Vote (Meeting Date)" Trigger)
{ 
  "webhook": {
    "name": "Example Webhook #1",
    "url": "https://hook.integromat.com/e95yg8w...",
    "trigger": "vote"
  },
  "content": {
    "id": "abcdefgh1",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
  },
  "vote": {
    "name": "Testuser",
    "voted_options": [ 
      { 
        "option_id": "abcdefghabcdefgh", 
        "type": "date",
        "name": "2020-11-08T08:00:00Z",
        "start_time": "1604822400000",
        "end_time": "1604826000000",
        "vote": 1 
      } 
    ]
  }
}
The fields "start_time" and "end_time" are Unix timestamps in milliseconds.
Example Request Payload ("Deadline" Trigger)
{ 
  "webhook": {
    "name": "Example Webhook #1",
    "url": "https://hook.integromat.com/e95yg8w...",
    "trigger": "deadline"
  },
  "content": {
    "id": "abcdefgh1",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
  },
  "deadline": {
    "time": "2020-11-05T07:40:06Z",
    "results": { 
      "total_votes": 42,
      "options": [ 
        { 
          "id": "abcdefghabcdefgh", 
          "name": "Answer #1", 
          "votes": 26 
        },
        { 
          "id": "ijklmnopijklmnop", 
          "name": "Answer #2", 
          "votes": 13
        },
        { 
          "id": "qrstvwxyqrstvwxy", 
          "name": "Answer #3", 
          "votes": 3
        }
      ] 
    }
  }
}
Example Request Payload ("Delete" Trigger)
{ 
  "webhook": {
    "name": "Example Webhook #1",
    "url": "https://hook.integromat.com/e95yg8w...",
    "trigger": "delete"
  },
  "content": {
    "id": "abcdefgh1",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
  },
  "delete": { 
    "id": "abcdefgh1",
    "title": "Test Poll",
    "url": "https://strawpoll.com/abcdefgh1"
  }
}
As you can see, for some endpoints the data is available redundantly. This is due to the purpose to always send the "webhook" and the "content" field, no matter which event is triggered.