Skip to main content
Version: v4

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:

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);