Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Reminders feature is currently available only for Alexa-based devices.

You can set reminders to take medication, a reminder of an appointment with caretaker, and so on. Typically, you can set Reminders to any of your calendar events.

The reminder node currently supports only Alexa devices and you should enable the reminder permission for the skill.

Reminder

You can enable Orbita to set a reminder for a predetermined time. Your voice assistant will wake up and read it out.

Enable the Reminder permission

  1. Go to https://developer.amazon.com/alexa/console/ask.

  2. Select your skill.

  3. Scroll down and select Permissions from the side menu bar.

  4. Enable Reminders using the toggle button.

Reminder Node in Experience Designer

You have to use the Reminder node to create reminders from your flow. The node can be used to set the reminder based on the events in the calendar.

Input

Reminder node uses a predefined input to set reminders to the users. There are 2 types of inputs to the Reminder node:

  1. Absolute. Two types of absolute reminders that should ring at an absolute point in time.

    1. Daily. The reminders that recur daily.

    2. Weekly. The reminders that recur weekly.

  2. Relative. The reminder's time should ring after 'n' seconds from the current time.

The following sample input contains Absolute_Daily, Absolute_Weekly, and Relative Reminder types respectively, in the array.

var reminders = [{
                   type            : 'SCHEDULED_ABSOLUTE',
                   timeZoneId      : 'Asia/Calcutta',
                   scheduledTime   : '2019-03-28T17:42:12',
                   text            : ' it works Daily'
                 },
                 {
                   type            : 'SCHEDULED_ABSOLUTE',
                   timeZoneId      : 'Asia/Calcutta',
                   scheduledTime   : '2019-03-28T17:42:12',
                   text            : 'it works WEEKLY',
                   recurrenceType  : 'WEEKLY',
                   byDay           : ["MO"]
                 },
                 {
                   type            : 'SCHEDULED_RELATIVE',
                   timeZoneId      : 'Asia/Calcutta',
                   offsetInSeconds : "7200",
                   text            : 'it works RELATIVE',
                 }
                ]
msg.payload.reminders = reminders
return msg;

The Default values for the parameters used in the input (if left blank) are as follows:

trigger Type = 'SCHEDULED_RELATIVE'
offsetInSeconds = null,
timeZoneId = 'America/Los_Angeles',
recurrenceType = 'DAILY',
freqByDay = null,
scheduledTime = null,
text= null,
locale= 'en-US',
pushNotification Status = 'ENABLED'

Using Calendar events to set reminders

You can create reminders for the events in the calendars.

Sample flow

You can query from the Calendar Manager node to get the required event and process the payload using the function node to set a reminder.

Sample code in the function node

The following sample code creates reminders for the events in your calendar. Place this code in the Function node before the Reminder node, after the Calendar Manager node.

var calendarData = msg.data.calendarData;
var moment = global.get('moment');
var orbitaUtil = global.get('orbitaUtil');
var lodash = global.get('lodash');
var reminders = [];
var timeZone = lodash.get(msg, 'payload.session.user.personaProfile.timezone', 'America/Chicago');

function getByday(indexs) 
  {
    var bydays = [];
    indexs.every(function(index) 
      {
        bydays.push([ 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA' ] [index - 1])
        return true;
      });
    return bydays;
  }

function getReminder(event) 
  {
    var recurrenceType = lodash.get(event, 'frequency.patterns.recurrenceType', null);
    var date = moment(lodash.get(event, 'startDate', null)).format('YYYY-MM-DDThh:mm:ss')
    var des = lodash.get(event, 'description', null);

    if(!date) 
      {
        return null;
      }

    var reminderData = 
      { 
        timeZoneId    : timeZone,
        scheduledTime : date,
        text          : orbitaUtil.sanitizeSimpleHtmlText(des, null)
      };

    switch(recurrenceType) 
      {
        case 'daily' :
          reminderData.type = 'SCHEDULED_ABSOLUTE';
          reminderData.recurrenceType = 'DAILY';
          break;
        case 'weekly' : 
          reminderData.type ='SCHEDULED_ABSOLUTE';
          reminderData.recurrenceType = 'WEEKLY';
          reminderData.byDay = getByday(lodash.get(event, 'frequency.patterns.daysInWeek', []));
          break;
        default       :
          reminderData = {};
      }
    return reminderData;
  }
var voiceString = '';

if(calendarData.length > 0) 
  {
    calendarData.every(function(event) 
      {
        var reminder = getReminder(event);
        if(event) 
          {
            reminders.push(reminder);
          }
        return true;
      });
    msg.payload.reminders = reminders;
    return [msg, null]
  } 
else 
  {
    return [null, msg]
  }
return msg

You need explicit user permission for setting each specific reminder.
The user has to invoke the skill and the corresponding utterance to set a reminder in his device.

Related Articles

  • No labels