Scheduled Messages
Schedule and send messages in the future.
schedule(send_at=Time, tag=Symbol)
schedule(send_at=Time, tag=Symbol)Platforms
Platform
Supported
Messenger
Telegram
Usage
On Demand
user = User.first
user.notification.text "You'll receive this after 1 minute"
user.notification.scheduled(Time.now + 1.minute)Send bulk
users = User.all
users.each do |user|
user.notification.text "This is an important announcement"
user.notification.template "main/announcement", {announcement_id: 1}
user.notification.scheduled(Date.tomorrow.to_time)
endReply
Params
Name
Description
send_at
Time
Required.
The date and time when message(s) will be sent.
tag
Symbol
Optional. Scheduled message identification tag, can be any symbol.
Daemon
To send scheduled messages, there is a process that must be running. It can be started as follows:
In Background
In Foreground
With the others processes from Kogno
Deleting and Re-Scheduling
If the tag argument has been included in the creation of a scheduled message, as the example bellow:
Then the following methods of the User model can be called:
destroy_scheduled_messages(tag=Symbol)
destroy_scheduled_messages(tag=Symbol)Deletes the scheduled message associated with the provided tag.
reschedule_message(tag=Symbol)
reschedule_message(tag=Symbol)Re-Schedule the messages associated with the provided tag.
scheduled_message?(tag=Symbol)
scheduled_message?(tag=Symbol)Checks if there is a scheduled message associated with the provided tag.
Last updated
Was this helpful?