Zum Inhalt springen
Geprüft

Ein Support-Ticket öffnen

Lege ein Ticket per Code von außen auf dem Desk deines Tarifs an und frage es ab, bis jemand antwortet.

ticket_api_submit öffnet ein Ticket auf dem Desk, den der Tarif deines API-Schlüssels besitzt, demselben Desk, den der Bildschirm Ticketing des Dashboards verwaltet. ticket_api_get liest eines zurück, einschließlich der öffentlichen Antworten, alles, was du brauchst, um ein "Kontakt"-Formular auf einem echten Desk statt auf einem Postfach aufzubauen.

Methoden

POST/cpi/ticket_api_submit
user

API: Submit Ticket

External service: opens a ticket on the desk owned by the API key. Requires a plan with full API access.

POST/cpi/ticket_api_get
user

API: Get Ticket

External service: one ticket with its public interactions. Internal notes are never returned.

Schritt für Schritt

Das Ticket absenden

name, email und details sind Pflicht. Die E-Mail-Adresse dient zugleich als Nachschlagewert im Kontaktbuch: Wer erneut von derselben Adresse sendet, wird mit demselben Kontakt verknüpft, so wie es Einen Kontakt hinzufügen tut.

curl -s https://xuda.ai/cpi/ticket_api_submit \
  -H 'content-type: application/json' \
  -d '{
    "api_key": "YOUR_API_KEY",
    "name": "Priya Shah",
    "email": "[email protected]",
    "subject": "Cannot export invoices",
    "details": "The export button on the invoices page does nothing.",
    "priority": 2
  }'
const res = await fetch('https://xuda.ai/cpi/ticket_api_submit', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    name: 'Priya Shah',
    email: '[email protected]',
    subject: 'Cannot export invoices',
    details: 'The export button on the invoices page does nothing.',
    priority: 2,
  }),
});
const { code, data } = await res.json();
if (code > 0) console.log(data.ticket_no, data.id);
import requests

res = requests.post(
    'https://xuda.ai/cpi/ticket_api_submit',
    json={
        'api_key': 'YOUR_API_KEY',
        'name': 'Priya Shah',
        'email': '[email protected]',
        'subject': 'Cannot export invoices',
        'details': 'The export button on the invoices page does nothing.',
        'priority': 2,
    },
)
body = res.json()
if body['code'] > 0:
    print(body['data']['ticket_no'], body['data']['id'])

2. Es auf eine Antwort abfragen

Speichere data.id aus dem Submit-Aufruf und lies es mit ticket_api_get zurück, wann immer du nach Bewegung schauen willst. interactions enthält immer nur den öffentlichen Verlauf, interne Desk-Notizen werden herausgefiltert, bevor diese Methode antwortet.

curl -s https://xuda.ai/cpi/ticket_api_get \
  -H 'content-type: application/json' \
  -d '{"api_key":"YOUR_API_KEY","ticket_id":"tkt_3b7a10982341"}'
const res = await fetch('https://xuda.ai/cpi/ticket_api_get', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ api_key: 'YOUR_API_KEY', ticket_id: 'tkt_3b7a10982341' }),
});
const { code, data } = await res.json();
if (code > 0) console.log(data.status, data.interactions.length);
import requests

res = requests.post(
    'https://xuda.ai/cpi/ticket_api_get',
    json={'api_key': 'YOUR_API_KEY', 'ticket_id': 'tkt_3b7a10982341'},
)
body = res.json()
if body['code'] > 0:
    print(body['data']['status'], len(body['data']['interactions']))

Die Antwort

Beide Methoden antworten mit derselben schmalen, extern sicheren Ticketansicht, ohne Eigentümer-IDs und ohne internen Zustand:

json
{
  "code": 1,
  "data": {
    "ticket_no": "TK-1042",
    "id": "tkt_3b7a10982341",
    "source": "api",
    "channel": "api",
    "status": "open",
    "status_stage": "new",
    "subject": "Cannot export invoices",
    "details": "The export button on the invoices page does nothing.",
    "topic": null,
    "subtopic": null,
    "requester": {
      "name": "Priya Shah",
      "email": "[email protected]",
      "phone": "",
      "company": ""
    },
    "reference_id": null,
    "priority": 2,
    "due_ts": null,
    "date_created_ts": 1737042311422,
    "last_activity_ts": 1737042311422,
    "status_ts": 1737042311422
  }
}

ticket_api_get fügt einen weiteren Schlüssel hinzu, interactions, ein Array aus { direction, from, channel, body, ts } in Verlaufsreihenfolge, leer, bis jemand vom Desk (oder der Anfragende über einen anderen Kanal) antwortet.

Fehler

Weiter