ThingSpeak

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

TalkBack App

TalkBack enables any device to act upon queued commands. For example, if you have a door that is outfitted with Wi-Fi and a motion sensor, you can queue up commands to open and close the door. When the door senses someone nearby, open the door. After a specified time, close the door. If there are no more commands in the TalkBack queue, the door does not open when the next person approaches.

Create and Configure a TalkBack App

  1. Sign in to ThingSpeak.

  2. Select Apps > TalkBack.

  3. Click New TalkBack.

  4. Edit your TalkBack settings:

    • Name: Enter an unique name for your TalkBack.

    • API Key: Auto-generated API key for the TalkBack.

    • Log to Channel: Select the channel where you want to log executed commands in the channel's Status field.

    • Commands: Click Add a new command to queue new commands to your TalkBack. Alternatively, you can also queue up commands using the TalkBack API.

TalkBack API

You can use the TalkBack API to add a TalkBack command, get a TalkBack command, execute a TalkBack command, get the last executed TalkBack command, delete a TalkBack command, list all TalkBack commands, and delete all TalkBack commands.

Add a TalkBack Command

To add a TalkBack command, send an HTTP POST to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands, replacing TALKBACK_ID with the ID of your TalkBack. You can view the TalkBack ID by clicking its name. You can configure TalkBack to have up to 8000 commands.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required).

  • command_string (string) - Command to be sent to your device. There is a limit of 255 characters per command_string.

  • position (integer) - The position you want this command to appear in. Any previous commands at or after this position are shifted down. If the position is left blank, the command is automatically added to the end of the queue with the highest position (optional).

Configure the POSTMAN to add a TalkBack command.

Text.  Example of a POST request to add a TalkBack command and receive the response in a text format:

POST https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands
     api_key=<YOUR_TALKBACK_API_KEY>
     command_string=OPENDOOR
     position=5
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the TalkBack command ID, for example: 2446302.

You can see the added commands in the TalkBack queue:

JSON.  Example of a POST request to add a TalkBack command and receive the response as a JSON object:

POST https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands.json
     api_key=<YOUR_TALKBACK_API_KEY>
     command_string=OPENDOOR
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is a JSON object of the new command, for example:

{
  "id": 2446302,
  "command_string": "OPENDOOR",
  "position": 4,
  "executed_at": null,
  "created_at": "2016-08-29T15:12:36Z"
}
You can see the added commands in the TalkBack queue:

XML.  Example of a POST request to add a TalkBack command and receive the response as an XML object:

POST https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands.xml
     api_key=<YOUR_TALKBACK_API_KEY>
     command_string=OPENDOOR&position=5
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the new command, for example:

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

You can see the added commands in the TalkBack queue:

Get a TalkBack Command

To show an existing TalkBack command, send an HTTP GET to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands/COMMAND_ID, replacing TALKBACK_ID with the ID of your TalkBack and COMMAND_ID with the ID of the command.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required)

Configure the POSTMAN to get a TalkBack command.

Text.  Example of a GET request to add a TalkBack command and receive the response in a text format:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/<COMMAND_ID>?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command, and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the command string, for example: OPENDOOR

JSON.  Example of a GET request to add a TalkBack command and receive the response as a JSON object:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/<COMMAND_ID>.json?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command, and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the JSON object of the command string, for example:
{
  "command_string": "OPENDOOR",
  "created_at": "2013-12-29T17:53:40-05:00",
  "executed_at": null,
  "id": 2446323,
  "position": 5
}

XML.  Example of a GET request to add a TalkBack command and receive the response as an XML object:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/<COMMAND_ID>.xml?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the command string, for example:
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2446321</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer">5</position>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime" nil="true"/>
</command>

Get All TalkBack Commands

To show all the commands in a TalkBack app, send an HTTP GET to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands, replacing TALKBACK_ID with the actual ID of your TalkBack.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required)

Configure the POSTMAN to get all TalkBack commands.

Text.  Example of a GET request to show all the commands in a TalkBack app:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the command strings in a comma-separated quoted list, for example: "OPENDOOR","CLOSEDOOR"

JSON.  Example of a GET request to show all the commands in a TalkBack app:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands.json?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is a JSON array of all the commands, for example:
[
  {
    "command_string": "OPENDOOR",
    "created_at": "2013-12-29T17:53:40-05:00",
    "executed_at": null,
    "id": 18,
    "position": 1
  },
  {
    "command_string": "CLOSEDOOR",
    "created_at": "2013-12-30T17:53:40-05:00",
    "executed_at": null,
    "id": 19,
    "position": 2
  }
]

