Skip to main content

Conversation Starter

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. Set up the AI settings through the CometChat dashboard as detailed in the Overview section.
  2. Navigate to AI features and enable Conversation Starter.
Image
  1. Implement the chat functionality in your applications using CometChat's 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 to be fetched to generate relevant conversation starter is configurable. By default the CometChat AI takes the latest 1000 messages. This can be configured to specific timestamps as well.

ConfigurationValue
lastNMessagesThis will fetch specific number of messages.
fromTimestampThis will fetch messages from a particular timestamp.
toTimestampThis will fetch messages until a particular timestamp.
info

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 pre-requisites are met, Conversation Starter functions seamlessly in the latest v4 Chat UI Kits. An AI icon should appear on the Message composer. Clicking on that icon should list Conversation Starter.