Appointment scheduling on your WordPress website - Now with Amazon Alexa skill
Tags: alexa, wordpress, convoworks, tutorial
Published: 2022-01-31 17:50:50

Many of the WordPress based websites have some kind of appointment scheduling functionality. To be more precise, there are a dozen most popular plugins which are powering at least 150K websites. Hairdresser salons, dentists, online events, there are many use cases which require booking functionality. Wouldn't it be great to be able to offer your customers the same functionality via smart speakers (e.g. Amazon Alexa)?

Voice assistants are in constant rise and are proving themselves as the user interface that you will not be able to avoid in the future. Right now, developing voice apps seems reserved for the enterprise market only, primarily because of high development costs, but in the WordPress world it can be easily changed. That is exactly what we have done and you can have your appointment booking Alexa skill in no time, for free.

<h2>Appointment booking plugins compatibility</h2>
As each appointment scheduling plugin has its own functions, database structure, ... you must be wondering how we plan to overcome that issue. As we can not completely solve it, we designed our solution in such a manner that it consists of two parts.

<strong>The first</strong> is our <code>convo-appointments</code> package, generic appointment booking solution, not tied to any plugin, not even to WordPress. This part is focused on solving <strong>conversation design</strong> requirements, while the real data (load, create ...) is delegated to the appointments context component (data source). This package comes with one dummy appointments context implementation that can serve you as an example how to implement it for your own plugin, or just  testing the skill workflow. This package also contains a ready to use Alexa skill template. You can find more about this package on the <a href="https://github.com/zef-dev/convoworks-pckg-appointments">GitHub repository</a>.

<strong>The second</strong> part is concrete <strong>appointments context implementation</strong>, which internally calls required plugin functions and does required data transformations. At the moment, we are providing implementation for the <a href="https://wordpress.org/plugins/simply-schedule-appointments/">Simply Schedule Appointments</a> WordPress plugin and you can find it in <code>convo-wp-plugin-pack</code> components package. In the ideal case, your appointments plugin will already include its own custom package with an appointments context implementation.

In this article, we will explain basic functionality of the skill itself, how to install it on your own installation and if you have <a href="https://wordpress.org/plugins/simply-schedule-appointments/">Simply Schedule Appointments</a> plugin, how to switch the skill to use it.

If this is your first contact with Convoworks, you might want to first check some basics in our <a href="https://convoworks.com/docs/publishers/tutorial-getting-started/">documentation</a> or the <a href="https://www.youtube.com/playlist?list=PL9eUOVS2fICHc7FF48opQyOWUDVvNoNFD">Convoworks basics</a> video tutorial series.


<h2>"Schedule Appointments" - Alexa skill template overview</h2>

The appointments package is shipped with the ready to use Alexa skill template, which functionality will be described in this section. This template is created to be used as Amazon Alexa only and the skill itself requires access to user full name and email address, which can be enabled in the Alexa app during the skill activation.

When we are talking about booking appointments scenarios, we should notice two main conversation flows depending on if the user already has or doesn't have an appointment.

<h3>No appointments flow & first time users</h3>

During the introduction phase, the user is greeted, told introductory information like business hours, and asked if they want to schedule an appointment.

<a href="https://convoworks.com/wp-content/uploads/2022/01/intro-text.png" class="text-center"><img class="aligncenter size-full wp-image-3326" src="https://convoworks.com/wp-content/uploads/2022/01/intro-text.png" alt="Opening message in the appointment scheduling conversation" width="644" height="121" /></a>

If the first-time user answers in the negative, the service offers the user some info about the skill owner's business, and if that answer is negative as well, it reminds users that they can ask for information about the company anytime and exits. 

If the user answers in the affirmative, the service asks about the appointment date, then if not provided along with the date, the appointment time. Finally, the service checks availability. If the date and time are available, the service asks for booking confirmation.

<a href="https://convoworks.com/wp-content/uploads/2022/01/time-date.png" class="text-center"><img class="aligncenter size-full wp-image-3329" src="https://convoworks.com/wp-content/uploads/2022/01/time-date.png" alt="Requesting time slot conversation" width="853" height="199" /></a>


If the requested date and time are not available, the user is asked to choose another time slot. In addition, our app is even capable of offering free slot suggestions.

<a href="https://convoworks.com/wp-content/uploads/2022/01/suggestions.png" class="text-center"><img class="aligncenter wp-image-3331 size-full" src="https://convoworks.com/wp-content/uploads/2022/01/suggestions-e1643382615405.png" alt="Free appointment slots suggestions" width="603" height="242" /></a>

Anytime during the service run, users can ask for help and get help in accordance with the service step they're on. Users are also able to ask Alexa to repeat the last response, by simply saying <em>“Repeat”</em>.

To skip most of the steps, a user can rely on a one-shot request when opening the skill, for example: <em>"Ask Schedule appointment to schedule an appointment on Monday at 9 am"</em>. This will send the user, if the date and time are available, right to the confirm step.


