Customize your IVR Menu with Google Calendar Twilio and Kynetx
Here at Kynetx, we are big fans of using our own system to solve problems. We ported our office phone number to Twilio so that we could write our call handling code with Kynetx Rules. This post is an example of the awesomeness that is possible with such a combination.
At Kynetx, we recently instituted Technical Office Hours. For a few hours a few times a week, we open our ears to anyone with a question. Rather then use a separate conference service, we've just added a menu option to our main phone number: (801) 649-4601.
When you call our number, menu option 5 will tell you the time of our next office hours session. This information is pulled from our public Google Calendar, where we schedule things like Office Hours and Free Lunch Friday. Tying this information to Google Calendar gives us an easy to schedule events, make adjustments, and share them. A quick adjustment to the calendar, and our phone system automatically reports the correct time for the next Office Hours session.
We wanted to take this customization a step further. Most callers to our main number during office hours are likely calling in to participate in Office Hours. Rather then reading them the entire menu, with option 5 in it's proper order, we wanted to present it first.
When you call our number during Office Hours, option 5 will be presented first. This allows callers to quickly get to office hours when they are active, but not force callers to listen to that option first during the rest of the week.
Here are the rules that present the menu:
Notice that we have two rules that announce Office Hours. Only one of the rules fires, preventing users from hearing the option twice. We use the kpublicevents:onnow() function to determine if Office Hours are on now. That function comes from a module that we created and show below. To use a module, we include a line in the meta block of our application. Notice that we pass in the URL of our Google Calendar when we load the module. This allows the same module to be used with multiple calendars. Notice that we alias the module using a name that makes sense for our application.
After we import the module, we have our function. Our module code is shown below. It currently only has one function, that we export using the provides statement. Note that the calendar url you see in the code is just our default calendar that we use for testing.
Modules are public and sharable across users. Go ahead, try this one! Copy the use module statement from above into your application, and you can test our calendar. Replace the calendar URL with your own public or private Google Calendar URL, and you can easily check the schedule in any of your applications!
If you want to create and use modules when creating your Kynetx Apps, check our our Module Documentation.
Next Up: Tell Me When