HTTP Response Workflows

HTTP Response Workflows Arigato are the ability to process a reaction to an outgoing HTTP Request. These special workflows are optional add-on workflows associated with certain Actions in the app. They are not available as stand-alone workflow types.

HTTP Responses are optional configurations on HTTP Request Actions and Shopify REST API Actions.  

Creating an HTTP Response Workflow in an HTTP Request Action

  1. From an existing workflow, add or edit an HTTP Request Action.
  2. From the Action, scroll to the bottom of the configuration panel. 
  3. In the section titled What do you want to do with the response? choose Run the response through a workflow.
  4. To optionally send additional data to the Response Workflow, format the data as JSON in the Additional Data text area. Twig code with token data and JSON can be mixed to send a custom payload. See below for more information.
  5. Click Edit HTTP Response Workflow.     

Creating an HTTP Response Workflow in a Shopify REST API Action

  1. From an existing workflow, add or edit a Shopify REST API Request Action.
  2. From the Action, scroll to the bottom of the configuration panel. 
  3. In the section titled What do you want to do with the response? choose Run the response JSON through a workflow.
    1. Note, other response options are available specific to Shopify REST API Request Actions including running the response objects through a workflow or processing the Response using Custom Action Code. This article is specific to the HTTP Response Workflow method.
  4. To optionally send additional data to the Response Workflow, format the data as JSON in the Additional Data text area. Twig code with token data and JSON can be mixed to send a custom payload. See below for more information.
  5. Click Edit HTTP Response Workflow.

Sending Additional Data to an HTTP Response Workflow

In addition to the payload data that is sent back from the HTTP Request, any other useful data can also be manually sent to the HTTP Response workflow. The extra data will simply be sent along side any response data. Both are accessed the same way. For example, in the context of an order workflow, the order ID could be sent with the following Twig and JSON code in the Additional Data text area.

{
  "order_id" : "{{ order.id }}"
}

Note the mix of Twig syntax and JSON syntax. The Twig parser will render and pass the above as JSON with the order ID token rendered as the actual order number, for example:

{   
    "order_id" : "1234" 
}

Using Response Data in HTTP Response Workflow Conditions

  1. From within the HTTP Response Workflow, add a new Condition.
  2. Navigate to the HTTP Response section in the Condition picker.
  3. Select JSON and click Add Condition.
  4. Enter the Property Path. For example, order_id
  5. Choose the Field Type. For example, Integer.
  6. Set the comparison. For example, Equals.
  7. Set the value. For example, 1234

Alternatively, a Custom Condition can be used.

  1. From within the HTTP Response Workflow, add a new Condition.
  2. Navigate to the HTTP Response section in the Condition picker.
  3. Select Custom Condition and click Add Condition.
  4. Use Twig code to create a condition that prints TRUE.

Example:

{% if http_response.json.order_id == 1234 %}
TRUE
{% endif %}

Using Data in HTTP Response Workflow Tokens

  1. From within the HTTP Response Workflow, add or edit an Action.
  2. From within the Action, click on the token picker {t}.
  3. Navigate to the HTTP Response section in the token picker.
  4. Select JSON and click Insert Token.
  5. The token is inserted generically as http_response.json.prop_name. Adjust it to the needed path, for example http_response.json.order_id