You can create a scheduled user message to send at a later time by passing ScheduledUserMessageCreateParams as an argument to the createScheduledUserMessage() method.
JavaScriptTypeScript
// Create a scheduled user message.
const params = {
message: 'Off work, WOOHOO!',
scheduledAt: TODAY_AT_SIX_PM,
};
channel.createScheduledUserMessage(params)
.onPending((message) => {
// Pending scheduled message is received.
})
.onSucceeded((message) => {
// Scheduled message is received.
})
.onFailed((err, message) => {
// An error is received. Failed message is null.
});
const handler = new GroupChannelHandler();
handler.onMessageReceived = (channel, message) => {
// Sent scheduled message is received.
};
sb.groupChannel.addGroupChannelHandler('groupChannelHandler', handler);
You can create a scheduled file message to send at a later time by passing ScheduledFileMessageCreateParams as an argument to the createScheduledFileMessage() method.
JavaScriptTypeScript
// Create a scheduled file message.
const params = {
file: FILE,
scheduledAt: TODAY_AT_SIX_PM,
};
channel.createScheduledFileMessage(params)
.onPending((message) => {
// Pending scheduled message is received.
})
.onSucceeded((message) => {
// Scheduled message is received.
})
.onFailed((err, message) => {
// An error is received. Failed message is null.
});
const handler = new GroupChannelHandler();
handler.onMessageReceived = (channel, message) => {
// Sent scheduled message is received.
};
sb.groupChannel.addGroupChannelHandler('groupChannelHandler', handler);