Chat / Flutter
Current version: v3
Chat Flutter v3
Chat Flutter
Chat
Flutter
Home
/
Chat
/
Flutter
/
Message

Create a scheduled message

You can create a scheduled user message to send at a later time by passing ScheduledUserMessageParams as an argument to the createScheduledUserMessage() method.

// Create a scheduled user message.
    final params = ScheduledUserMessageParams(
        scheduledAt: DateTime.now().millisecondsSinceEpoch + 600000, // 10 minutes
        message: 'scheduled test',
        translationTargetLanguages: ['KR', 'ENG'],
      );

// The returned message is a pending message instance for the scheduled message.
// It can be used in the same way as pending message from sendUserMessage().
      final pendingScheduledUserMessage =
          await channel.createScheduledUserMessage(params);
}

You can also create a scheduled file message to send at a later time by passing ScheduledFileMessageParams as an argument to the createScheduledFileMessage() method.

// Create a scheduled file message.
  final imageFile = await getAssetFrom('resources/image.jpeg');
  var params = ScheduledFileMessageParams.withFile(
    imageFile,
    scheduledAt: DateTime.now().millisecondsSinceEpoch + 600000, // 10 minutes
  );

// The returned message is a pending message instance for the scheduled message.
// It can be used in the same way as pending message from sendFileMessage().
  final pendingScheduledFileMessage =
      await channel.createScheduledFileMessage(params);
}