انتقل إلى المحتوى

الـ Endpoints

API channel (AI chat)

Run your AI agent from your own app or website. Turn the channel on under Channels → API first. These routes take an API key only.

المسارات نسبية للـ base URL. كل كارت بيوضّح الصلاحية اللي الاستدعاء محتاجها وكل parameter، مع نوعه وحدوده.

POST
/messages

Send a customer message to the AI agent. The agent replies a little later, like in a real DM: to the callback URL set under Channels → API, or poll GET /conversations/:id/messages.

مفتاح API بس
تنسيق الرد القديم

الـ body بصيغة JSON

  • messageمطلوبstring

    The customer's message.

  • conversationIdاختياريinteger

    Continue an API-channel conversation. Omit to start a new one.

  • messageIdاختياريstring

    Your ID for this message, used to ignore duplicates.

  • externalUserIdاختياريstring

    Your ID for the customer.

  • externalUsernameاختياريstring

    The customer's username in your app.

  • externalFirstNameاختياريstring

    The customer's first name.

  • externalChatIdاختياريstring

    Your chat or thread ID.

  • Answers 202 { conversationId, status: "buffering", delivery: "callback" | "polling" }.
  • 403 when the API channel is not enabled under Channels → API.
POST
/chat

Synchronous one-shot chat: send a message and wait for the AI reply. Answers { conversationId, response, messages }.

مفتاح API بس
تنسيق الرد القديم

الـ body بصيغة JSON

  • messageمطلوبstring

    The customer's message.

  • conversationIdاختياريinteger

    Continue a conversation.

  • externalUserIdاختياريstring

    Your ID for the customer.

  • externalUsernameاختياريstring

    The customer's username in your app.

  • externalFirstNameاختياريstring

    The customer's first name.

  • externalChatIdاختياريstring

    Your chat or thread ID.

GET
/agents

Returns the workspace's agent as [{ id, systemPrompt }], or [] before setup.

مفتاح API بس
تنسيق الرد القديم