Description of icon
Flex UI
API Reference

ConversationHelper

Helper class for chat conversations


Example:

import { ConversationHelper, StateHelper } from "@twilio/flex-ui";
const conversationState = StateHelper.getConversationStateForTask(task);
const conversationHelper = new ConversationHelper(conversationState);
console.log(conversationHelper.lastMessage); // Returns last message object
console.log(conversationHelper.typers); // Returns all conversation participants who are typing
console.log(conversationHelper.isCustomerOnline); // Returns true if customer is online

lastMessage: MessageState#

Gets last chat message object

typers: Array.<ParticipantState>#

Gets all conversation participants which are currently typing (except you)

isCustomerOnline: boolean#

Returns true if customer is online, false if not

Need some help?