Shortcode: ^reminder(name, content, time)

Set up a one-time notification to the user some time in the future.

Parameter Sample Value Description
name wakeup_call Required. A unique snake_case name for the specific reminder you'd like to create.
content "Hi, <get _userFirstName>, it's time to wake up!" Required. Contents of the reminder. Treat this like a regular bot response and use all the shortcodes or RievScript constructs you need.
time 1483246800000 Required. Milliseconds since the unix epoch. See details on how to generate this.

Example Usage

> object getTime javascript
  return moment().add(Number(args[0]), 'minutes').valueOf();
< object
+ wake me up in * minutes
- ^reminder(wakeup_call, "Hi, <get _userFirstName>, it's time to wake up!", <call>getTime <star></call>) OK!
+ im already awake
- ^reminderCancel(wakeup_call) OK, we've cancelled that reminder for you.



The "name" parameter will accept any string you give it, but it gets turned into snakecase internally, meaning "WakeUp Call", "wake-up call", and "wake up call" end up all being the same: "wakeup_call".

Saved Times

Having a unique name is important, as it's what lets you cancel reminders for your users. It also lets you check the time set up for the reminder via the bot variable _reminder_{reminder_name} (ex: <get _reminder_wakeup_call>) as the time that the reminder is scheduled. Once the reminder is set, that value will be removed.


You can use any RiveScript you'd like in the "content" parameter, but if you find your reminder is getting complicated, we recommend moving it to its own topic that the reminder routes to. When you pass in unprocessed responses into the "content" parameter, make sure to surround it with <raw>. For example, in the default topic you may have:

+ remind me of something
- ^reminder(complex_reminder, "<raw>{topic=reminder}{@reminder}</raw>", <call>makeReminderTime</call>)

When the reminder runs, it will see {topic=reminder}{@reminder} and process it at that point. In your "reminder" topic you should have:

+ reminder
- Hi, <get _userFirstName>, today's foo is ${{}} What's next? ^buttons(this, that)

Creating Times

You have access to the MomentJS library inside your macros, which gives you some powerful tools for generating dates. Here's a sample macro that you can use in a variety of situations:

> object relativeTime javascript
  var value = args[0]; // Should be a number
  var interval = args[0]; // See moment.add for values
  return moment().add(value, interval).valueOf();
< object
+ remind me in * *
- ^reminder(basic_reminder, "Hey, this is a reminder", <call>relativeTime <star1> <star2></call>) Ok, you'll get a reminder in <star1> <star2>
+ remind me in *
- ^reminder(basic_reminder, "Hey, this is a reminder", <call>relativeTime <star1> minutes</call>) Ok, you'll get a reminder in <star> minutes

Managing reminders