Skip to Content

Create a flow

Creates a WhatsApp flow whose versions read `flows/<handle>.json` in the template project.

POST
/v1/whatsapp/flows

Creates a WhatsApp flow whose versions read flows/<handle>.json in the template project. The handle is unique in the organization; the categories are Meta's and go with every version to Meta.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
projectId*TemplateProjectId
Match^tproj_[0-9a-hjkmnp-tv-z]{16,24}$
handle*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Lengthlength <= 64
categories*array<>
Items1 <= items

Response Body

WhatsAppFlow

application/json
  1. response
id*WhatsAppFlowId
Match^waflow_[0-9a-hjkmnp-tv-z]{16,24}$
projectId*TemplateProjectId
Match^tproj_[0-9a-hjkmnp-tv-z]{16,24}$
handle*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Lengthlength <= 64
path*string
categories*array<>
endpoint*|null
currentVersion*|null
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.whatsappFlows.create({
  "projectId": "example",
  "handle": "example",
  "categories": [
    "SIGN_UP"
  ]
});
Example Response
{
  "id": "string",
  "projectId": "string",
  "handle": "string",
  "path": "string",
  "categories": [
    "SIGN_UP"
  ],
  "endpoint": {
    "url": "string",
    "updatedAt": "string"
  },
  "currentVersion": {
    "id": "string",
    "flowId": "string",
    "number": -9007199254740991,
    "commitSha": "string",
    "digest": "string",
    "jsonVersion": "string",
    "screens": [
      "string"
    ],
    "dataExchange": true,
    "createdAt": "string"
  },
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation