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:
SchedulerMessage schedulerMessage = new SchedulerMessage();
schedulerMessage.setDuration(60);
schedulerMessage.setAllowSenderInteraction(true); __ true to set the sender as the scheduler
schedulerMessage.setTitle("Meet Dr. Jackob");
schedulerMessage.setBufferTime(15);
schedulerMessage.setAvatarUrl("https:__encrypted-tbn0.gstatic.com_images?q=tbn:ANd9GcRdRz0HEBl1wvncmX6rU8wFrRDxt2cvn2Dq9w&usqp=CAU");
schedulerMessage.setGoalCompletionText("Meeting Scheduled Successfully!!");
TimeZone timeZone = TimeZone.getDefault();
schedulerMessage.setTimezoneCode(timeZone.getID());
schedulerMessage.setDateRangeStart("2024-01-01");
schedulerMessage.setDateRangeEnd("2024-12-31")
schedulerMessage.setReceiverType(CometChatConstants.RECEIVER_TYPE_USER);
schedulerMessage.setSender(CometChatUIKit.getLoggedInUser());
HashMap<String, List<TimeRange>> availability = new HashMap<>();
availability.put("monday", Arrays.asList(new TimeRange("0000", "1359")));
availability.put("tuesday", Arrays.asList(new TimeRange("0000", "1559")));
availability.put("wednesday", Arrays.asList(new TimeRange("0000", "0659")));
availability.put("thursday", Arrays.asList(new TimeRange("0000", "0959")));
availability.put("friday", Arrays.asList(new TimeRange("0000", "1059")));
schedulerMessage.setAvailability(availability);
APIAction clickAction = new APIAction("https:__www.example.com", "POST", "data");
ButtonElement scheduleElement = new ButtonElement("21", "Submit", clickAction);
schedulerMessage.setScheduleElement(scheduleElement);