Reply with the AI Assistant
Hand a chat to the business's AI Assistant, and take it back.
The AI Assistant is set up by the business in Wapitick (what it may answer, its knowledge, when it hands over to a
person). From your code you decide which chats it handles: POST /v1/conversations/{id}/ai/resume hands a chat to
it, .../ai/pause takes it back, GET .../ai shows who is answering. Replies use the business's AI credits, so this
works with live keys only (a test key answers 403 test_mode_unsupported).
cURL
#!/usr/bin/env bash
# Reply with the AI Assistant (live keys only: uses AI credits): conversations_list, conversations_ai_get, conversations_ai_resume (runs in test mode)
set -euo pipefail
API="${WAPITICK_API_URL:-https://api.wapitick.com}"
AUTH="Authorization: Bearer $WAPITICK_API_KEY"
# Hand an open chat to your AI Assistant (it answers from your knowledge and hands back to a person when unsure)
CONV=$(curl -sf "$API/v1/conversations?status=open&limit=1" -H "$AUTH" | jq -r '.data[0].id')
curl -sf "$API/v1/conversations/$CONV/ai" -H "$AUTH" | jq '{handled_by, paused}'
curl -sf -X POST "$API/v1/conversations/$CONV/ai/resume" -H "$AUTH" -H "Idempotency-Key: ai-$CONV" | jq .Node
// biome-ignore-all lint/suspicious/noConsole: a docs sample prints its result
// Reply with the AI Assistant (live keys only): conversations_list, conversations_ai_resume
import { Wapitick } from "@wapitick/node";
const wapitick = new Wapitick({
apiKey: process.env.WAPITICK_API_KEY,
baseUrl: process.env.WAPITICK_API_URL,
});
const [chat] = (await wapitick.conversations.list({ status: "open", limit: 1 })).data;
const r = await wapitick.request("POST", `/v1/conversations/${chat.id}/ai/resume`);
console.log(JSON.stringify(r));Python
# Reply with the AI Assistant (live keys only): conversations_list, conversations_ai_resume
import json
import os
from wapitick import Wapitick
w = Wapitick(api_key=os.environ["WAPITICK_API_KEY"], base_url=os.environ.get("WAPITICK_API_URL", "https://api.wapitick.com"))
chat = w.call("conversations_list", query={"status": "open", "limit": 1})["data"][0]
print(json.dumps(w.call("conversations_ai_resume", {"conversation_id": chat["id"]})))PHP
<?php
// Reply with the AI Assistant (live keys only): conversations_list, conversations_ai_resume
require __DIR__ . '/vendor/autoload.php';
$w = new Wapitick\Client(getenv('WAPITICK_API_KEY'));
$chat = $w->call('conversations_list', [], ['status' => 'open', 'limit' => 1])['data'][0];
echo json_encode($w->call('conversations_ai_resume', ['conversation_id' => $chat['id']])), "\n";Operations: conversations_list, conversations_ai_get, conversations_ai_resume, conversations_ai_pause.