XML.  Example of a GET request to show all the commands in a TalkBack app:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands.xml?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML list of all the commands, for example:
<?xml version="1.0" encoding="UTF-8"?>
<commands type="array">
  <command>
    <id type="integer">18</id>
    <command-string>OPENDOOR</command-string>
    <position type="integer">1</position>
    <created-at type="datetime">2013-12-29T16:51:17-05:00</created-at>
    <executed-at type="datetime" nil="true"/>
  </command>
  <command>
    <id type="integer">19</id>
    <command-string>CLOSEDOOR</command-string>
    <position type="integer">2</position>
    <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
    <executed-at type="datetime" nil="true"/>
  </command>
</commands>

Update a TalkBack Command

To update an existing TalkBack command, send an HTTP PUT to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands/COMMAND_ID, replacing TALKBACK_ID with the ID of your TalkBack and COMMAND_ID with the ID of the command that you want to update. The command in the TalkBack queue is updated.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required)

  • command_string (string) - Command to be sent to your device

  • position (integer) - The position you want this command to appear in. Any previous commands at or after this position are shifted down (optional).

Configure the POSTMAN to get update an existing TalkBack command.

Text.  Example of a PUT request to update an existing TalkBack command and receive the response in a text format:

PUT https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/<COMMAND_ID>
    api_key=<YOUR_TALKBACK_API_KEY>
    command_string=OPENDOOR
    position=5
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the command string, for example: OPENDOOR.

JSON.  Example of a PUT request to update an existing TalkBack command and receive the response as a JSON object:

PUT https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/<COMMAND_ID>.json
    api_key=<YOUR_TALKBACK_API_KEY>
    command_string=OPENDOOR
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is a JSON object of the updated command, for example:
{
  "command_string": "OPENDOOR",
  "created_at": "2013-12-29T17:53:40-05:00",
  "executed_at": null,
  "id": 2446321,
  "position": 5
}

XML.  Example of a PUT request to update an existing TalkBack command and receive the response as an XML object:

PUT https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/<COMMAND_ID>.xml
    api_key=<YOUR_TALKBACK_API_KEY>
    command_string=OPENDOOR
    position=5
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the updated command, for example:
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2446325</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer">5</position>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime" nil="true"/>
</command>

Execute the Next TalkBack Command

To execute the next TalkBack command in the queue (normally in position 1), send an HTTP GET or POST to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands/execute, replacing TALKBACK_ID with the ID of your TalkBack.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required)

Executing a command removes it from the TalkBack queue, sets executed_at to the current time, sets position to null, and reorders the remaining commands.

Configure the POSTMAN to execute the next TalkBack command.

Text.  Example of a POST request to execute the next TalkBack command in the queue and receive the response in a text format:

POST https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/execute
     api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the executed command string, for example: OPENDOOR.

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

JSON.  Example of a POST request to execute the next TalkBack command in the queue and receive the response as a JSON object:

POST https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/execute.json
     api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is a JSON object of the executed command string, for example:
{
  "command_string": "OPENDOOR",
  "created_at": "2013-12-29T17:53:40-05:00",
  "executed_at": "2013-12-30T17:53:40-05:00",
  "id": 2446323,
  "position": null
}

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

XML.  Example of a POST request to execute the next TalkBack command in the queue and receive the response as an XML object:

POST https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/execute.xml
     api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the executed command string, for example:
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2446323</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer" nil="true"/>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime">2013-12-31T16:51:17-05:00</executed-at>
</command>

    Note:   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>
    

Update a Channel, and Execute the Next TalkBack Command

Execute the next TalkBack command in the queue (normally in position 1) and update a channel at the same time by sending an HTTP GET or POST to https://api.thingspeak.com/update.

Executing a command removes it from the queue, sets executed_at to the current time, sets position to null, and reorders the remaining commands.

    Note:   The parameters for this action are different than other TalkBack commands. Since a channel is being updated, the api_key parameter refers to the Channel API write key, while the talkback_key refers to the TalkBack API key.

Valid parameters:

  • api_key (string) - API key for the channel (required).

  • talkback_key (string) - API key for this specific instance of TalkBack (required).

Additional parameters for updating a channel can be found in Update a Channel.

Configure the POSTMAN to update a channel and execute the next TalkBack command.

Text.  Example of a POST request to execute the next TalkBack command in the queue, update a channel field and receive the response in a text format:

POST https://api.thingspeak.com/update
     field1=70
     api_key=<Channel_API_KEY>
     talkback_key=<YOUR_TALKBACK_API_KEY>
