Manage Flow Activations via API

Flow XO provides several HTTP API endpoints that you can use to enable and disable your flows programatically. If you want to use this API, you will need to reach out to Flow XO support for an API key.

Authorization

You must authorize all calls to the Flow XO API using an Authorization header in your HTTP request. The Flow XO API uses 'bearer token' authorization, so you will need to precede your API key with the word 'Bearer', like so:

Authorization: Bearer yOuRApIKeyGoEsHeRe

Note that if you are using Postman, and you use the Bearer Token feature, you will not need to manually add the word 'Bearer' as postman will do that for you: https://learning.postman.com/docs/sending-requests/authorization/#bearer-token

API Url

To use the Flow XO API, you will need to send HTTP requests to the following endpoint. The last part of the URL will depend on the method you are calling, but the base address is:

https://flowxo.com/api/

Workflows

Listing Workflows

Before you can use the API to enable or disable workflows, you will need to get the internal ID of the workflow you want to enable or disable. You find this, you can query the Flow XO API for a list of all your workflows by sending a GET request to the following endpoint

GET https://flowxo.com/api/workflows/simple
The result will look like this:
[
    {
        "_id": "5e9fa4e90f27ed002e143161",
        "name": "A Pause",
        "active": true
    },
    {
        "_id": "5ee10b73087005002e0aee74",
        "name": "Add Salesforce Lead",
        "active": true
    },
    {
        "_id": "6037f4971c2d4f00276cdecb",
        "name": "Basic Test",
        "active": true
    }
]
Here's what the request would be using cURL:
curl --location --request GET 'https://flowxo.com/api/workflows/simple' \
--header 'Authorization: Bearer YOURAPIKEY'

Enabling or Disabling Workflows

Once you have the ID of the workflow you want to enable or disable, you can do that by issuing a PUT request to the workflows API with the JSON body of

{ "active": true } or {"active": false }
depending if you want to enable or disable the workflow.
API Url:
PUT https://api.flowxo.com/api/workflows

Enabling a Workflow using cURL

curl --location --request PUT 'https://flowxo.com/api/workflows/5e1bc5c71dc08a478805e176' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "active":true
}'

Disabling a Workflow using cURL

curl --location --request PUT 'https://flowxo.com/api/workflows/5e1bc5c71dc08a478805e176' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "active":false
}'

Getting a snapshot of current user activity

You can observe the current volume of users and messages over the last five minutes by issuing the following GET request to

GET https://flowxo.com/api/insights/snapshot

This will return a result that looks like this, and represents activity within the last 5 minutes. To obtain rates per minute, divide these numbers by 5, or to determine rate per second, divide them by 300 (5 minutes * 60 seconds):

{
    "unique_users": "2",
    "total_messages": "12",
    "sent_messages": "5",
    "received_messages": "7"
}
The request in cURL looks like this:
curl --location --request GET 'https://flowxo.com/api/insights/snapshot' \
--header 'Authorization: Bearer YOURAPIKEY'

Still need help? Contact Us Contact Us