A few weeks ago my Alexa adventure started and it has kept me busy ever since! The initial goal was to build an Alexa Skill that integrates with Salesforce.com, but after diving into the matter, my goal changed. The new goal quickly became to build an Alexa SDK for APEX. And now, just a few weeks later, AlexaForce was born!

Alexa Skills

Quickly after reading the first paragraphs about development of a custom Alexa Skill, I realized that the easiest way to get started was to use the Node.js (https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs) or Java SDK (https://github.com/amzn/alexa-skills-kit-java). These technology stacks would be easily implemented on Heroku or Azure and would quickly integrate with Salesforce by using the web services API's Salesforce offers. Since I've done a fair bit of API integration with Salesforce.com, I knew that most of my Node.js or Java code would consist of managing the API round trips with Salesforce, would I choose to work with such an "external" (from a Salesforce perspective) host. 

Being an avid APEX and Force.com fan, I was disappointed to find no way to develop a skill in APEX, straight on the Force.com platform. Even though I later discovered that a well known Salesforce MVP, Enrico Murru, had already created a proof of concept for this type of Alexa skill, 2 years ago. Unfortunately, he did not take it all the way and stopped at a very basic implementation. Other Salesforce experts had also already ventured into development of Alexa skills integrating with Salesforce, but all of them went for the Node.js and Java approaches.


The conclusion was simple: If I wanted to build Alexa Skills in APEX, I would have to write up the code myself. As I found out, besides writing the code, a lot of pioneering was needed as well. While developing the SDK, many challenges I ran into were even unknown to Google. As my Alexa models and APEX code grew in complexity (e.g. implementing account linking, dialog management, session data handling, directives, request verification etc.), the Google searches became less and less fruitful.

Eventually things started to come together and I realized that it was very feasible to create a generic APEX SDK. This would allow a developer to build new Alexa Skills on Salesforce very quickly, with minimal APEX code. The new goal was set: Build an Alexa APEX SDK!

After some re-factoring and testing the SDK as a managed package, on the 7th of January the first beta version of AlexaForce was born!

The AlexaForce SDK can handle pretty much anything Alexa AVS currently offers. Simple models, Dialogs, Account linking, Certification, Session management, SSML, Cards and more. Since you write your skill in APEX, you will have direct access to your Salesforce org to store and retrieve data for your skill. It's even possible to authenticate Alexa users on your Salesforce org, by implementing Alexa's account linking configuration, along with the matching Oauth2 setup in Salesforce.

Try it?

AlexaForce is currently available as a managed package, in beta. Feel free to try it, any feedback is very much appreciated!

You will find all instructions to get started using AlexaForce here https://github.com/HKOLWD/AlexaForce

The documentation focuses on setting up your first skill. The instructions on how to handle the APEX, are mostly contained in the SampleSkill.cls, available in the git repository.

Feedback is best provided through Github, Linkedin or as a comment to this article. Please let me know what you think of AlexaForce!


Add comment

Security code