Skip to main content
Conversation Starter enables you to retrieve an initial message in a new conversation, often used to set the context for the conversation that is about to begin. This can be particularly useful for guiding users on how to interact within the chat or for delivering automated messages that engage users when they initiate a chat.

Before you begin

1

Configure AI settings

Set up AI in the CometChat dashboard as detailed in the Overview.
2

Enable Conversation Starter

Go to ChatFeatures, under AI User Copilot, enable Conversation Starter.
3

Use v4 Chat SDKs

Implement chat using CometChat v4 Chat SDKs.

How does it work?

CometChat AI analyzes the user’s tone and writing style by reviewing recent messages sent by that user within the application. The SDK includes a method for retrieving conversation starters in a chat. This method returns an array containing three potential starters for the conversation. The number of messages used to generate conversation starters is configurable. By default, CometChat AI uses the latest 1000 messages. You can also use timestamps.
  • lastNMessages: Fetch a specific number of recent messages.
  • fromTimestamp: Fetch messages from a particular timestamp.
  • toTimestamp: Fetch messages up to a particular timestamp.
While using any configuration mentioned above a maximum of only 1000 messages will be fetched.

Implementation

SDKs

To implement Conversation Starter in the platform of your choice, you may utilize the following code samples:
const receiverId = 'UID/GUID';
const receiverType = 'user/group';
const configuration = {lastNMessages: 100};

CometChat.getConversationStarter(receiverId, receiverType, configuration).then(
	(conversation-starter) => {
  	console.log("Conversation Starter", conversation-starter);
  },
  (error) => {
  	console.log("An error occurred while fetching conversation starter", error);
  }
);

UI Kits

Assuming the necessary prerequisites are met, Conversation Starter functions seamlessly starting from v4 of the Chat UI Kits. Similarly, Conversation Starter is triggered automatically when there are no messages in a conversation.