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
| Name | Type | Description |
|---|---|---|
| receiverUid | 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 meet message. |
| goalCompletionText | String | The text visible after completion of goal |
| interactions | Interactions | Gives the list of elements you have interacted with |
| allowSenderInteraction | bool | Allows the sender interaction. default is false |
| avatarUrl | String | url to set avatar visible in scheduler bubble |
| timezoneCode | String | the message sender’s timezone code according to which availability is set |
| bufferTime | Int | The time added between events |
| duration | Int | The time for the event slots |
| availability | [String: [TimeRange}] | The date time range for availability in different days |
| dateRangeStart | Int | Date from which event can be scheduled |
| dateRangeEnd | Int | 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 theSchedulerMessage 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)")
}