getConversation( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a conversation by conversation ID.

If you don't have the conversation ID, use getOrCreateConversation() to retrieve the conversation using the visitor, contact, or member ID.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Inbox Messages
Read Inbox Messages
Learn more about app permissions.
Method Declaration
Copy
function getConversation(conversationId: string): Promise<Conversation>;
Method Parameters
conversationIdstringRequired

Conversation ID.

Returns
Return Type:Promise<Conversation>
JavaScript
import { conversations } from "wix-inbox.v2"; /* Sample conversationID value: '092d1135-99cf-3ca9-a0bf-378e1df4539b' */ export async function myGetConversationFunction(conversationId) { try { const conversationObject = await conversations.getConversation(conversationId); const channels = conversationObject.conversation.channels; const firstChannel = conversationObject.conversation.channels[0]; const businessName = conversationObject.conversation.businessDisplayData.name; return conversationObject; } catch (error) { console.error(error); //Handle the error } } /* Promise resolves to: * { * "conversation": { * "_id": "6fd2b962-dd8f-382f-8d27-ae63f188c939", * "businessDisplayData": { * "name": "Tim's Cookies" * }, * "channels": [ * "CHAT", * "EMAIL" * ], * "participant": { * "contactId": "9e668c08-8bdb-4240-babb-8176935f6f78" * }, * "participantDisplayData": { * "name": "jsmith@example.com" * } * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?