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

Rate this page

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.