With ActiveCampaign, you can use the “Connect APIs” step in WhatsApp Messaging flows to connect any application that supports API requests. This functionality lets you extend your flows by integrating with external systems, automating processes, and retrieving or sending data.
This article explains the “API’ step and provides a few examples to illustrate its potential.
Take note
This option is for advanced users. You need to be comfortable with code. Our Customer Experience team cannot help you implement or troubleshoot code.
About the “Connect APIs” step
The “Connect APIs” step lets you make HTTP requests to external APIs. You can configure this step to send or retrieve data from other systems, enabling seamless integration between ActiveCampaign and your existing tools.
The API step supports various HTTP methods, including GET, POST, PATCH, PUT, and DELETE, and lets you customize headers, query parameters, and request bodies.
Configure the “Connect APIs” step
- Click WhatsApp > Messaging Flows on the left menu.
- Edit or create a new Messaging Flow.
- If editing a flow, click a flow > Update > Steps. Click a node (+) in the builder where you want to place the action. A modal window will appear. Click the "Connect APIs" option, then click the “Add” button
- If creating a new flow, a modal window will appear in the Flow builder. Click the "Connect APIs" option, then click the “Add” button
- In the “Add step” modal that appears:
- Click the pencil icon and give your step a name. We recommend using unique names that are short and descriptive
- Method type - Select the appropriate HTTP method based on your use case
- URL - Enter the URL of the external API endpoint you want to connect to
- Add any necessary API headers, such as Body, Headers, and Query. If the API endpoint requires query parameters, you can add them here. For POST or PATCH requests, define the JSON object, Form, or string that will be sent as the request body
- Test Request - Click this button to test the API connection
- Format escape characters in variables toggle - If enabled, the special characters in the variable text will be formatted
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 ActiveCampaign. You can use the “Connect APIs” step to send a POST request to the CRM’s API with the contact’s updated details. To do so:
- Set the URL to your CRM. For example, https://api.yourcrm.com/v1/contacts
- Choose POST for the HTTP Method - POST
- Configure Headers:
{
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}- Define 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 customer’s order history from an external system and present it to them in a WhatsApp Messaging flow. You can use the “Connect APIs” step to make a GET request to the external system’s API, then use the retrieved data in subsequent flow steps.
- Set the URL to: https://api.yourordersystem.com/v1/orders?user_id={{contact.id}}
- Choose GET as the HTTP method
- Configure Headers:
{
"Authorization": "Bearer YOUR_API_KEY"
}The API response can then be used in the flow to display the customer's order history.
Example 3: Triggering an external workflow
Suppose you want to trigger an external workflow whenever a customer completes a specific step in a WhatsApp flow. You can use the “Connect APIs” step to send a POST request to the external system’s API, passing any necessary data.
- Set the URL to: https://api.yourworkflowtool.com/v1/trigger
- Choose POST as the HTTP Method
- Configure Headers:
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"- Define the Request Body:
{
"user_id": "{{contact.phone}}",
"event": "flow_completed",
}