Connecting your helpdesk or CRM
Import inquiries into your own tools and reply to visitors from your helpdesk.
Visitors on your site leave inquiries and sometimes ask to talk to a person. You can handle both in the KIVEX Hub, or connect them to the tools your team already uses. This guide is for developers who build that connection.
Prerequisites
- An API key for your system. Create it in the Hub, in your organization's integration settings. The key acts for your organization and can access every site you allow. Keep it on your server. Never put it in a web page or a mobile app.
- The site's id (
wgt_…). You can find it in the Hub on the site's page.
Every call is a POST request to the site's invoke endpoint:
POST https://api.kivex.chat/v1/sites/wgt_0f3c9a7e2b5d4c1a8e6f9b2d7c4a1e53/invoke
Authorization: Bearer kvx_live_...
Content-Type: application/json
{ "capability": "inquiry.list", "input": { "status": "new" } }Import inquiries into your CRM
An inquiry is a request a person left for your business, with their contact details. It can come from the KIVEX chatbot on your site, from an AI agent such as ChatGPT acting for the person, or from your own system.
- Get notified: subscribe to the
inquiry.createdwebhook. - Get the details: call
inquiry.getwith theinquiryIdfrom the webhook. The webhook doesn't include personal data unless you turn it on. - Keep the status in sync: when your team follows up, update the inquiry with
inquiry.update(contacted,qualifiedorclosed). The Hub and your CRM then show the same status.
For an initial import or a nightly check, page through inquiry.list.
Reply to visitors from your helpdesk
When a visitor asks the chatbot for a person, the conversation waits until someone takes it over. Your helpdesk can take it over.
- Get notified: subscribe to
handoff.requested. - Take over the conversation: call
handoff.takeoverwith theconversationIdand the name the visitor should see, for example"Petra from support". The chatbot stops replying, and the visitor talks to you. - Read and reply: each new visitor message triggers the
handoff.messageevent. Read new messages withhandoff.get, passing the id of the last message you read asafter. Reply withhandoff.message. - End the takeover: call
handoff.releasewithreturn_to_botto hand the conversation back to the chatbot, or withresolveto close it.
Only one operator can hold a conversation at a time. If an operator in the Hub took it over first, handoff.takeover returns NOT_ALLOWED with the reason handoff_held.
Retry safely
inquiry.update and every handoff.* call that changes something accept an idempotencyKey in the request body. Use one key per change, and send the same key when you retry after a timeout. KIVEX then applies the change only once and returns the current state, so a retry never sends your reply to the visitor twice.
{ "capability": "handoff.message", "input": { "conversationId": "cnv_01J9Z5", "content": "Hello, Petra here." }, "idempotencyKey": "msg-7f3a2c" }