Skill Events

Learn more about how to use Skill Events with the Jovo Framework.

Introduction to Skill Events

Skill Events can be used to notify you if a certain event occurs, which range from the customer disabling your Skill to them linking their account using the Alexa app. The notification comes in form of a request to your Skill.

Official Documentation from Amazon.

Requirements

To enable the Skill Events you have to make changes to the skill.json file (/platforms/alexaSkill/), which you can do by updating the project.js file in your Jovo project.

Add the following to your alexaSkill object in the project.js file:

Events

As described earlier, your Skill gets notified in form of request. To map that request to one of your handlers you have to add the following state:

Inside that state you can define the intents, which will be mapped to one of the events. Here's an example:

Skill Enabled

This Skill Event gets triggered the moment your Skill gets enabled by the user.

Enable that event by adding the following to your subscription array inside your events object in your project.js:

And adding the AlexaSkillEvent.SkillEnabled inside your ON_EVENT state:

Official Documentation by Amazon.

Skill Disabled

This Skill Event gets triggered the moment your Skill gets disabled by the user. If you are using Database Integrations to store user specific data, then you should delete the user data. Otherwise you will have orphaned records in your database. The userId will not be re-used if the user re-enables the skill later: they will get a new userId.

Enable that event by adding the following to your subscription array inside your events object in your project.js:

And adding the AlexaSkillEvent.SkillDisabled inside your ON_EVENT state:

Official Documentation by Amazon.

Account Linked

This Skill Event gets triggered, if the user links their account using the companion app/website. The incoming request will also contain the access token, which you can access using this.getAccessToken().

Enable that event by adding the following to your subscription array inside your events object in your project.js:

And adding the AlexaSkillEvent.SkillAccountLinked inside your ON_EVENT state:

Official Documentation by Amazon.

Skill Permission Accepted

This Skill Event gets triggered, if your user grants permissions for the first time or if they grant them after they were revoked. The request will include the most recently accepted permissions. You can access the body of the request using the this.$alexaSkill.getSkillEventBody() method, which will contain an array with the permissions. Check out the sample requests in the official documentation to get a feeling for the JSON structure.

Enable that event by adding the following to your subscription array inside your events object in your project.js:

And adding the AlexaSkillEvent.SkillPermissionAccepted inside your ON_EVENT state:

Official Documentation by Amazon.

Skill Permission Changed

This Skill Event gets triggered, if your user grants your Skill additional permission or revokes existing ones. The request will include the most recently accepted permissions. You can access the body of the request using the this.$alexaSkill.getSkillEventBody() method, which will contain an array with the permissions. Check out the sample requests in the official documentation to get a feeling for the JSON structure.

Enable that event by adding the following to your subscription array inside your events object in your project.js:

And adding the AlexaSkillEvent.SkillPermissionChanged inside your ON_EVENT state:

Official Documentation by Amazon.

Proactive Subscription Changed

Find a detailed description of the Proactive Subscription Changed event here

Comments and Questions

Any specific questions? Just drop them below or join the Jovo Community Forum.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.