Managing your polls using RumbleTalk API


Read polls

GET
https://api.rumbletalk.com/chats/{chatId}/polls

Response format

  • Parameter
  • Type
  • Description
  • status
  • boolean
  • True on success, false otherwise
  • count
  • integer
  • Total number of polls in the query
  • data
  • array
  • An array of objects, each representing a poll

Format of the data parameter

  • Parameter
  • Type
  • Description
  • id
  • integer
  • The ID of the poll
  • status
  • string
  • The current status of the poll
  • roomId
  • integer
  • The ID of the room where the poll was created
  • userId
  • integer
  • The ID of the user who created the poll
  • question
  • string
  • The poll's question
  • answer1
  • string
  • The 1st answer option
  • answer2
  • string
  • The 2nd answer option
  • answer3
  • string
  • The 3rd answer option
  • answer4
  • string
  • The 4th answer option
  • answer1count
  • integer
  • The number of votes of answer1
  • answer2count
  • integer
  • The number of votes of answer2
  • answer3count
  • integer
  • The number of votes of answer3
  • answer4count
  • integer
  • The number of votes of answer4
  • createDate
  • string
  • The date and time when the poll was created
  • lastSentDate
  • string
  • The date and time when the poll was last sent
  • publishedDate
  • string
  • The date and time when the poll was published
  • dateDeleted
  • string
  • The date and time when the poll was deleted

cURL example

curl \ -X GET \ "https://api.rumbletalk.com/chats/123456/polls" \ -H "Authorization: Bearer <token>"

Response example

{ "status": true, "count": 18 "data": [ { "id": 49, "status": "Edit", "roomId": 424844, "userId": 2, "question": "Sample question?", "answer1": "1", "answer2": "2", "answer3": "3", "answer4": "4", "answer1count": 10, "answer2count": 20, "answer3count": 30, "answer4count": 40, "createDate": "2021-04-13 15:31:18", "lastSentDate": "2021-04-14 16:32:19", "publishedDate": "2021-04-15 17:33:20", "dateDeleted": "2021-04-16 18:34:21" }, ... ] }

Creating a poll

POST
https://api.rumbletalk.com/chats/{chatId}/polls

Request format

  • Parameter
  • Type
  • Description
  • *question
  • string
  • The poll's question
  • *answer1
  • string
  • The poll's 1st answer option
  • *answer2
  • string
  • The poll's 2nd answer option
  • answer3
  • string
  • The poll's 3rd answer option
  • answer4
  • string
  • The poll's 4th answer option
  • send
  • boolean
  • To determine whether to send the poll to all users in chat client

Response format

  • Parameter
  • Type
  • Description
  • id
  • integer
  • The newly created ID of the poll
  • createDate
  • timestamp
  • The date and time when the poll was created

cURL example

curl \ -X POST \ "https://api.rumbletalk.com/chats/12345/polls" \ -H "Authorization: Bearer <token>" \ -d "{\"question\":\"My Question?\", \"answer1\": \"sample answer 1\", \"answer2\": \"sample answer 2\"}"

Response example

{ "id": 67890, "createDate": 16184128201 }

Updating a poll

PUT
https://api.rumbletalk.com/chats/{chatId}/polls/{pollId}

Request format

  • Parameter
  • Type
  • Description
  • *question
  • string
  • The poll's question
  • *answer1
  • string
  • The poll's 1st answer option
  • *answer2
  • string
  • The poll's 2nd answer option
  • answer3
  • string
  • The poll's 3rd answer option
  • answer4
  • string
  • The poll's 4th answer option
  • send
  • boolean
  • To determine whether to send the poll to all users in chat client

Response format

  • Parameter
  • Type
  • Description
  • status
  • boolean
  • True on success, false otherwise

cURL example

curl \ -X PUT \ "https://api.rumbletalk.com/chats/12345/polls/67890" \ -H "Authorization: Bearer <token>" \ -d "{\"question\":\"My Question?\", \"answer1\": \"sample answer 1\", \"answer2\": \"sample answer 2\"}"

Response example

{ "status": true }

Deleting a poll

DELETE
https://api.rumbletalk.com/chats/{chatId}/polls/{pollId}

Response format

  • Parameter
  • Type
  • Description
  • status
  • boolean
  • True on success, false otherwise

cURL example

curl \ -X DELETE \ "https://api.rumbletalk.com/chats/12345/polls/67890" \ -H "Authorization: Bearer <token>"

Response example

{ "status": true }

Reseting a poll

POST
https://api.rumbletalk.com/chats/{chatId}/polls/{pollId}/reset

Response format

  • Parameter
  • Type
  • Description
  • status
  • boolean
  • True on success, false otherwise

cURL example

curl \ -X POST \ "https://api.rumbletalk.com/chats/12345/polls/67890/reset" \ -H "Authorization: Bearer <token>"

Response example

{ "status": true }

Resending a poll

POST
https://api.rumbletalk.com/chats/{chatId}/polls/{pollId}/resend

Response format

  • Parameter
  • Type
  • Description
  • status
  • boolean
  • True on success, false otherwise

cURL example

curl \ -X POST \ "https://api.rumbletalk.com/chats/12345/polls/67890/resend" \ -H "Authorization: Bearer <token>"

Response example

{ "status": true }

Publishing a poll

POST
https://api.rumbletalk.com/chats/{chatId}/polls/{pollId}/publish

Response format

  • Parameter
  • Type
  • Description
  • status
  • boolean
  • True on success, false otherwise

cURL example

curl \ -X POST \ "https://api.rumbletalk.com/chats/12345/polls/67890/publish" \ -H "Authorization: Bearer <token>"

Response example

{ "status": true }