Quickstart
- Open Deplao → Tools → Apps, API & Webhook → API (Công cụ → Ứng dụng, API & Webhook → API) → turn on API server (default port 9900).
- Click Create API key (Tạo API key), give it a name, pick a scope preset (e.g. "Chat bot") and the accounts it may use. Copy the
dpk_...key: it is shown only once. - Try the key:
bash
curl -H "Authorization: Bearer dpk_xxx" http://127.0.0.1:9900/api/v1/me- List accounts and conversations:
bash
curl -H "Authorization: Bearer dpk_xxx" http://127.0.0.1:9900/api/v1/accounts
curl -H "Authorization: Bearer dpk_xxx" "http://127.0.0.1:9900/api/v1/accounts/0501234567/conversations?limit=20"- Send a message:
bash
curl -X POST -H "Authorization: Bearer dpk_xxx" -H "Content-Type: application/json" \
-d '{"text":"Hello from the API"}' \
http://127.0.0.1:9900/api/v1/accounts/0501234567/conversations/8899001122/messagesThe message goes through the app's own sending flow: it shows up in the chat window, is saved to the DB, and triggers workflows and events exactly as if you had sent it yourself.
SDK
- TypeScript:
npx openapi-typescript http://127.0.0.1:9900/api/v1/openapi.json -o deplao-api.d.ts, then useopenapi-fetch. - Python:
openapi-python-client generate --url http://127.0.0.1:9900/api/v1/openapi.json. - Postman/Insomnia: Import → Link → paste the openapi.json URL.
Didn't find your answer?
Message us on Telegram