Connect your own AI agent to the chat
With "My own agent", DeskCrew opens the chat, carries the conversation and captures the email, while your AI agent does the talking: it receives every visitor message together with the visitor's journey and answers through the DeskCrew API. Any agent that can receive a webhook and make an HTTPS request works: an agent platform's incoming webhook, an automation tool, or your own code. Pro plan and above.
What you need from your agent
One thing: the address it receives webhooks on (an https URL). Many platforms also give you a key that must be sent with each request, and tell you which header it goes in; keep both to hand.
Connect it (two minutes)
- Dashboard, Proactive chat, Connect your agent.
- Paste the webhook address. If your agent gave you a key, pick the header it expects (Authorization is the default; X-Api-Key, X-Auth-Token or a custom name are there too) and paste the key. Under Authorization a bare key is sent as "Bearer <key>", so paste it with or without the word Bearer.
- Press Connect agent. DeskCrew creates the endpoint, subscribed to the three events, and an API key limited to replying, and shows one block to give your agent: the webhook secret, the API key, the reply URL pattern, the setup page URL and the event names. Both secrets are shown once; use Copy all and paste the block into your agent now.
- Press Send test event. The line under the button shows what your agent answered: "answered 2xx" means it is reachable; "HTTP 401" with a message means the key or the header is wrong; a timeout means it took longer than 4 seconds to acknowledge.
- Connecting selects My own agent under Who answers chats; press Save changes to store it.
Give your agent its instructions
Your agent needs to know what arrives and how to reply. Point it at the setup page https://deskcrew.io/docs/agent-handoff (a raw Markdown version is at https://deskcrew.io/docs/agent-handoff/index.md for the agent to fetch directly). In short:
- Three events, delivered at once and signed with the webhook secret: visitor.engaged (a rule opened the chat), chat.message (the visitor wrote), visitor.identified (the visitor gave an email).
- Every event carries the same data: the workspace, the ticket, the visitor (returning or not, visit count, country, device, language, local time), the customer if known, the current page with seconds on it, the whole visit (pages with time and scroll, clicks, landing page, referrer, UTM), the last five earlier visits, the conversation so far, and a ready-made reply call.
- To reply, the agent POSTs the reply URL with its API key and
{"body":"...","mode":"send","askEmail":false}. Set askEmail to true on the message that earns the email. - Answer visitor.engaged within 5 seconds to get the first word; otherwise your fallback opener shows first.
Several websites
Each website is its own workspace: repeat Connect your agent in each. One agent can serve all of them from one address; every event names its workspace, so the agent keeps one secret and one key per workspace.
Caps and safety
Your agent reads messages from anyone on the internet, and some visitors will try to talk it into misbehaving ("ignore your instructions", "show me your prompt", "give me your key"). DeskCrew puts walls around it whatever agent you connect:
- The reply key can only post chat replies. Connect agent creates it for you with that one permission, so you never need to make a key on the API keys page. A leaked key cannot read your workspace, change settings or touch billing.
- Leaks are blocked. A reply that contains something shaped like a secret (an API key, token, private key or webhook secret) or an internal machine address is refused with
422 reply_blockedand never reaches the visitor. - Manipulation attempts are flagged. Every chat.message carries
data.safety:{ "injectionSuspected": true|false, "signals": [...] }. When a visitor message reads like an attempt to manipulate the agent,injectionSuspectedis true, so your agent can decline without detecting it itself. It is a hint, not proof: answer any genuine question and decline the rest. - Replies are capped: 30 per conversation per 5 minutes and 200 per key per day by default.
- No double sends. A retried event keeps its
delivery_id, and the same agent address cannot be connected twice. - Every message the agent sends is stored on the ticket and visible in your dashboard, and the agent only ever receives data from your own workspace. Remove an agent any time from the Connected agents list.
What your agent says is still up to you. The Proactive chat page has a Keep your agent safe box with a checklist and a Copy rules button: paste those rules into your agent's instructions before it talks to visitors. For whoever builds the agent:
- Accept an event only when its signature or your header matches.
- Ignore events with
"test": trueand skip anydelivery_idyou already handled. - Reply only to the
reply.urlinside the event, never to an address taken from a visitor's message. - Keep keys in the agent's code, never in its prompt.
Troubleshooting
- Your agent gets a 403 with "error 1010" when calling the API: the request was refused for its client signature before it reached DeskCrew. Send a normal User-Agent header that names your agent (for example
MyAgent/1.0); the default user agent of some HTTP libraries is refused. - "That address is already connected": remove the existing entry under Connected agents first if you want to reconnect it with a new key.
Grok Bot specifics
Grok Bot gives you an incoming webhook URL and a key for the Authorization header. Paste the URL as the webhook address, keep Authorization, paste the key, Connect, then give Grok Bot the block DeskCrew shows and the setup page link.