Replace the <Channel_API_KEY> with your channel write API key and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the executed command string, for example: OPENDOOR.

JSON.  Example of a POST request to execute the next TalkBack command in the queue, update a channel and receive the response as a JSON object:

POST https://api.thingspeak.com/update.json
     field1=70
     api_key=<Channel_API_KEY>
     talkback_key=<YOUR_TALKBACK_API_KEY>
Replace the <Channel_API_KEY> with your channel API key and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is a JSON object of the executed command, for example:
{
  "command_string": "OPENDOOR",
  "created_at": "2013-12-29T17:53:40-05:00",
  "executed_at": "2013-12-30T17:53:40-05:00",
  "id": 2446323,
  "position": null
}

XML.  Example of a POST request to execute the next TalkBack command in the queue, update a channel and receive the response as a XML object:

POST https://api.thingspeak.com/update.xml
     field1=70
     api_key=<Channel_API_KEY>
     talkback_key=<YOUR_TALKBACK_API_KEY>
Replace the <Channel_API_KEY> with your channel API key and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the executed command, for example:
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2446323</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer" nil="true"/>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime">2013-12-31T16:51:17-05:00</executed-at>
</command>

Get the Last Executed Command

To show the most recently executed TalkBack command, send an HTTP GET to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands/last, replacing TALKBACK_ID with the actual ID of your TalkBack.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required).

Configure the POSTMAN to get the last executed TalkBack command.

Text.  Example of a GET request to get the most recently executed TalkBack command and receive the response in a text format:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/last?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the command string, for example: OPENDOOR

JSON.  Example of a GET request to get the most recently executed TalkBack command and receive the response as a JSON object:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/last.json?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the JSON object of the recently executed command, for example:
{
  "command_string": "OPENDOOR",
  "created_at": "2013-12-29T17:53:40-05:00",
  "executed_at": "2013-12-30T17:53:40-05:00",
  "id": 2446323,
  "position": null
}

XML.  Example of a GET request to get the most recently executed TalkBack command and receive the response as an XML object:

GET https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/last.xml?api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the recently executed command, for example:
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2446323</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer" nil="true"/>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime">2013-12-31T16:51:17-05:00</executed-at>
</command>

Delete a TalkBack Command

To delete an existing TalkBack command, send an HTTP DELETE to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands/COMMAND_ID, replacing TALKBACK_ID with the ID of your TalkBack and COMMAND_ID with the ID of the command that you want to delete.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required).

Configure the POSTMAN to delete a TalkBack command.

Text.  Example of a DELETE request to delete an existing TalkBack command and receive the response in a text format:

DELETE https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/COMMAND_ID
       api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response will be the deleted command string, for example: OPENDOOR

JSON.  Example of a DELETE request to delete an existing TalkBack command and receive the response as a JSON object:

DELETE https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/COMMAND_ID.json
       api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is the JSON object of the deleted command string, for example:
{
  "command_string": "OPENDOOR",
  "created_at": "2013-12-29T17:53:40-05:00",
  "executed_at": null,
  "id": 18,
  "position": 5
}

XML.  Example of a DELETE request to delete an existing TalkBack command and receive the response as an XML object:

DELETE https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands/COMMAND_ID.xml
       api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID, <COMMAND_ID> with the ID of the command and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an XML object of the deleted command string, for example:
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">18</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer">5</position>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime" nil="true"/>
</command>

Delete All TalkBack Commands

To delete all commands in a TalkBack app, send an HTTP DELETE to https://api.thingspeak.com/talkbacks/TALKBACK_ID/commands, replacing TALKBACK_ID with the ID of your TalkBack.

Valid parameters:

  • api_key (string) - API key for this specific instance of TalkBack (required).

Configure the POSTMAN to delete all commands in a TalkBack app.

Text.  Example of a DELETE request to delete all TalkBack commands and receive the response in a text format:

DELETE https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands
       api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response body is empty.

JSON.  Example of a DELETE request to delete all TalkBack commands and receive the response as a JSON object:

DELETE https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands.json
       api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an empty JSON array.

XML.  Example of a DELETE request to delete all TalkBack commands and receive the response as an XML object:

DELETE https://api.thingspeak.com/talkbacks/<TALKBACK_ID>/commands.xml
       api_key=<YOUR_TALKBACK_API_KEY>
Replace the <TALKBACK_ID> with your TalkBack ID and the <YOUR_TALKBACK_API_KEY> with your TalkBack API key. The response is an empty XML array.

Related Examples

Was this topic helpful?