Ana içeriğe atla
Connect360’ye müşteri sohbeti, destek güncellemeleri, sipariş bildirimleri ve AI destekli yanıtlar yazmak için mesajları kullanın.

Çalışma Alanı Olarak Gönder

Varsayılan olarak mesajlar API anahtarına eklenen çalışma alanı üyesi olarak gönderilir.
const message = await plato.v1.connect.send.mutate({
  conversationId: "conversation_id",
  content: {
    en: "Hello from the support team.",
  },
});

Müşteri Olarak Gönder

Mesaj bir web sitesi ziyaretçisinden veya harici müşteriden geldiğinde sender: "customer"’yi kullanın.
const message = await plato.v1.connect.send.mutate({
  conversationId: "conversation_id",
  sender: "customer",
  customer: {
    externalId: "website_user_123",
    name: "Jane Customer",
    email: "[email protected]",
  },
  content: {
    en: "I need help with my order.",
  },
  channelIdentifier: "example.com",
});

Giriş

{
  conversationId: string;
  content?: Partial<Record<"en" | "ar" | "tr", unknown>> | null;
  attachmentIds?: string[] | null;
  flags?: string[] | null;
  parentId?: string | null;
  templateId?: string | null;
  templateContext?: unknown;
  channelId?: string | null;
  channelIdentifier?: string | null;
  sender?: "workspace" | "customer";
  customerId?: string | null;
  customer?: {
    id?: string | null;
    externalId?: string | null;
    name?: string | null;
    email?: string | null;
    phone?: string | null;
    image?: string | null;
    metadata?: Record<string, unknown> | null;
  } | null;
  ai?: {
    agentId: string;
    channelId?: string | null;
  } | null;
}

Yanıtlar

Belirli bir mesajı yanıtlarken parentId kullanın.
await plato.v1.connect.send.mutate({
  conversationId: "conversation_id",
  parentId: "message_id",
  content: {
    en: "Following up on this message.",
  },
});

Ekler

Connect360 ek uç noktasına sahip dosyaları yükleyin, ardından döndürülen dosya kimliklerini iletin:
await plato.v1.connect.send.mutate({
  conversationId: "conversation_id",
  content: {
    en: "Attached is the document.",
  },
  attachmentIds: ["file_id_1"],
});
Bkz. Ekler.

Gönderdikten Sonra AI’yi Tetikleyin

Mesaj kaydedildikten sonra bir AI yanıtı istemek için bir AI aracı kimliğini iletin.
await plato.v1.connect.send.mutate({
  conversationId: "conversation_id",
  content: {
    en: "Can you help this customer?",
  },
  ai: {
    agentId: "ai_agent_id",
  },
});
AI yanıtları eşzamansız olarak çalışır.

Mesajları Listele

const page = await plato.v1.connect.listMessages.query({
  conversationId: "conversation_id",
  limit: 50,
});
Cevap:
{
  items: [
    {
      id: "message_id",
      content: {
        en: "Hello"
      },
      conversationId: "conversation_id",
      attachments: [],
      sender: {}
    }
  ],
  nextCursor: "message_id_for_next_page"
}
Mesajlar her sayfada en eskiden en yeniye doğru döndürülür. Sonraki sayfayı getirmek için:
const nextPage = await plato.v1.connect.listMessages.query({
  conversationId: "conversation_id",
  cursor: page.nextCursor,
  limit: 50,
});