Main Content

Execute TalkBack Command

Execute next TalkBack command in TalkBack queue

Request

HTTP Method

GET or POST

URL

https://api.thingspeak.com/talkbacks/<talkback_id>/commands/execute.<format>

Input Arguments

NameDescription

<talkback_id>

(Required) TalkBack ID, specified as a positive integer.

<format>

Format for the HTTP response, specified as json or xml.

Example: https://api.thingspeak.com/talkbacks/12345/commands/execute

Body Parameters

NameDescriptionValue Type
api_key

(Required) API key for this specific instance of TalkBack. The TalkBack key is different from the channel and user API keys.

string

Content-Type

application/x-www-form-urlencoded

Response

Success

HTTP Status Code

200 OK

Body

The example responses are based on this sample TalkBack queue.

Leave <format> blank to receive the response in text format.

POST https://api.thingspeak.com/talkbacks/12345/commands/execute
     api_key=XXXXXXXXXXXXXXXX

Response

OPENDOOR

If there are no commands left to execute, the response body is empty.

POST https://api.thingspeak.com/talkbacks/12345/commands/execute.json
     api_key=XXXXXXXXXXXXXXXX

Response

{
  "command_string": "OPENDOOR",
  "created_at": "2018-12-29T17:53:40-05:00",
  "executed_at": "2018-12-30T17:53:40-05:00",
  "id": 2448500,
  "position": null
}

If there are no commands left to execute, the response is an empty JSON object.

POST https://api.thingspeak.com/talkbacks/12345/commands/execute.xml
     api_key=XXXXXXXXXXXXXXXX

Response

<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2448500</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer" nil="true"/>
  <created-at type="datetime">2018-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime">2018-12-31T16:51:17-05:00</executed-at>
</command>

If there are no commands left to execute, the response is an empty XML hash, for example:

<?xml version="1.0" encoding="UTF-8"?>
<hash></hash>

Error

For the full list, see Error Codes.

Examples

expand all

You can use POSTMAN to try out your HTTP requests using the RESTful API for ThingSpeak. This example shows how to execute the next TalkBack command in an existing queue using POSTMAN.

Execute the TalkBack command in an existing queue with the TalkBack ID 24507.

POST https://api.thingspeak.com/talkbacks/24507/commands
     api_key=YOUR_TALKBACK_API_KEY

  1. In POSTMAN, select POST from the drop-down list of HTTP verbs, and enter https://api.thingspeak.com/talkbacks/24507/commands/execute in the address bar. Change 24507 to your TalkBack ID.

  2. Enter the parameter api_key and your TalkBack API key, which is found in Apps > TalkBack> <Your TalkBack Name>.

The response is in JSON format. Note the server response value of 200 OK, which indicates successful execution of the TalkBack command.

The last command is shown in the response and is removed from your TalkBack queue.