Skip to main content

Introduction

The API Step in Hilos flows is a powerful tool that allows you to connect to any application that supports API requests. This functionality enables you to extend the capabilities of your flows by integrating with various external systems, automating processes, and retrieving or sending data. In this article, we will explore the basics of the API Step and provide a few examples to illustrate its potential.

What is an API Step?

An API Step is a type of step in Hilos flows that allows you to make HTTP requests to external APIs. You can configure the API Step to send data to or retrieve data from other systems, enabling seamless integration between Hilos and your existing tools. The API Step supports various HTTP methods, including GET, POST, PATCH, and DELETE, and allows you to customize headers, query parameters, and request bodies.

How to Configure an API Step

To configure an API Step, follow these steps:
1

Add an API Step

In the flow editor, click on the + button to add a new step and select “Connect API” from the list of step types.
2

Set the URL

Enter the URL of the external API endpoint you want to connect to.
3

Choose the HTTP Method

Select the appropriate HTTP method (GET, POST, PATCH, DELETE) based on your use case.
4

Configure Headers

Add any necessary headers required by the API, such as Authorization or Content-Type.
5

Set Query Parameters

If the API endpoint requires query parameters, you can add them here.
6

Define the Request Body

For POST or PATCH requests, define the JSON object, Form or string that will be sent as the request body.

Examples

Example 1: Sending Data to a CRM

Suppose you want to update a contact’s information in your CRM whenever they complete a flow in Hilos. You can use the API Step to send a POST request to the CRM’s API with the contact’s updated details.
1

Set the URL

https://api.yourcrm.com/v1/contacts
2

Choose the HTTP Method

POST
3

Configure Headers

{
  "Authorization": "Bearer YOUR_API_KEY",
  "Content-Type": "application/json"
}
4

Define the Request Body

{
  "first_name": "{{contact.first_name}}",
  "last_name": "{{contact.last_name}}",
  "email": "{{contact.email}}",
  "phone": "{{contact.phone}}"
}

Example 2: Retrieving Data from an External System

Imagine you need to retrieve a user’s order history from an external system and present it to them in a flow. You can use the API Step to make a GET request to the external system’s API and then use the retrieved data in subsequent steps.
1

Set the URL

https://api.yourordersystem.com/v1/orders?user_id={{contact.id}}
2

Choose the HTTP Method

GET
3

Configure Headers

{
  "Authorization": "Bearer YOUR_API_KEY"
}
The response from the API can then be used in the flow to display the order history to the user.

Example 3: Triggering an External Workflow

Suppose you want to trigger an external workflow or automation whenever a user completes a specific step in a flow. You can use the API Step to send a POST request to the external system’s API, passing any necessary data.
  1. Set the URL: https://api.yourworkflowtool.com/v1/trigger
  2. Choose the HTTP Method: POST
  3. Configure Headers:
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    
  4. Define the Request Body:
    {
      "user_id": "{{contact.phone}}",
      "event": "flow_completed",
    }
    

Conclusion

The API Step in Hilos flows opens up a world of possibilities for integrating with external systems and automating processes. By leveraging API requests, you can enhance the functionality of your flows and create seamless experiences for your users. Whether you’re updating a CRM, retrieving data from an external system, or triggering workflows, the API Step provides the flexibility and power you need to connect Hilos with the tools you use every day. Start exploring the capabilities of the API Step today and unlock new potential for your Hilos flows!