Skip to main content


The method creates an event that will be triggered at a specified time.


Accepted arguments

The $pushgate.createEvent method accepts 6 arguments.

ArgumentDescriptionTypeRequiredDefault value
dateTimeDate and time of the eventStringYes
eventEvent nameStringNotimerEvent
eventDataData passed along with the eventObjectNo{}
channelTypeChannel typeStringNo$request.channelType
botIdBot identifierStringNo$request.botId
chatIdClient identifierStringNo$request.channelUserId
Bear in mind the following details when passing the date and time of the event:
  • The string in the dateTime argument must conform to the format yyyy-MM-ddTHH:mm:ss.
  • An event scheduled for the past will not result in an error, but will be triggered immediately.
In eventData, you can pass arbitrary data that will be needed when the event is triggered. This data will be available for access in the event handler in $request.rawRequest.eventData.

Return value

The method returns an object having one property, id — the identifier of the newly created event.


Identifiers are used to cancel events via the $pushgate.cancelEvent method.

Time zone adjustment

When scheduling events from the script, the time zone set for the client via the $reactions.setClientTimezone method is taken into account.

If the time zone for the client is not set, the time zone on the Classifier tab in project settings is used by default.


Consider the following example of a text-based alarm.

state: SetAlarm
intent!: /Alarm/Set
a: At what time?

state: Time
q: * @duckling.time *
$temp.time = $parseTree["_duckling.time"];
a: The alarm has been set for {{$temp.time.hour}}:{{$temp.time.minute}}.

state: Alarm
event!: timerEvent
a: Time to wake up!
  1. When the client tells when the alarm should be set, they transition to the Time state. The time is extracted from the request using one of the Duckling entities — @duckling.time.
  2. The parsed @duckling.time entity has a value property — a string describing the parsed time and conforming to the format required by $pushgate.createEvent. The event is scheduled for this time.
  3. When the time arrives, the scheduled timerEvent is triggered and gets processed by the script in the Alarm state.

In addition to one-time events, you can create events that occur at regular intervals. To implement this behavior, the state for processing the event should call $pushgate.createEvent and reschedule the same event for the future. Note that events are triggered once every 30 seconds at most.