Futwork Workflows

Manage complex workflows involving multiple communciation channels like Whatsapp, AI calls, Manual calls, IVR, and more.

Introduction

This document explains how clients can push leads to the Futwork Workflows and how post-call data will be sent back to their system through a webhook.

Integration Flow

The integration consists of two main parts:

  1. Lead Submission (Client → Futwork): Clients push leads to the Futwork Workflows
  2. Post-Call Response (Futwork → Client Webhook): After the call finishes, the platform sends post-call data to the client's webhook URL
Flow Diagram: Client System → Futwork Workflows → Client Webhook

Base URL

All API requests should be made to the following base URL:

https://omni.futwork.com/api/v1

Data Format

All requests and responses use JSON format. Content-Type headers should be set to application/json.

Authentication

Futwork will provide you with an API key that must be included in the x-api-key header for all protected API requests.

curl --location 'https://omni.futwork.com/api/v1/:protected-route' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json'
const fetch = require('node-fetch');

const response = await fetch(
  'https://omni.futwork.com/api/v1/:protected-route',
  {
    method: 'POST',
    headers: {
      'x-api-key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);
import requests

headers = {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

response = requests.post(
    'https://omni.futwork.com/api/v1/:protected-route',
    headers=headers
)
Security: Never commit API keys to version control. Use environment variables or secure secret management tools. Keep your keys secure and never expose them in client-side code or public repositories.

Lead Submission

Submit leads to the Futwork Workflows using the lead submission endpoint.

Endpoint

POST
/api/workflows/{workflowId}/leads
Note: Replace {workflowId} in the URL with the actual workflow ID from the Workflows you have created.

Headers

Header Value Required
Content-Type application/json Yes
x-api-key Your API key (provided by Futwork) Yes

Request Body

Field Type Required Description
recipientPhoneNumber string Yes 10-digit phone number (e.g., "9999789877")
recipientData object Yes Additional lead data (custom fields based on Lead schema)
referenceId string Yes Reference ID to identify the lead

Request Example

curl --location 'https://omni.futwork.com/api/workflows/{workflowId}/leads' \
--header 'x-api-key: 123jkkn43oo42551345gfqrg' \
--header 'Content-Type: application/json' \
--data '{
  "recipientPhoneNumber": "9999789877",
  "recipientData": {
    "customer_name": "abcd xyz",
    "place": "ABC"
  },
  "referenceId": "AWB123456789"
}'
const fetch = require('node-fetch');

const response = await fetch(
  'https://omni.futwork.com/api/workflows/{workflowId}/leads',
  {
    method: 'POST',
    headers: {
      'x-api-key': '123jkkn43oo42551345gfqrg',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      recipientPhoneNumber: '9999789877',
      recipientData: {
        customer_name: 'abcd xyz',
        place: 'ABC'
      },
      referenceId: 'AWB123456789'
    })
  }
);

const data = await response.json();
import requests

headers = {
    'x-api-key': '123jkkn43oo42551345gfqrg',
    'Content-Type': 'application/json'
}

payload = {
    'recipientPhoneNumber': '9999789877',
    'recipientData': {
        'customer_name': 'abcd xyz',
        'place': 'ABC'
    },
    referenceId': 'AWB123456789'
}

response = requests.post(
    'https://platform.futwork.ai/api/workflows/{workflowId}/leads',
    headers=headers,
    json=payload
)

data = response.json()
Important: The phone number must be a 10-digit number without country code prefix.

Post Call Events Beta

After the call finishes, the Futwork system will push the post-call updates to the client's webhook URL.

Webhook Requirements

Your webhook endpoint must:

  • Accept POST requests
  • Process the JSON format provided below
  • Respond with HTTP 200 OK

Webhook Payload Structure

The webhook payload contains the following fields:

Field Type Description
recipientPhone string Recipient phone number
recipientData object Data that was sent during lead submission
referenceId string Reference identifier for the lead
workflowId string Workflow identifier
disposition string Call disposition
recordingUrl string URL to call recording
conversationMinutes string Call duration in minutes
collectedData object Data that was collected from the customer
isTerminal boolean Whether the workflow stage is terminal
stage string The last workflow stage

Sample Webhook Payload

{
  recipientPhone : "",
  recipientData : {
    // the data that was sent during lead submission
    key: value,
    key: value
  },
  referenceId : "",
  workflowId : "",
  disposition : "",
  recordingUrl : "",
  conversationMinutes : "",
  collectedData : {
    // the data that was collected from the customer
    key: value,
    key: value
  },
  isTerminal : true,
  stage: "postback_core"
}