Send webhooks as actions

Webhook component

Webhook component is used for interfacing with external HTTP APIs when rule is triggered. Standard HTTP features such as the request method, headers, and request body are all supported.

Check out how you can send custom text from AllThingsTalk Maker to your Twitter.

webhook

  1. Component name is shown for convenience.
  2. Shrink / Expand toggles the size of the component. Shrinking components lets you create more space on the screen and presents you the whole rule at a glance.
  3. View docs will always get you to this page.
  4. Remove component removes the device from the list of triggers.
  5. HTTP Method lets you choose between GET, POST (the default), and PUT. When POST and PUT are selected, it’s possible to provide the request body as well.
  6. URL of the remote HTTP API to which the request will be sent.
  7. HTTP Headers which will be sent with the request. You can add additional headers using + ADD HEADER. There’s no limit to how many you can have. For the exact headers needed, please consult the docs of the remote API you’re connecting to.
  8. Request body is a plain text that will be sent with the request. Keep in mind that this isn’t stopping you from sending JSON - just set the “Content-Type” header to “application/json”, and write your JSON structure.
  9. Dynamic data such as an asset’s state can be inserted into the request body after clicking the + icon.

    Screenshot from 2019-06-21 12-01-31

    A list with all devices in the ground is shown, along with all of their assets and their metadata (Device title). After selecting an item from the list, it is inserted into the message as follows.

    This makes a binding to Temperature asset’s state inside the message, so that whenever the rule is executed, Temperature is replaced with the actual current value of that asset. The final message depends on the temperature, and may look like

    Current temperature is 23°C.

    or

    Current temperature is -5.2°C.

    Because bindings are just 0, you’re free to write them manually as well.

  10. Actions area is still available for you to drag additional actions to the rule. When more than one action is included in the rule, all actions are executed when the rule is triggered.

Related articles