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 Interactive Messages class from CometChat.

Properties

NameTypeDescription
receiverUidStringThe ID of the receiver
receiverTypeStringThe type of the receiver
titleStringThe title of the scheduler message
scheduleElementButtonElementThe schedule button of the meet message.
goalCompletionTextStringThe text visible after completion of goal
interactionsInteractionsGives the list of elements you have interacted with
allowSenderInteractionboolAllows the sender interaction. default is false
avatarUrlStringurl to set avatar visible in scheduler bubble
timezoneCodeStringthe message sender's timezone code according to which availability is set
bufferTimeIntThe time added between events
durationIntThe time for the event slots
availability[String: [TimeRange}]The date time range for availability in different days
dateRangeStartIntDate from which event can be scheduled
dateRangeEndIntDate 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 SchedulerMessage class:

let schedulerMessage = SchedulerMessage()
schedulerMessage.duration = 60
schedulerMessage.title = "Meet Dr. Jackob"
schedulerMessage.bufferTime = 15
schedulerMessage.avatarURL = "https:__encrypted-tbn0.gstatic.com_images?q=tbn:ANd9GcRdRz0HEBl1wvncmX6rU8wFrRDxt2cvn2Dq9w&usqp=CAU"
schedulerMessage.goalCompletionText = "Meeting Scheduled Successfully!!"
schedulerMessage.timezoneCode = TimeZone.current.identifier
schedulerMessage.dateRangeStart = Int(Date().timeIntervalSince1970)
schedulerMessage.dateRangeEnd = Int(Date().addingTimeInterval(30 * 24 * 60 * 60).timeIntervalSince1970)
schedulerMessage.receiverUid = "cometchat-uid-1"
schedulerMessage.receiverType = .user
schedulerMessage.availability = [
"monday": [TimeRange(startTime: "0000", endTime: "1359")],
"tuesday": [TimeRange(startTime: "0000", endTime: "1559")],
"wednesday ": [TimeRange(startTime: "0000", endTime: "0659")],
"thuesday": [TimeRange(startTime: "0000", endTime: "0959")],
"friday": [TimeRange(startTime: "0000", endTime: "1059")],
]

let clickAction = APIAction()
let scheduleElement = ButtonElement(elementType: .button, elementID: "21", clickAction: clickAction, buttonText: "Submit")
schedulerMessage.scheduleElement = scheduleElement
return schedulerMessage

Send Scheduler Message

CometChatUIKit.sendSchedulerMessage(schedulerMessage: schedulerMessage) { schedulerMessage in
print("schedulerMessage sent success")
} onError: { error in
print("schedulerMessage sent failed with error: \\(error?.description)")
}