Publish Flow

POST Method

kaleyra's Publish Flow API allows you to publish the flow using the flow ID. You can use the published flow to send the flow message through WhatsApp. The published flow helps you build structured interactions for business messaging.

📘

Notes:

  • After you publish a flow, you cannot delete the flow. You can only deprecate the flow.
  • You can either edit this flow in the future and turn it back to the DRAFT state, or create a new flow by specifying the existing Flow ID as the clone_flow_id parameter

Prerequisites

  1. Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
    A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on kaleyra platform.
  2. To set up a WhatsApp account on kaleyra platform, see Manual Signup
    and Embedded Signup.
  3. An active WhatsApp for Business API plan that includes:
    • A WhatsApp business number.
    • An associated profile with the business number.
    • A WhatsApp verified and approved profile.
    • WABA ID must be onboarded on Kaleyra WhatsApp API V2 compatible.

Base URL

https://<api_domain>/v2/<SID>

API Domain and Value

api_domainValue
IN podapi.in.kaleyra.io
SG Podapi.ap.kaleyra.io
EU Podapi.eu.kaleyra.io

API request to publish WhatsApp Flow

To publish WhatsApp Flow, use the https://<api_domain>/v2/<sid>/whatsapp/<flow_id>/publish endpoint with the following request method.

Request Format

The following is the request format to publish WhatsApp Flow:

curl --location --request POST 'https://<api_domain>/v2/<sid>/whatsapp/<flow_id>/publish' \
--header 'api-key: <api-key>' \
--header 'Content-Type: application/json'

Sample Request Format

The following is the sample request format to publish a WhatsApp Flow:

curl --location --request POST 'https://api.in.kaleyra.io/v2/HXAP16XXXXXX97IN/whatsapp/112xxxxxxxxxx207/publish' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--header 'Content-Type: application/json'

URL Parameters and Headers

Following is the list of parameters and headers to send the outgoing message request:

Parameter / HeadersData TypeDescriptionExampleMandatory?
sidStringAccount SID (Security Identifier).HXAP16XXXXXX97INYes
flow_idStringWhatsApp flow ID generated while creating the flow. For more information on how to create a WhatsApp Flow ID, see Create Flow.112xxxxxxxxxx207Yes
api-keyStringAPI key generated from kaleyra.io account.Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3Yes
Content-TypeStringIndicates the format of the content the API will be processing.The only allowed value is application/json.Yes

Sample Success Response

The following success message appears with the status 200 Accepted:

{
  "success": true
}

Sample Failure Response

The following are the failure responses:

401 Unauthorized
{
    "code": "RBC001",
    "message": "Incorrect SID or API key.",
    "data": [],
    "error": {
        "error": "Incorrect SID or API key."
    }
}
401 Wrong account
{
    "code": "WA-401",
    "message": "API is not available for given customer.Please contact support for more info",
    "data": {},
    "error": "API is not available for given customer.Please contact support for more info"
}
400 Incorrect payload
{
    "code": "WA-400",
    "message": "Refer to correct payload format",
    "data": {},
    "error": {
        "payload": "Incorrect payload format"
    }
}
500 Internal Server Error
{
    "code": "WA-500",
    "message": "Please try again later",
    "data": {},
    "error": {
        "error": "Internal server error"
    }
}
{
    "code": "WA-401",
    "message": "The flow_id either does not exist or does not belong to the account.",
    "data": {},
    "error": {
        "flow_id": "The flow_id either does not exist or does not belong to the account."
    }
}