SDK APIs
Conversation
Manage a user’s conversations with your agent: fetch and search them, pin the important ones, and rename, delete, or select a conversation by ID.
List conversations
Section titled “List conversations”Fetch conversations with pagination, search, and filtering. The three arguments are positional, not a single options object.
getConversations( pagination?: { pageNumber: number; pageSize: number }, search?: { value: string }, filters?: { pinned?: boolean },): any;foldspace.agent('AGENT_NAME').getConversations( { pageNumber: 1, pageSize: 20 }, { value: 'invoice' }, { pinned: true });| Parameter | Type | Description |
|---|---|---|
pagination.pageNumber | number | Page to fetch. Defaults to 1; values below 1 are raised to 1. |
pagination.pageSize | number | Conversations per page. Defaults to 20, and is capped at 20. |
search.value | string | Free-text search filter. |
filters.pinned | boolean | Restrict results to pinned conversations. |
Get a conversation name
Section titled “Get a conversation name”Get the name (title) of a conversation by ID.
getConversationName(conversationId: string): string | undefined;foldspace.agent('AGENT_NAME').getConversationName('CONVERSATION_ID');Pin and unpin conversations
Section titled “Pin and unpin conversations”Pin or unpin a conversation by ID. Neither returns the agent instance, so they cannot be chained.
pinConversation(conversationId: string): void;unpinConversation(conversationId: string): void;foldspace.agent('AGENT_NAME').pinConversation('CONVERSATION_ID');foldspace.agent('AGENT_NAME').unpinConversation('CONVERSATION_ID');Rename and delete conversations
Section titled “Rename and delete conversations”Rename or delete a conversation by ID. Neither returns the agent instance, so they cannot be chained.
renameConversation(conversationId: string, name: string): void;deleteConversation(conversationId: string): void;foldspace.agent('AGENT_NAME').deleteConversation('CONVERSATION_ID');foldspace.agent('AGENT_NAME').renameConversation('CONVERSATION_ID', 'NEW_NAME');Select a conversation
Section titled “Select a conversation”Make a conversation the active one by ID. Returns the agent instance, so it can be chained.
selectConversation(conversationId: string): this;foldspace.agent('AGENT_NAME').selectConversation('CONVERSATION_ID');Related
Section titled “Related”- Messaging API: send messages to your agent.
- Agent Event API: react to
conversation.createdand other events.