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
Name | Type | Description |
---|---|---|
receiverId | string | The ID of the receiver |
receiverType | string | The type of the receiver. |
title | string | The title of the scheduler message. |
scheduleElement | ButtonElement | The schedule button of the scheduler message. |
goalCompletionText | string | The text visible after completion of goal. |
interactions | Interaction | Gives the list of elements you have interacted with |
allowSenderInteraction | boolean | Allows the sender interaction. default value is false. |
avatarUrl | string | url to set avatar in scheduler message. |
timezoneCode | string | the code for setting timezone according to which availability is set |
bufferTime | string | The buffer time added between events. |
duration | string | The time duration for the time slots. |
availability | Availability | The date time range for availability in different days. |
dateRangeStart | string | Date from which event can be scheduled. |
dateRangeEnd | string | Date upto which event can be scheduled. |
icsFileUrl | string | url to access ics file which can tell the schedule of message sender. |
Class Usage
How to create an instance of the Scheduler Message class:
- Typescript
// 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.
- Typescript
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");