Alexa for Salesforce with Amazon Echo

Amazon Echo is a voice command device with functions including question answering, playing music and controlling smart devices. Echo connects to Alexa, a cloud-based voice service, to provide information, answer questions, play music, read the news, check sports scores or the weather, and moreinstantly. All you have to do is ask. Echo begins working as soon as it detects the wake word. The Verge has a really good overview of it.

A couple of weeks ago Amazon announced the Alexa Skills Kit for Amazon Echo to make development of new voice-driven capabilities for Alexa fast and easy. I'd been watching Amazon Echo for awhile but now I could tell my wife that I needed one "for work".

Within a matter of hours after the un-boxing, I had dug through the documentation and node examples and written my first skill to have Alexa tell my girls whose turn it was to choose a sound machine sound plus provide a random daily affirmation (video). It's very addicting to write new skills and I found myself dreaming of all the ways I could automate my life. My wife even said, "I have to admit, I thought Alexa was a stupid idea at first but it's been fun!"

I spent a good portion of last weekend getting my hards dirty with Alexa and building some integration with Salesforce. Most of the node.js documentation and examples are for Amazon Lambda so I decided to go that route for development instead of using Heroku as I typically do.

This github repo has all of the code needed plus setup instructions for AWS Lambda and Alexa. The Alexa Salesforce application has the following functionality:

Create a New Lead

Alexa can walk the user through the process of creating a (simple) Lead in Salesforce.

User: "Alexa, ask Salesforce to create a new Lead."
Alexa: "OK, let's create a new Lead. What is the person's first and last name?"
User: "Jeff Douglas"
Alexa: "Got it. the name is Jeff Douglas. What is the company name?"
User: "ACME Corp"
Alexa: "Bingo! I created a new lead for Jeff Douglas with the company name ACME Corp."

Opportunity Status

You can ask Alexa for the status of any Opportunity by name and she will return the amount, stage and probability.

User: "Alexa, ask Salesforce for Opportunity United Oil Standby Generators."
Alexa: "I found Opportunity United Oil Standby Generators for $80000, the stage is Value Proposition and the probability is 50%"

New Leads for Today

You can ask Alexa for any new Leads entered today.

User: "Alexa, ask Salesforce for any new Leads."
Alexa: "You have 2 new leads, 1, Jeff Douglas from ABC Company, and 2, Mike Smith from XYZ Corp. Go get them tiger!"

Calendar for Today

Similar to the baked-in Google calendar integration, you can ask Alexa to check your Salesforce calendar and let you know what is upcoming for today.

User: "Alexa, ask Salesforce for my calendar for today."
Alexa: "You have 2 events for today. At 10:15 am Follow-up Meeting. At 10:30 am, UI Demo with Tim Barr."

Amazon Echo App

The Amazon Echo App (iOS, Android & web) allows you to view the cards and information from Alexa. This make it useful if you want to check the results of your skills or provide more information to users.


If you are familiar with Node.js and nforce, development is fairly straight forward after you grok invocations and intents. A user invokes intents with their voice and invocations are the name that identifies the capability the user wants. The IntentSchema.json defines the the intents for the applications (along with the "slots" or values that Alexa will send your Lambda function) and SampleUtterances.txt provide the mappings between the intents and the typical utterances that invoke those intents in a list of sample utterances. The index.js file is the actual Lambda function that is uploaded to AWS and provides all of the functionality.

The development experience with Alexa is sometimes infuriating. Often Alexa will say it cannot reach the skill and you don't know if there's an error with your code (you have to check the CloudWatch logs) or if Alexa just can't connect to the skill. Sometimes you just have to try the skill a couple of times before it works. I found that using the included test.js file helps in prototyping before adding the code in the Lambda function.


So far this is a good start with Alexa but there's a long way to go. One issue with the Salesforce integration is that it is a single user mode. Each interaction is with a specific named user and there's currently no authentication process. Perhaps that's something I can work on.