<h3>Existing appointments flow - returning user</h3>

The returning user no appointments flow is similar to the first-time user one. The exception is some changes in the text, omission of tips and introduction, as well as skipping offering to hear more about the company.
<a href="https://convoworks.com/wp-content/uploads/2022/01/one-appointment.png" class="text-center"><img class="aligncenter size-full wp-image-3332" src="https://convoworks.com/wp-content/uploads/2022/01/one-appointment.png" alt="Conversation opening message with the existing appointment" width="595" height="169" /></a>

The introduction message in existing appointments flow slightly differs depending on if the user has one or more than one appointment. If the user has an upcoming appointment, after the welcome back message, the service informs the user about the one upcoming appointment with the date and time of that appointment. The service then offers the option to cancel or reschedule the appointment.

If the user has asked to cancel the appointment, the service asks for confirmation and if the answer is yes, deletes the appointment and exits. If the answer is no the service exits after a brief message.

<a href="https://convoworks.com/wp-content/uploads/2022/01/cancel.png" class="text-center"><img class="aligncenter size-full wp-image-3337" src="https://convoworks.com/wp-content/uploads/2022/01/cancel.png" alt="Cancel appointment conversation scenario" width="844" height="131" /></a>

<h2>Alexa skill setup</h2>
Here are the instructions on how to enable appointment scheduling as an Alexa skill on your WordPress installation. You have to have installed Convoworks WP properly connected with your Amazon developer account (check <a href="https://convoworks.com/docs/publishers/platforms-configuration/amazon-alexa/">Amazon Alexa Configuration Docs</a> or <a href="https://www.youtube.com/playlist?list=PL9eUOVS2fICHc7FF48opQyOWUDVvNoNFD">Video tutorials at YouTube</a>). You will start with creating a new service (from template), you will do some basic configuration and push it to the Amazon Alexa skill store.

<h3>Create new service from template</h3>
We will start with creating a new service from the template - <strong>Schedule Appointments</strong> which is part of the <code>convo-appointments</code> package.
<a href="https://convoworks.com/wp-content/uploads/2022/01/template.png" class="text-center"><img class="aligncenter size-large wp-image-3325" src="https://convoworks.com/wp-content/uploads/2022/01/template-1024x611.png" alt="Create appointment scheduling Amazon Alexa skill from the template" width="1024" height="611" /></a>

First, open the open Convoworks WP services view and click on the <strong>Create new</strong> button. Enter your service name, then select the <strong>Schedule Appointments</strong> template and press the <strong>Submit</strong> button. Service name will be used as default for your Amazon Alexa skill invocation phrase, so it might be useful to find a nice name for it. Check about choosing the right invocation for your skill <a href="https://developer.amazon.com/en-US/docs/alexa/custom-skills/choose-the-invocation-name-for-a-custom-skill.html">here</a>.


<h3>Change the app name and other variables</h3>
This template is ready to use, but you will probably want to do some modifications to make it better fit for your needs. Besides the appointment scheduling functionality, this template has sections with the company info and about business hours that your customers might be interested in hearing.

<a href="https://convoworks.com/wp-content/uploads/2022/01/app-name.png" class="text-center"><img class="aligncenter size-full wp-image-3346" src="https://convoworks.com/wp-content/uploads/2022/01/app-name.png" alt="Set your Alexa skill name" width="621" height="493" /></a>

One thing you will certainly want to change is the <code>APP_NAME</code> variable (<strong>Variables view</strong> in service editor). This variable is used in several places in the skill (e.g. <em>"Welcome to ${APP_NAME}"</em>) and you should change it to fit your chosen name. Another one that you might want to change is <code>MAX_APPOINTMENTS_PER_PERSON</code> which can limit the number of active appointments one user can have. There are also two variables related to formatting date and time values when speaking to the end user. There is no actual need to change this, but you might want to play around to fit your needs in a better way. More about date format options can be found at <a href="https://www.php.net/manual/en/datetime.format.php">PHP docs</a>.

<h3>Change or remove business hours info</h3>
In some cases, like with first time users, the skill will inform users about business hours that are available to him. The related texts are defined in <strong>Working days and hours - intro</strong> and <strong>Working days and hours - not_allowed</strong> service fragments. Business hours definition is right now hardcoded in the service definition, so if you need to change it navigate to these two fragments and change the values to the ones which will describe your case.

<a href="https://convoworks.com/wp-content/uploads/2022/01/working-hours.png" class="text-center"><img class="aligncenter size-full wp-image-3341" src="https://convoworks.com/wp-content/uploads/2022/01/working-hours.png" alt="Business hours information for the appointment scheduling alexa skill" width="620" height="560" /></a>

<h3>Change or remove About</h3>

Your users might be interested in hearing more info about your business. The related text is defined on the <strong>Read about us</strong> conversation step. Navigate to that step and change the info about your business. 

