createScheduledUserMessage method

Future<ScheduledUserMessage> createScheduledUserMessage(
  1. ScheduledUserMessageParams userMessageParams, {
  2. OnScheduledMessageCallback<ScheduledUserMessage>? callback,
})

Creates scheduled user message

Implementation

Future<ScheduledUserMessage> createScheduledUserMessage(
  ScheduledUserMessageParams userMessageParams, {
  OnScheduledMessageCallback<ScheduledUserMessage>? callback,
}) async {
  try {
    final result = await _sdk.api.send(
      GroupChannelScheduledUserMessageSendRequest(
        channelUrl: channelUrl,
        params: userMessageParams,
      ),
    );
    if (callback != null) {
      callback(result, null);
    }
    return result;
  } catch (e) {
    if (callback != null) {
      final error = SBError(message: 'Failed Sending Request');
      callback(null, error);
    }
    rethrow;
  }
}