Skip to main content
Use the SDK for Connect360 conversation operations.

Get Or Create A Conversation

const conversation = await plato.v1.connect.getOrCreateConversation.mutate({
  type: "DIRECT",
  customer: {
    externalId: "website_user_123",
    name: "Jane Customer",
    email: "[email protected]",
  },
  channelIdentifier: "example.com",
  metadata: {
    source: "website-chat",
  },
});
At least one of these must be provided:
  • customerId
  • customer
  • memberIds

Input

{
  name?: string | null;
  type?: "DIRECT" | "GROUP";
  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;
  memberIds?: string[] | null;
  channelIds?: string[] | null;
  channelIdentifier?: string | null;
  metadata?: Record<string, unknown> | null;
}

Reuse Behavior

When a matching customer already has a top-level conversation, Plato returns the existing conversation. When no matching conversation exists, Plato creates one. The API key’s workspace member is automatically included as a participant.

Create A Sub-Conversation

const thread = await plato.v1.connect.createSubConversation.mutate({
  parentId: conversation.id,
  name: "Order #1042",
  type: "GROUP",
  customer: {
    externalId: "website_user_123",
  },
  channelIdentifier: "example.com",
});
Sub-conversations inherit parent channels when channelIds and channelIdentifier are omitted.

Update A Conversation

const updated = await plato.v1.connect.updateConversation.mutate({
  id: conversation.id,
  name: "VIP customer support",
  metadata: {
    priority: "high",
  },
});
You can update:
  • name
  • metadata
  • parentId
Metadata is merged into the existing metadata object.

Delete A Conversation

await plato.v1.connect.deleteConversation.mutate({
  id: conversation.id,
});
The API key needs connect360:conversation:delete. Delete only when the integration owns the conversation lifecycle.

List Sub-Conversations

const page = await plato.v1.connect.listSubConversations.query({
  parentId: conversation.id,
  limit: 30,
});
Response:
{
  items: [
    {
      id: "conversation_child_1",
      name: "Order #1042",
      parentId: "conversation_parent_1",
      messages: [],
      participants: [],
      _count: {
        children: 0,
        messages: 3
      }
    }
  ],
  nextCursor: 30
}
To fetch the next page:
const nextPage = await plato.v1.connect.listSubConversations.query({
  parentId: conversation.id,
  cursor: page.nextCursor,
  limit: 30,
});