Create WhatsApp Flow

POST https://chatapps.8x8.com/api/v1/accounts/:accountId/channels/:channelId/flows

This endpoint is used to create a new WhatsApp Flow.

WhatsApp Flows are interactive experiences that businesses can use to collect information from customers through WhatsApp conversations. Flows provide a structured way to guide users through multi-step processes like booking appointments, collecting feedback, or processing orders.

Request

Path Parameters

    accountId stringrequired

    Possible values: >= 32 characters and <= 36 characters, Value must match regular expression ^[0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}$

    You must replace {accountId} with the accountid that you want to use.

    channelId stringrequired

    Channel identifier

Body

Request body for creating a WhatsApp Flow

    namestringrequired

    Flow name

    Example: Example Flow
    categoriesstring[]required

    Flow categories

    Possible values: [SIGN_UP, SIGN_IN, APPOINTMENT_BOOKING, LEAD_GENERATION, CONTACT_US, CUSTOMER_SUPPORT, SURVEY, OTHER]

    Example: ["OTHER"]
    publishboolean

    Whether to publish the flow immediately

    Default value: false
    Example: false
    flowJsonstring

    Flow JSON definition as a string

    Example: {"version":"5.0","screens":[{"id":"WELCOME_SCREEN","layout":{"type":"SingleColumnLayout","children":[{"type":"TextHeading","text":"Hello World"},{"type":"Footer","label":"Complete","on-click-action":{"name":"complete","payload":{}}}]},"title":"Welcome","terminal":true,"success":true,"data":{}}]}
    cloneFlowIdstring

    Optional flow ID to clone from. If provided, the new flow will be created as a copy of the specified flow.

    Example: 1145805540595505
    endPointUristring<uri>

    Optional endpoint URI for the flow. This is the URL that will receive flow completion data.

    Example: https://example.com/webhook/flow-completion

Flow created successfully

Schema

    idstring

    Created flow ID

    Example: 866937862658913
    successboolean

    Indicates if the operation was successful

    Example: true

    validationErrors object[]

    List of validation errors (only present if there are errors in the flow JSON)

  • Array [
  • errorstring

    Error code

    Example: INVALID_PROPERTY_VALUE
    errorTypestring

    Type of error

    Example: FLOW_JSON_ERROR
    messagestring

    Error message

    Example: Invalid value found for property 'type'.
    lineStartinteger

    Starting line number of the error

    Example: 1
    lineEndinteger

    Ending line number of the error

    Example: 1
    columnStartinteger

    Starting column number of the error

    Example: 84
    columnEndinteger

    Ending column number of the error

    Example: 92

    pointers object[]

    Array of error pointers

  • Array [
  • lineStartinteger
    Example: 1
    lineEndinteger
    Example: 1
    columnStartinteger
    Example: 84
    columnEndinteger
    Example: 92
    pathstring

    Path to the property with the error

    Example: screens[0].layout.children[0].children[0].type
  • ]
  • ]
{
"id":"866937862658913",
"success":true,
"validationErrors":[
{
"error":"INVALID_PROPERTY_VALUE",
"errorType":"FLOW_JSON_ERROR",
"message":"Invalid value found for property 'type'.",
"lineStart":1,
"lineEnd":1,
"columnStart":84,
"columnEnd":92,
"pointers":[
{
"lineStart":1,
"lineEnd":1,
"columnStart":84,
"columnEnd":92,
"path":"screens[0].layout.children[0].children[0].type"
}
]
}
]
}

Flow created with validation errors

{
"id":"866937862658913",
"success":true,
"validationErrors":[
{
"error":"INVALID_PROPERTY_VALUE",
"errorType":"FLOW_JSON_ERROR",
"message":"Invalid value found for property 'type'.",
"lineStart":1,
"lineEnd":1,
"columnStart":84,
"columnEnd":92,
"pointers":[
{
"lineStart":1,
"lineEnd":1,
"columnStart":84,
"columnEnd":92,
"path":"screens[0].layout.children[0].children[0].type"
}
]
}
]
}

Flow created successfully without errors

{
"id":"866937862658913",
"success":true
}

Bad request error response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1002,
"message":"Invalid MSISDN format (not E.164 international number)",
"errorId":"b4478860-b76c-e811-814e-022a35cc1c71",
"timestamp":"2018-08-04T09:25:40.9235752+00:00"
}

Request was not authenticated response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1200,
"message":"Request was not authenticated properly",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-08-02T09:42:38.8988997+00:00"
}

Internal server error

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":2000,
"message":"Internal server error",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-07-02T09:42:38.8988997+00:00"
}

Source: https://developer.8x8.com/connect/reference/create-whatsapp-flow · 8x8 CPaaS Developer Docs. Synced for support deflection.

Was this article helpful?
or
0 out of 0 found this helpful

0 Comments

Please sign in to leave a comment.

Didn't find what you were looking for?

Submit a request