Skip to content

Create Chat

Creates a new conversation (or reuses an active chat) for a contact and channel.

Endpoint

http
POST /api/{organizationId}/chat/create

Base URL: https://v1.api.interflow.chat

Authentication

API Key in the header (either format):

http
x-api-key: ak_your_api_key

or

http
Authorization: Bearer ak_your_api_key

Parameters

URL

ParameterTypeRequiredDescription
organizationIdstring (UUID)YesOrganization ID

Body

FieldTypeRequiredDescription
channelIdstring (UUID)YesActive channel ID — sidebar Channels (copy from the card)
customerIdstring (UUID)NoExisting customer — Customers → actions (⋮) → Copy ID; if omitted, find/create automatically
customerobjectYes*Customer data. The chat identifier comes from here, based on the channel
teamIdstring (UUID)NoTeam for the conversation — sidebar Teams (copy from the card)
initialMessagestring | objectNoInitial message (text or media)
whatsappTemplateobjectNoMeta template (WhatsApp Official only) — Channels → Templates → Copy ID
flowIdstring (UUID)NoStarts the flow immediately — sidebar Flows (copy from the card)
flowVariablesarrayNoFlow variables: [{ "name": "...", "value": "..." }]
contextMessagestringNoContext used with flowId or responseFlowId
responseFlowIdstring (UUID)NoFlow on customer reply — same ID under Flows (copy from the card)
keepPendingbooleanNoIf true, keeps the chat pending even with initialMessage / whatsappTemplate (skips attend and auto-assign)

*Required: channelId and the customer field for the channel (whatsapp/phone, email, instagram, or facebook).

customer

FieldTypeDescription
namestringCustomer name
whatsappstringWhatsApp number. Required on WhatsApp if phone is omitted
phonestringPhone. On WhatsApp, used if whatsapp is omitted. Otherwise stored as an extra contact
emailstringEmail. Required on an email channel. Extra contact on others
instagramstringInstagram ID. Required on Instagram
facebookstringFacebook ID. Required on Facebook
documentstringTax ID (CPF/CNPJ or other). Only set if the customer has no document yet
salePrice / sale_pricenumber | stringPurchase/sale value (customers.sale_price). Only set if empty
tagsstring[] | stringTag names (existing only). Does not create a new tag
customFieldsobject | arrayCustom fields by slug: { "budget": "Up to 15k" } or [{ "slug": "budget", "value": "Up to 15k" }]
forceUpdateobjectWhich fields to overwrite even if already set. See the table below

customer.forceUpdate

Without forceUpdate, an existing customer only fills empty fields. Set true on the fields that should be overwritten:

KeyEffect
nameOverwrites the name
emailOverwrites the primary email
phoneUpdates the existing phone contact
whatsappUpdates the existing WhatsApp contact
instagramUpdates the Instagram ID
facebookUpdates the Facebook ID
documentOverwrites the document
sale_priceOverwrites the purchase value
customFieldstrue forces every sent slug; or a list (["budget"]) / slug ("budget")

Identifier from the channel

Interflow reads the recipient from customer, based on the channel type:

Channel typeField in customer
whatsapp_official, whatsapp_wapi, whatsapp_zapi, whatsapp_waha, whatsapp_evowhatsapp (else phone)
emailemail
instagraminstagram
facebookfacebook

Existing customer: name, email, document, and customer.customFields only fill empty values (already_filled), unless customer.forceUpdate marks the field. Extra contacts (phone, WhatsApp, Instagram, Facebook) are added if missing; with forceUpdate that contact type is overwritten.

initialMessage

String (text) or object:

FieldTypeDescription
typestringtext, image, video, audio, or document
contentstringText (required if type = text) or caption
urlstringHTTPS media URL (required for media types)
namestringFile name (optional)
mimetypestringMIME type (optional)
forwardobjectForward metadata (optional)

whatsappTemplate

FieldTypeDescription
id or templateIdstring (UUID)Interflow template ID — Channels → channel → WhatsApp TemplatesCopy ID
variablesobject | arrayTemplate variables (optional)

CUSTOMER STAGE

When creating a new customer, the system uses the channel default stage (settings.defaultStageId), if valid.

Behavior

  • If an active chat already exists (pending, in_progress, or await_closing) for the same contact/channel, it is reused (existing: true).
  • Without keepPending, sending initialMessage or whatsappTemplate usually attends the chat (in_progress) or adds you as collaborator.
  • With keepPending: true, the message/template is sent and the chat stays pending (also skips auto-assign on create).
  • flowId and responseFlowId are independent: the first starts immediately; the second waits for the customer reply.

Examples

Basic create

bash
curl -X POST "https://v1.api.interflow.chat/api/{organizationId}/chat/create" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_your_api_key" \
  -d '{
    "channelId": "channel-uuid",
    "customer": { "whatsapp": "5511999999999" },
    "customerName": "Customer name"
  }'

WhatsApp template + keep pending + flow on reply

bash
curl -X POST "https://v1.api.interflow.chat/api/{organizationId}/chat/create" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_your_api_key" \
  -d '{
    "channelId": "channel-uuid",
    "customer": { "whatsapp": "5511999999999" },
    "customerName": "Customer name",
    "keepPending": true,
    "responseFlowId": "flow-uuid",
    "whatsappTemplate": {
      "id": "template-uuid"
    }
  }'

Immediate flow

bash
curl -X POST "https://v1.api.interflow.chat/api/{organizationId}/chat/create" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_your_api_key" \
  -d '{
    "channelId": "channel-uuid",
    "customer": { "whatsapp": "5511999999999" },
    "flowId": "flow-uuid",
    "contextMessage": "Welcome!",
    "flowVariables": [
      { "name": "source", "value": "api" }
    ]
  }'

Response

Success (200)

json
{
  "success": true,
  "chatId": "chat-uuid",
  "formattedContact": "5511999999999",
  "existing": false,
  "flowInitiated": false,
  "keepPending": true,
  "responseFlowScheduled": true,
  "responseFlowId": "flow-uuid",
  "responseFlowName": "Flow name",
  "templateSent": true,
  "templateMessageId": "message-uuid"
}

Common errors

HTTPSituation
400Invalid parameters / template on non-official channel
404Inactive channel or unknown responseFlowId
401Invalid API Key

Next steps

Documentation constantly being updated