Skip to main content

Scheduler Message

The SchedulerMessage class is used to create an interactive scheduler message that can be sent via CometChat. It extends the Interactive Messages class from CometChat.

Properties

NameTypeDescription
receiverIdstringThe ID of the receiver
receiverTypestringThe type of the receiver.
titlestringThe title of the scheduler message.
scheduleElementButtonElementThe schedule button of the scheduler message.
goalCompletionTextstringThe text visible after completion of goal.
interactionsInteractionGives the list of elements you have interacted with
allowSenderInteractionbooleanAllows the sender interaction. default value is false.
avatarUrlstringurl to set avatar in scheduler message.
timezoneCodestringthe code for setting timezone according to which availability is set
bufferTimestringThe buffer time added between events.
durationstringThe time duration for the time slots.
availabilityAvailabilityThe date time range for availability in different days.
dateRangeStartstringDate from which event can be scheduled.
dateRangeEndstringDate upto which event can be scheduled.
icsFileUrlstringurl to access ics file which can tell the schedule of message sender.

Class Usage

How to create an instance of the Scheduler Message class:

// Create an instance of APIAction
let apiAction = new APIAction("https://example.com/api", "POST");

// Create an instance of ButtonElement
let scheduleButton = new ButtonElement("1", apiAction, "Submit");


// Create a new instance of SchedulerMessage

let schedulerMessage = new SchedulerMessage("receiverId", CometChat.RECEIVER_TYPE.USER, {
availability: { "monday": [{ from: "1200", to: "1600" }], "friday": [{ from: "0600", to: "1000" }] },
title:"title",
scheduleElement: scheduleButton
});

Key Properties and Methods

Goal Completion Text

The setGoalCompletionText() method sets the goal completion text of the scheduler.

let schedulerMessage = new SchedulerMessage("receiverId", CometChat.RECEIVER_TYPE.USER, {
availability: { "monday": [{ from: "1200", to: "1600" }], "friday": [{ from: "0600", to: "1000" }] },
title: ""
});

schedulerMessage.setGoalCompletionText("Goal completed");