Update Flow JSON

POST Method

The Update Flow JSON API allows you to update Flow JSON for a specified Flow.

📘

Note:

The file must be attached as form-data.

The JSON file contains the design part of a Flow.

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.
    • A WABA ID onboarded on Kaleyra WhatsApp API V2.

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 update Flow JSON

To update Flow JSON, use the https://<api_domain>/v2/<sid>/whatsapp/<flow_id>/assets endpoint with the following request method:

Request Format

The following is the request format to update Flow JSON:

curl --location --request POST \ 'https://<api_domain>/v2/<sid>/whatsapp/<flow_id>/assets' \
--header 'api-key: <api-key>' \
--form 'file="<file path>"' \
--form 'name="<name>"' \
--form 'asset_type="<asset_type>"'

Sample Request Format

The following is the sample request format to update Flow JSON:

curl --location --request POST \ 'https://<api_domain>/v2/HXAP16XXXXXX97IN/whatsapp/12XXXXXXXXXXXXX/assets' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--form 'file=@"postman-cloud:///1efXXX40-528e-4c70-aa93-712XXXXXXXXX"' \
--form 'name="flow.json"' \
--form 'asset_type="FLOW_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_idIntegerFlow ID is the ID received in the response of the create flow API.12XXXXXXXXXXXXXYes
api-keyStringAPI key generated from Kaleyra platform account.Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3Yes
fileJSONFile in JSON format that defines the flow.

Note: JSON data for the flow must be less than 10 MB.
@"postman-cloud:///1efXXX40-528e-4c70-aa93-712XXXXXXXXXYes
nameStringFlow asset name.flow.jsonYes
asset_typeStringFlow asset type.The only allowed type is FLOW_JSONYes

Sample Success Response

The following success message appears with the status 200 Accepted:

{
    "code": "WA200",
    "message": "Request Processed Successfully",
    "data": {
        "success": true,
        "validation_errors": []
    },
    "error": {}
}

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."
    }
}