<a href="https://convoworks.com/wp-content/uploads/2022/01/about-1.png" class="text-center"><img class="aligncenter size-full wp-image-3352" src="https://convoworks.com/wp-content/uploads/2022/01/about-1.png" alt="Handling about section in the conversation" width="665" height="804" /></a>

To remove the <strong>About</strong> flow, you'll need to delete the <strong>Run once</strong> element containing the fragment in the <strong>Home</strong> block. delete the <strong>About</strong> block and delete the<strong> About</strong> processor in the <strong>Service processors</strong>.


<h3>Time zones</h3>

When we are talking about appointment scheduling and time zones, there are two main scenarios. 

First is when the appointments are in person meetings, like hairdresser salon or dentist visits. So if you are in LA and you are scheduling your visit to the dentist in NY, you will operate in the target time zone (NY). This is the default behavior for our appointment scheduling template.

The second mode is more appropriate for online meetings. In such a case, the user is trying to book time in his own time zone and the system will do required transformations and check the availability correctly. 

Our components and the whole system design are supporting both variants and it is achieved with the <strong>Timezone mode</strong> and <strong>Timezone</strong> properties on the appointments package related elements. The template is configured to use the <strong>Default</strong> mode which will use the appointments plugin default timezone (the first case).

If you want to change the time zone mode your service is working with, right now you will have to go through the template and update manually time zone component parameters. In the next release, we will move those two configuration options to the variables, so you will be able to change it from a single place. 


<h3>Amazon Alexa Configuration</h3>

In order to work, we have to publish it to the Amazon Alexa skill store. Navigate to the service <strong>configuration</strong> view, and select <strong>Amazon Alexa</strong>.

<a href="https://convoworks.com/wp-content/uploads/2022/01/configure.png" class="text-center"><img class="aligncenter size-full wp-image-3362" src="https://convoworks.com/wp-content/uploads/2022/01/configure.png" alt="Deploy Convoworks service to the Amazon Alexa console" width="359" height="348" /></a>

This skill requires some user information, so do not forget to select <strong>Full Name</strong> and <strong>Customer Email Address</strong> in the <strong>Amazon Alexa Skill Permissions</strong> panel (see below). If you want to be able to enable a beta test for the skill, you'll have to enter the <strong>Privacy Policy URL</strong> in the <strong>Edit Skill Store Preview</strong> section. 

<a href="https://convoworks.com/wp-content/uploads/2022/01/permissions.png" class="text-center"><img class="aligncenter size-full wp-image-3363" src="https://convoworks.com/wp-content/uploads/2022/01/permissions.png" alt="Set Amazon Alexa Skill Permissions" width="854" height="119" /></a>

After filling in the information and clicking "Save" your service will be propagated to Amazon and you can head on over to the skill's <strong>Alexa Skills Kit developer console</strong> to test. 



<h3>Simply Schedule Appointments integration</h3>

If you have <strong>Simply Schedule Appointments</strong> plugin activated on your website, you can switch the service to use it and have full blown appointment scheduling Alexa skill. In this case, while in service editor switch toolbox to packages view and enable <code>convo-wp-plugin-pack</code> package. After you enable it, you will be able to add the <strong>Simply Schedule Appointments source</strong> under the <strong>Contexts</strong> tab. Once you add it, enter desired <strong>context id</strong> and select the <strong>Appointment Type</strong> you want to handle.

<a href="https://convoworks.com/wp-content/uploads/2022/01/ssa.png" class="text-center"><img class="aligncenter size-full wp-image-3358" src="https://convoworks.com/wp-content/uploads/2022/01/ssa.png" alt="Simply Schedule Appointments WordPress plugin conversational context component" width="424" height="632" /></a>


Copy the <strong>Context ID</strong> and head on over to the <strong>Variables</strong> panel. Use it to set the <code>APPOINTMENTS</code> variable. Do not forget to save changes. 

<a href="https://convoworks.com/wp-content/uploads/2022/01/ssa-var-1.png" class="text-center"><img class="aligncenter size-full wp-image-3360" src="https://convoworks.com/wp-content/uploads/2022/01/ssa-var-1.png" alt="Configure service to use Simply Schedule Appointments context" width="616" height="79" /></a>

That's it. You've created a functional appointment scheduling Amazon Alexa skill using the <strong>Simply Schedule Appointments</strong>. It is good to know that the appointments created are the same as one created through the web interface. If you installed some additional plugins, to send email notifications or do any other additional functionality, everything will work the same.



<h2>Conclusion</h2>

There are many plugins which are extending WordPress functionality in many different ways. At the same time, it is a blessing and a curse. With our appointments package we demonstrated how such issues can be avoided in a cheap and efficient way.

If you use some other appointment scheduling plugin, or even better if you are a developer of such one, please contact us and we will be glad to help you with integration.