Using the Call API Interaction Response

In this article:

As discussed in Working with Interactions, attaching interactions to objects in a scene enables you to create dynamic responses during Play Mode. An interaction consists of a trigger (cause) and one or more responses (effects)--either Action or Trigger Receiver responses. Call API is an action response that enables you to reference an internet or intranet HTTP(S) endpoint as part of an interaction response without leaving the Torch app. This response contrasts with the Open Link action response, which opens a URL in a web browser or other application, leaving the Torch app in the process.

A few situations in which you might use the Call API response include:

  • IoT device integrations
  • Analytics/Surveys
  • Integrations with services like IFTTT or Slack through Webhooks

Tip: For a complete discussion on working with interactions, triggers and responses, read Working with Interactions.

Creating a Call API Response

To set a Call API action response to a trigger:

  1. If needed, tap an object in your scene to select it. The object appears highlighted in blue. 
  2. Tap the Interactions icon (the lightning bolt) in the context menu on the right side of the screen. The Object Interactions drawer opens and a list of all previously created interactions on the selected object appear.
  3. Tap the interaction you want to work on. The Trigger & Responses view opens. Under the Interaction Responses section, locate the Action Response button.
  4. Tap Action Response. The Action Response view opens.
  5. Tap API Call (connector plug icon). The API Call view opens.
  6. In the API Endpoint pill, enter the URL you want the trigger to open, and then tap the Back arrow in the lower left corner to return to the Action Response view, or tap the X to close the drawer and return to the scene.
  7. Enter the URL you want to reference in the API Endpoint pill. This URL can be a web API you control, and IFTTT or other webhook, etc. This can be any valid URL, including query parameters, such as
  8. Note: HTTP is only allowed for local network requests. HTTPS must be used for internet requests.

  9. Tap the Back arrow in the lower left corner to return to the Action Response view or just tap the X to close the drawer and return to the scene.
  10. To test the response, tap Play and tap the object to which you attached the interaction. Torch will request this URL after all other responses have occurred.

Note: Call API uses the GET request method. We plan to provide an option for POST in the future.

Removing a Call API Response

To cancel a Call API response and remove it from the interaction:

  1. Follow steps 1-5 in the previous section to navigate to the API Endpoint view of the Object Interactions drawer.
  2. Delete the URL in the API Endpoint so that the field is blank, then tap the X to close the drawer. All other triggers and interactions remain in place, but Torch will not call any links afterward.

Still need help? Contact Us Contact Us