Most Popular
Recently Added
Recently Updated

Sending scheduled reminders to your mobile phone using Virtual Attendants and Twilio

Introduction

There are countless ways to remind yourself to do something: you can leave Post-It notes somewhere you'll see them (e.g. the mirror, front door, steering wheel, computer monitor), schedule a reminder on your mobile phone, etc. One of the main advantages of using Virtual Attendants for reminders is that they can adapt to any kind of situation.

Cerb5's notification system keeps you informed about the various conversations and tasks that you're involved with, but there are times when you need a more interruptive reminder when you're away from the desk or office. Since your mobile phone is usually with you, you can instruct your Virtual Attendant to send you a friendly reminder by text message.

If you set a reminder on your mobile phone from the built-in functionality, it will interrupt whatever you're doing whether or not you've managed to finish your task before the deadline. Your Virtual Attendant can be aware of the status of a conversation or task, and you can instruct it to not remind you when the deadline arrives and you've already acted.

Note: The technique described in this article requires version 5.7 or later.

Implementation

First, in order to send text messages to mobile phones we will need to enable one of Cerb5's SMS gateway plugins. Plugins currently exist for Twilio and Clickatell. We make a lot of use of Twilio at WebGroup Media, although their coverage is primarily limited to the United States and Canada right now. Clickatell can reach an international audience for a slightly higher per-message cost.

Installing the Twilio plugin

Throughout this article we will assume the use of Twilio, but the process will be the same when using any provider. The source code for these plugins can be used as a reference when adding support for a different mobile messaging provider.

To install the Twilio plugin, follow these instructions.

Configuring a Virtual Attendant reminder macro

Now that the Twilio plugin is installed and configured, you can send text messages from inside Cerb5. This functionality is especially useful when combined with Virtual Attendants because you have full control over the content that is sent to your mobile phone, as well as under what conditions.

To complete this example, we want to create a macro that sends us a reminder message at a specific time. We will be creating a ticket macro, but the process is identical for any kind of macro.

  1. Click on your name in the top right and select Virtual Attendant from the menu.
  2. Click on the Create Behavior button. Create the new behavior with the following information:
    • Title: Remind me via SMS
    • Event: Custom ticket behavior
    • Status: Enabled
    • Add a public variable named Message of type Text. This will be used to specify the custom message you want sent to your mobile phone at a specific time.
  3. Click the Save Changes button.

Now that we've created the new macro, the last step is to add an action that sends an SMS to our mobile phone.

  1. Click on the Custom ticket behavior bubble in the Remind me via SMS behavior and select Add Actions from the menu.
  2. Set the Title to Send SMS.
  3. In the Add Action section, select Send SMS via Twilio from the dropmenu list.
  4. Add your mobile phone number to the Phone: field. Twilio is pretty flexible with how you specify your number, but you should format it with a plus, the country code, area code, prefix, and line number.
  5. The Content field contains the message that you want to send. Since we want to include a custom reminder each time we use this macro we're going to specify the Message behavior variable we created earlier.

Add the following snippet template to the Content field:

{% set msg = "#" ~ ticket_mask ~ ": " ~ var_message %}
{{msg|truncate(155)}}

The snippet template uses some advanced features, so let's explore what it's doing.

  • When we use {% ... %} rather than {{ ... }} in a snippet, we're using a command instead of displaying a placeholder. In this case we're using set to create a dynamic variable called msg. This will hold our final message text.
  • Text can be concatenated (appended to each other) in a snippet by using the ~ (tilde) operator. We're using this to automatically prefix a ticket mask to our reminder. We then append the value of var_message which is our reminder message.
  • On the second line, we're outputting the text from the msg variable (a ticket mask and reminder message). We're also including a |truncate(155) modifier to ensure that the message we're sending our mobile phone won't be longer than 155 characters. This is an optional step, as many mobile phones and mobile service providers are now capable of delivering messages longer than the original limit of 140-160 characters. We're including this step for completeness, but you can change the second line to {{msg}} and test with a longer message to see if this step is necessary in your environment.

Once you're satisfied with the snippet template, click the Save Changes button.

Our macro is now complete!

Using the macro to schedule reminders by SMS

You now have the incredibly useful ability to instruct your Virtual Attendant to send SMS reminders to your mobile phone.

Here's how:

  1. Click into any ticket.
  2. Click on the Virtual Attendant button and select Remind me via SMS from the menu.
  3. In the schedule behavior popup, enter the time that you want to be reminded, and the reminder message.
  4. Click the OK button.

That's it! At the scheduled time your mobile phone will receive a text message with the ticket mask and your reminder.


Properties ID: 000088   Views: 10691   Updated: 3 years ago
Filed under:
knowledgebase comments powered by Disqus