Sari la conținut

Sărbători fără mesaje pierdute: reconectare gratuită

Alege planul
Prezentare

API aichat.md

Conectează agenții AI aichat.md la CRM-ul tău, la Zapier, Make sau n8n: lead-uri, conversații, mesaje și webhook-uri în timp real, cu o singură cheie API.

You are integrating my system with the aichat.md public API (AI agents on Facebook, Instagram, WhatsApp, Telegram, 999.md and websites).

Before writing any code, read the complete documentation for agents: https://aichat.md/llms-api-full.txt
(index: https://aichat.md/llms-api.txt, interactive reference: https://aichat.md/en/docs/api/reference).

Facts:
- Base URL: https://aichat.md/api/public/v1
- Auth: header "Authorization: Bearer <key>". The key (aik_live_…) is created in aichat.md → Settings → Developers and is shown once.
- Read the key ONLY from the environment variable AICHAT_API_KEY. Never print it, log it, commit it or put it in browser/mobile code.
- Start with GET /me to check the key and its scopes. Ask for the smallest scopes the integration needs.
- Lists: cursor pagination (limit ≤ 100, next_cursor). Send an Idempotency-Key header on every POST.
- Respect 429 Retry-After and the RateLimit-* headers. Errors have the shape { error: { type, code, message, param, request_id } }.
- Prefer webhooks (lead.created, conversation.handoff_requested, message.received, credit.low) over polling.
- Every webhook request must be verified: HMAC-SHA256 of `${t}.${raw body}` with the whsec_ secret (env AICHAT_WEBHOOK_SECRET), header Aichat-Signature, 5-minute tolerance, constant-time compare. Answer 2xx within 10 s, process asynchronously, dedupe on the event id.
- Ignore response fields you do not know (the API adds fields without notice).

Your job:
1. Ask me what I want to automate (for example: new leads into my CRM, status back from the CRM, operator alerts) and which stack I use, if it is not clear from the project.
2. Propose a short plan: endpoints, webhook events, scopes, where the code runs.
3. Implement it with tests (mock the API in tests; never call it with a real key in CI), plus a README with the environment variables.
4. Show me how to test it end to end with "Send test" in Settings → Developers → Webhooks.

Reply to me in Romanian.

Ce poți face

  • Lead-uri și contacte — citește lead-urile captate de agenți (nume, telefon, email, rezumat) și trimite înapoi statusul din CRM.
  • Conversații și mesaje — vezi conversațiile de pe Facebook, Instagram, WhatsApp, Telegram, 999.md și site, răspunde ca operator, preia sau predă conversația agentului.
  • Agenți și canale — listează agenții, pune-i pe pauză sau pornește-i, vezi starea fiecărui canal.
  • Cunoștințe — adaugă o pagină web sau un text în cunoștințele unui agent.
  • Webhook-uri — primești evenimente semnate în momentul în care se întâmplă.
  • Agenți AI (MCP) — conectezi contul la Claude, ChatGPT sau Cursor și îl conduci prin cuvinte simple. Vezi MCP.

Elementele de bază

URL de bazăhttps://aichat.md/api/public/v1
AutentificareAuthorization: Bearer aik_live_… — cheie din Setări → Dezvoltatori
FormatJSON, date în ISO 8601 UTC, ID-uri cu prefix (lead_…, conv_…)
Limite120 de cereri/minut per cheie, 600/minut per workspace
Versiunev1 în URL; schimbările incompatibile vin doar într-un v2

Fiecare cheie vede doar datele workspace-ului care a creat-o. Un obiect al altui cont răspunde mereu 404, ca și cum n-ar exista.

UrmătorulPornire în 5 minute