HTTP Rule Action

At some point in your automation journey, you may find yourself in need of making a request to an external web service or REST API to initiate an action or query for some data. The HTTP Action in the SharpTools Rule Engine enables this functionality. 

Rule HTTP Triggers are a Premium only feature, and can be accessed during your Premium trial period. If you are using the free tier, please send an email to support@sharptools.io if you'd like us to reset your trial so you can give HTTP Triggers a try.

The HTTP Action is a popular choice for integrating with third-party applications and services like IFTTT, WebCoRE, Voice Monkey, Zapier, and more! Check out the announcement on the community for examples of using the HTTP Action with some of these services. 

Configure HTTP Action

You can find the HTTP Action in the Rule Engine by tapping the (+) icon in your Flow and selection Action → HTTP. Once you have the HTTP Action for configuration, you'll see the following options:

  • Method: GET, POST, PUT, and DELETE methods are supported. Make sure you check the target API endpoint’s method requirement and select accordingly
  • URL: the URL of your target must be internet accessible since the request is initiated from the SharpTools cloud. You may also attach Query Parameters in the URL to pass static content or Variables for dynamic content.

    If you need to send an HTTP Request to an endpoint hosted on your private network, you may need to use a 'HTTP Device' for your hub. On SmartThings, the Web Requestor Driver is popular. 
  • Headers: depending on the requirements of your API endpoint, you may need to add specific headers in the request, such as an authentication token.

    Note: When the POST or PUT method is selected, the JSON content type is selected by default. You can select the FORM content type or manually input a specific content-type by adding it as a header.
  • Payload: When using POST or PUT, you can add data to the request in the Payload field. Make sure to format the content of the payload based on the selected content type (see immediately above) and feel free to use Variables in the payload by tapping the + Variable link.

    JSON:
    Make sure to include "double quotes" for data keys and string properties. On iOS, you may need to long-press on the quote character to make sure you are using straight quotes instead of curly quotes.  FORM:
    Make sure the content is URL encoded.

HTTP Response

The response data, status code, and error message (if applicable) from the web request can be accessed using Context Variables and used in IF Conditions, device command arguments, notification content, and for setting other variables.
You can access the HTTP Response values noted above under:
   Context Variables → Response → HTTP
For response data, you can use object.property notation to access a specific property from the response that you want to use.

⬅️ Using the rule HTTP Trigger feature, you can send a web request from a third party application/service to trigger a SharpTools rule.
➡️ And now using HTTP Actions, you can send a web request from a SharpTools rule to trigger actions in a third party application/service.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.