Webhooks
Receive Updates via 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 structure depends on the event trigger type.
Event Triggers
Webhooks can currently be triggered by the following events:
- Create poll ("create_poll")
- Update poll ("update_poll")
- Vote ("vote_poll")
- Deadline ends ("deadline_poll")
- Reset poll ("reset_poll")
- Delete poll ("delete_poll")
See below for various request payload examples based on different trigger types.
Trigger "create_poll" - Create poll
{
"event": "create_poll",
"timestamp": 1645702975,
"data": {
poll: {
"created_at": 1642684487,
"creator": {
"avatar_path": "/images/avatars/gregor-krambs-eNoZr17Gg3x.png",
"created_at": 1642677936,
"displayname": "Gregor Krambs",
"username": "gregor-krambs"
},
"id": "b7rnzxlZOl1",
"is_votable": 1,
"media": null,
"path": "/polls/b7rnzxlZOl1",
"pin_code": null,
"poll_config": {
"allow_comments": 1,
"allow_other_option": 0,
"allow_vpn_users": 0,
"deadline_at": 1642685149,
"duplication_checking": "ip",
"edit_vote_permissions": "nobody",
"hide_participants": 0,
"is_multiple_choice": 0,
"is_private": 0,
"multiple_choice_max": 0,
"multiple_choice_min": 0,
"require_voter_names": 0,
"results_visibility": "always",
"send_notifications": 1,
"send_webhooks": 1
},
"poll_meta": {
"comment_count": 0,
"creator_country": "de",
"description": "",
"location": "",
"participant_count": 0,
"timezone": null,
"view_count": 0,
"vote_count": 0
},
"poll_options": [
{
"id": "Re7ZJ4Pn3Kb",
"max_votes": 0,
"media_id": null,
"position": 0,
"secondary": "",
"value": "wat",
"vote_count": 0
},
{
"id": "540ZmRAyaRV",
"max_votes": 0,
"position": 1,
"secondary": "",
"value": "wat",
"vote_count": 0
}
],
"reset_at": 1642685161,
"results_key": "f0c5bb06-79f2-11ec-ab86-43cfa7d8e06d",
"results_path": "/polls/b7rnzxlZOl1/results",
"slug": null,
"status": "published",
"title": "test",
"type": "multiple_choice",
"updated_at": 1642685150,
"url": "https://strawpoll.com/polls/b7rnzxlZOl1",
"version": "82ae4ffa-79f4-11ec-a974-bc4baeb948a2"
}
}
}
Trigger "update_poll" - Update poll
{
"event": "update_poll",
"timestamp": 1645702975,
"data": {
poll: {
"created_at": 1642684487,
"creator": {
"avatar_path": "/images/avatars/gregor-krambs-eNoZr17Gg3x.png",
"created_at": 1642677936,
"displayname": "Gregor Krambs",
"username": "gregor-krambs"
},
"id": "b7rnzxlZOl1",
"is_votable": 1,
"media": null,
"path": "/polls/b7rnzxlZOl1",
"pin_code": null,
"poll_config": {
"allow_comments": 1,
"allow_other_option": 0,
"allow_vpn_users": 0,
"deadline_at": 1642685149,
"duplication_checking": "ip",
"edit_vote_permissions": "nobody",
"hide_participants": 0,
"is_multiple_choice": 0,
"is_private": 0,
"multiple_choice_max": 0,
"multiple_choice_min": 0,
"require_voter_names": 0,
"results_visibility": "always",
"send_notifications": 1,
"send_webhooks": 1
},
"poll_meta": {
"comment_count": 0,
"creator_country": "de",
"description": "",
"location": "",
"participant_count": 0,
"timezone": null,
"view_count": 0,
"vote_count": 0
},
"poll_options": [
{
"id": "Re7ZJ4Pn3Kb",
"max_votes": 0,
"media_id": null,
"position": 0,
"secondary": "",
"value": "wat",
"vote_count": 0
},
{
"id": "540ZmRAyaRV",
"max_votes": 0,
"position": 1,
"secondary": "",
"value": "wat",
"vote_count": 0
}
],
"reset_at": 1642685161,
"results_key": "f0c5bb06-79f2-11ec-ab86-43cfa7d8e06d",
"results_path": "/polls/b7rnzxlZOl1/results",
"slug": null,
"status": "published",
"title": "test",
"type": "multiple_choice",
"updated_at": 1642685150,
"url": "https://strawpoll.com/polls/b7rnzxlZOl1",
"version": "82ae4ffa-79f4-11ec-a974-bc4baeb948a2"
}
}
}
Trigger "vote_poll" - Vote poll
{
"event": "vote_poll",
"timestamp": 1645702975,
"data": {
vote => {
{
id => null,
name => 'John Doe',
vote_type => 'add',
poll_votes => [1,0],
}
},
poll: {
"created_at": 1642684487,
"creator": {
"avatar_path": "/images/avatars/gregor-krambs-eNoZr17Gg3x.png",
"created_at": 1642677936,
"displayname": "Gregor Krambs",
"username": "gregor-krambs"
},
"id": "b7rnzxlZOl1",
"is_votable": 1,
"media": null,
"path": "/polls/b7rnzxlZOl1",
"pin_code": null,
"poll_config": {
"allow_comments": 1,
"allow_other_option": 0,
"allow_vpn_users": 0,
"deadline_at": 1642685149,
"duplication_checking": "ip",
"edit_vote_permissions": "nobody",
"hide_participants": 0,
"is_multiple_choice": 0,
"is_private": 0,
"multiple_choice_max": 0,
"multiple_choice_min": 0,
"require_voter_names": 0,
"results_visibility": "always",
"send_notifications": 1,
"send_webhooks": 1
},
"poll_meta": {
"comment_count": 0,
"creator_country": "de",
"description": "",
"location": "",
"participant_count": 0,
"timezone": null,
"view_count": 0,
"vote_count": 0
},
"poll_options": [
{
"id": "Re7ZJ4Pn3Kb",
"max_votes": 0,
"media_id": null,
"position": 0,
"secondary": "",
"value": "wat",
"vote_count": 0
},
{
"id": "540ZmRAyaRV",
"max_votes": 0,
"position": 1,
"secondary": "",
"value": "wat",
"vote_count": 0
}
],
"reset_at": 1642685161,
"results_key": "f0c5bb06-79f2-11ec-ab86-43cfa7d8e06d",
"results_path": "/polls/b7rnzxlZOl1/results",
"slug": null,
"status": "published",
"title": "test",
"type": "multiple_choice",
"updated_at": 1642685150,
"url": "https://strawpoll.com/polls/b7rnzxlZOl1",
"version": "82ae4ffa-79f4-11ec-a974-bc4baeb948a2"
}
}
}
Trigger "deadline_poll" - Deadline ends
{
"event": "deadline_poll",
"timestamp": 1645702975,
"data": {
poll: {
"created_at": 1642684487,
"creator": {
"avatar_path": "/images/avatars/gregor-krambs-eNoZr17Gg3x.png",
"created_at": 1642677936,
"displayname": "Gregor Krambs",
"username": "gregor-krambs"
},
"id": "b7rnzxlZOl1",
"is_votable": 1,
"media": null,
"path": "/polls/b7rnzxlZOl1",
"pin_code": null,
"poll_config": {
"allow_comments": 1,
"allow_other_option": 0,
"allow_vpn_users": 0,
"deadline_at": 1642685149,
"duplication_checking": "ip",
"edit_vote_permissions": "nobody",
"hide_participants": 0,
"is_multiple_choice": 0,
"is_private": 0,
"multiple_choice_max": 0,
"multiple_choice_min": 0,
"require_voter_names": 0,
"results_visibility": "always",
"send_notifications": 1,
"send_webhooks": 1
},
"poll_meta": {
"comment_count": 0,
"creator_country": "de",
"description": "",
"location": "",
"participant_count": 0,
"timezone": null,
"view_count": 0,
"vote_count": 0
},
"poll_options": [
{
"id": "Re7ZJ4Pn3Kb",
"max_votes": 0,
"media_id": null,
"position": 0,
"secondary": "",
"value": "wat",
"vote_count": 0
},
{
"id": "540ZmRAyaRV",
"max_votes": 0,
"position": 1,
"secondary": "",
"value": "wat",
"vote_count": 0
}
],
"reset_at": 1642685161,
"results_key": "f0c5bb06-79f2-11ec-ab86-43cfa7d8e06d",
"results_path": "/polls/b7rnzxlZOl1/results",
"slug": null,
"status": "published",
"title": "test",
"type": "multiple_choice",
"updated_at": 1642685150,
"url": "https://strawpoll.com/polls/b7rnzxlZOl1",
"version": "82ae4ffa-79f4-11ec-a974-bc4baeb948a2"
}
}
}
Trigger "reset_poll" - Reset poll
{
"event": "reset_poll",
"timestamp": 1645702975,
"data": {
poll: {
"created_at": 1642684487,
"creator": {
"avatar_path": "/images/avatars/gregor-krambs-eNoZr17Gg3x.png",
"created_at": 1642677936,
"displayname": "Gregor Krambs",
"username": "gregor-krambs"
},
"id": "b7rnzxlZOl1",
"is_votable": 1,
"media": null,
"path": "/polls/b7rnzxlZOl1",
"pin_code": null,
"poll_config": {
"allow_comments": 1,
"allow_other_option": 0,
"allow_vpn_users": 0,
"deadline_at": 1642685149,
"duplication_checking": "ip",
"edit_vote_permissions": "nobody",
"hide_participants": 0,
"is_multiple_choice": 0,
"is_private": 0,
"multiple_choice_max": 0,
"multiple_choice_min": 0,
"require_voter_names": 0,
"results_visibility": "always",
"send_notifications": 1,
"send_webhooks": 1
},
"poll_meta": {
"comment_count": 0,
"creator_country": "de",
"description": "",
"location": "",
"participant_count": 0,
"timezone": null,
"view_count": 0,
"vote_count": 0
},
"poll_options": [
{
"id": "Re7ZJ4Pn3Kb",
"max_votes": 0,
"media_id": null,
"position": 0,
"secondary": "",
"value": "wat",
"vote_count": 0
},
{
"id": "540ZmRAyaRV",
"max_votes": 0,
"position": 1,
"secondary": "",
"value": "wat",
"vote_count": 0
}
],
"reset_at": 1642685161,
"results_key": "f0c5bb06-79f2-11ec-ab86-43cfa7d8e06d",
"results_path": "/polls/b7rnzxlZOl1/results",
"slug": null,
"status": "published",
"title": "test",
"type": "multiple_choice",
"updated_at": 1642685150,
"url": "https://strawpoll.com/polls/b7rnzxlZOl1",
"version": "82ae4ffa-79f4-11ec-a974-bc4baeb948a2"
}
}
}
Trigger "delete_poll" - Delete poll
{
"event": "delete_poll",
"timestamp": 1645702975,
"data": {
poll: {
"created_at": 1642684487,
"creator": {
"avatar_path": "/images/avatars/gregor-krambs-eNoZr17Gg3x.png",
"created_at": 1642677936,
"displayname": "Gregor Krambs",
"username": "gregor-krambs"
},
"id": "b7rnzxlZOl1",
"is_votable": 1,
"media": null,
"path": "/polls/b7rnzxlZOl1",
"pin_code": null,
"poll_config": {
"allow_comments": 1,
"allow_other_option": 0,
"allow_vpn_users": 0,
"deadline_at": 1642685149,
"duplication_checking": "ip",
"edit_vote_permissions": "nobody",
"hide_participants": 0,
"is_multiple_choice": 0,
"is_private": 0,
"multiple_choice_max": 0,
"multiple_choice_min": 0,
"require_voter_names": 0,
"results_visibility": "always",
"send_notifications": 1,
"send_webhooks": 1
},
"poll_meta": {
"comment_count": 0,
"creator_country": "de",
"description": "",
"location": "",
"participant_count": 0,
"timezone": null,
"view_count": 0,
"vote_count": 0
},
"poll_options": [
{
"id": "Re7ZJ4Pn3Kb",
"max_votes": 0,
"media_id": null,
"position": 0,
"secondary": "",
"value": "wat",
"vote_count": 0
},
{
"id": "540ZmRAyaRV",
"max_votes": 0,
"position": 1,
"secondary": "",
"value": "wat",
"vote_count": 0
}
],
"reset_at": 1642685161,
"results_key": "f0c5bb06-79f2-11ec-ab86-43cfa7d8e06d",
"results_path": "/polls/b7rnzxlZOl1/results",
"slug": null,
"status": "published",
"title": "test",
"type": "multiple_choice",
"updated_at": 1642685150,
"url": "https://strawpoll.com/polls/b7rnzxlZOl1",
"version": "82ae4ffa-79f4-11ec-a974-bc4baeb948a2"
}
}
}