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/v1/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/v1/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/v1/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://omni.futwork.com/api/v1/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

After the call finishes, the Futwork platform 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
callSid string Unique call identifier
leadId string Lead identifier
workflowId string Workflow identifier
agentId string Agent identifier
status string Call status (e.g., "call-disconnected")
telephonyData object Telephony information (direction, duration, numbers, etc.)
contextDetails object Context information including recipient data
transcript string Full call transcript
disposition string Call disposition
extractedData object Extracted data from the call (can be null)

Sample Webhook Payload

{
  "callSid": "3f19eab8-c425-495f-a343-268c44d5631a",
  "leadId": "68ecc93cd9fbecbe9431a2a1",
  "workflowId": "68ecc86fd9fbecbe9431a18e",
  "agentId": "68ecc7a3d9fbecbe9431a0a7",
  "status": "call-disconnected",
  "telephonyData": {
    "direction": "outbound",
    "duration": "0.0",
    "toNumber": "+918076405599",
    "fromNumber": "+918035735856",
    "recordingUrl": "",
    "hostedTelephony": true,
    "providerCallId": "7f209cdb-be57-4314-b6ba-3c00eb4bb650",
    "provider": "exotel",
    "hangupBy": null,
    "hangupReason": null,
    "hangupProviderCode": null
  },
  "contextDetails": {
    "recipientPhoneNumber": "+918076405599",
    "recipientData": {
      "customer_name": "abcd xyz",
      "place": "ABC"
    },
    "leadId": "68ecc93cd9fbecbe9431a2a1",
    "agentId": "68ecc7a3d9fbecbe9431a0a7",
    "workflowId": "68ecc86fd9fbecbe9431a18e"
  },
  "transcript": "assistant: Hello bani bani is testing the call \nThank you very much\nuser: hello\nassistant: Hello! How can I assist you today?\nuser: thank you thank you\nassistant: You're very welcome! If you need any further assistance, feel free to ask. Have a great day!\n",
  "disposition": "",
  "extractedData": null
}

Telephony Data Fields

Field Type Description
direction string Call direction (e.g., "outbound")
duration string Call duration in seconds
toNumber string Recipient phone number
fromNumber string Caller phone number
recordingUrl string URL to call recording (if available)
hostedTelephony boolean Whether telephony is hosted
providerCallId string Provider-specific call identifier
provider string Telephony provider (e.g., "exotel")