Docs menuApp Channel
API documentationBahasa Indonesia

App Channel: your app users' chats in the Klik Flow Inbox.

An App Channel makes the chat in your own app work like a website live chat. Your app's server sends user messages through API v2, the chat enters the Inbox labelled App (Aplikasi), the AI Agent and incoming message automations (Pesan masuk) answer right in the response, and your team's replies are sent to your app through Webhook v2.

How is an App Channel different from Ask an AI Agent?

Ask an AI Agent only asks the AI for an answer: there is no chat in the Inbox and your team does not reply. An App Channel puts every message into the Inbox as a chat, so the AI Agent, automations, and your team can reply, and the chat can be handed over to your team.

Set up the channel

  • Open Live Chat › New widget (Live Chat › Widget baru), choose the type "App Channel (API)" (Kanal Aplikasi (API)), give it a name, then create it. Its connection steps show the channel ID. An App Channel counts as one widget of the plan.
  • Choose an AI Agent on the channel's card and turn the AI on if messages should be answered automatically.
  • Create a key in Settings › API & Webhook (Pengaturan › API & Webhook) with the app_channels:write scope (Kanal Aplikasi: kirim pesan pengguna).
  • Add a webhook with the message.sent event, and if needed conversation.handoff and conversation.resolved, in Settings › API & Webhook › Webhook.

Keep the key on your server

The API key is a secret. Your mobile app or web page sends the user's message to your server, then your server calls Klik Flow. Your server also receives the webhook and passes the replies on to the app. Never put the key in a mobile app or web page code.

Send a user's message

curl -X POST "https://klikflow.id/api/v2/app-channels/7/messages" \
  -H "Authorization: Bearer KUNCI_API" \
  -H "Idempotency-Key: app-8812-msg-31" \
  -H "Content-Type: application/json" \
  -d '{"external_user_id":"8812","name":"Rina","text":"Saya mau komplain, batik yang datang sobek."}'

Response (201):

{
  "data": {
    "object": "app_message",
    "app_channel_id": 7,
    "external_user_id": "8812",
    "conversation_id": 48213,
    "message_id": 99150,
    "contact_id": 301,
    "conversation_status": "open",
    "ai_active": false,
    "handoff": true,
    "replies": [
      {
        "message_id": 99151,
        "sender": "ai",
        "type": "text",
        "text": "Mohon maaf kainnya sobek, Kak Rina. Chat ini saya teruskan ke tim kami, sebentar lagi dibalas ya.",
        "media": []
      }
    ]
  }
}

external_user_id is the user's id in your app: one user = one chat in the Inbox, with the app user ID on that chat. name, phone, and email are optional; when filled in, the chat is linked to the contact with the same number or email, or a new contact is created. When the AI answers, the request takes a few seconds, so give it a 60-second timeout.

  • replies: the AI Agent's (sender: ai) or automations' (sender: automation) replies already sent, in order, with files as temporary 24-hour links.
  • ai_active: false means the AI no longer answers this chat; handoff: true means the chat was handed over to your team.
  • Send an Idempotency-Key with every message: a repeat with the same key does not store the message twice.

Replies through the webhook

Everything sent in that chat later, meaning team replies from the Inbox, files, and the reply when the chat is handed over, is sent to your app with the message.sent event:

{
  "id": "evt_4Rt7Lm2Qx9Kp1Zs3",
  "type": "message.sent",
  "created": "2026-11-09T10:34:01+07:00",
  "business_id": 7,
  "data": {
    "message_id": 99152,
    "conversation_id": 48213,
    "contact_id": 301,
    "channel": "app",
    "app_channel_id": 7,
    "external_user_id": "8812",
    "sender": "team",
    "sender_name": "Dewi",
    "type": "text",
    "text": "Halo Kak Rina, saya Dewi dari Batik Sekar. Boleh kirim foto jahitannya?",
    "media": [],
    "sent_at": "2026-11-09T10:34:00+07:00"
  }
}
  • sender: ai, automation, or team; sender_name holds the team member's name.
  • media: files as temporary links valid for 24 hours (expires_at). Download or show them before they expire.
  • message.sent is sent only for App Channel chats. Check its signature like any other event (see the Webhooks guide).
  • In the Inbox, a message is marked "received by the app" (diterima aplikasi) once your webhook answers 2xx. When delivery still fails after the last attempt, the message is marked failed with the reason.

Avoid duplicate replies

AI and automation replies are in replies and are also sent through message.sent. Store the message_id of every message your app has shown, then ignore events with the same message_id. Events can arrive twice or out of order; sort them by sent_at.

Handed over and resolved

  • When the AI Agent hands a chat over to your team (the customer asked for a person, a complaint, or another reason set in Behaviour), the response holds handoff: true and ai_active: false, and the conversation.handoff event is sent with reason. Show that the team will reply; team replies arrive through message.sent.
  • After a handoff, user messages still enter the Inbox, but the AI does not answer them until the team turns the AI back on in that chat.
  • conversation.resolved is sent when the team marks the chat as done.
  • conversation.handoff and conversation.resolved are sent for every channel. App Channel chats carry channel: "app", app_channel_id, and external_user_id, and so do message.received and message.status (in message.status, to holds the external_user_id). GET /api/v2/conversations and the conversation details use the same names; filter with channel=app.

Plan and limits

  • Needs the Website live chat feature in the plan; every App Channel counts as one widget. A paused channel, a plan without Live Chat, or widgets over the plan are refused with app_channel_paused (403).
  • AI answers in an App Channel use AI credits like AI replies in other chats.
  • Live keys only: App Channel messages are real chats, so test keys are refused with live_key_required (403). To try it, create an App Channel just for testing, then pause or delete it when done.
  • The key's per-minute request limit still applies (see the Limits & plans guide).

Send WhatsApp from your system with the Klik Flow API.

Mulai dengan paket Free. Ajak tim setelah ruang kerja siap.