Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Latest commit

 

History

History
89 lines (59 loc) · 4.6 KB

README_SAR.md

File metadata and controls

89 lines (59 loc) · 4.6 KB

Private Alexa Skill With Salesforce Integration for Serverless Application Repository

ASK

Introduction

This Serverless Application is the back-end of a private Alexa skill that integrates with Salesforce. It includes using account linking, via a connected app in Salesforce, along with a voice code confirmation process that stores the code as a custom setting in Salesforce. Then, you can access opportunities and make updates to them using your voice.

In order to use the Alexa skill, you will need to complete a few other necessary steps to set up other resources.

Ultimately, we'll build a skill that is invoked with the name Salesforce Demo.

Alexa, open Salesforce Demo

Let's get started!

Part 1. Salesforce Setup

One of the parameters for this application is the Salesforce Instance URL. If you do not have a Salesforce instance, follow the directions below to obtain a Salesforce Trailhead Playground.

Part 2. Deploy this Serverless App

  1. Using the Serverless Application Repository, deploy this application by following the prompts. Fill in your Salesforce instance URL to match your Trailhead Playground site. It will look something like this: https://brave-moove-406615-dev-ed.my.salesforce.com.
  2. Once the deployment was completed, go to your CloudFormation Stacks and find the stack you just deployed.
  3. Click on the stack name.
  4. Expand the Resources menu.
  5. Copy the Lambda Function Name that was created. It should look something like this: aws-serverless-repository-AlexaSalesforceFunction-<Generated ID>

Part 3. Deploying the Alexa Skill front-end

Once you've deployed the Serverless App, you need to deploy the Alexa Skill front-end.

  1. You can use the ASK CLI to deploy your Alexa skill voice user interface.
  2. Once you have installed the CLI, you need to initialize it with the following command:
$ ask init

Note: You need an Amazon developer account to create an Alexa Skill.

  1. Clone or download https://github.com/Alexa/skill-sample-nodejs-salesforce.
  2. Navigate into the skill-sample-nodejs-salesforce directory.
  3. Set your Lambda function name in the Alexa config file. In the directory you just downloaded, modify the .ask/config file to have the Lambda ARN that you saved in the previous step. You want to change the "uri" setting to match that ARN. For example:
"apis": {
  "custom": {
    "endpoint": {
      "uri": "<StackName>-AlexaSalesforceFunction-<Generated ID>"
     }
  }
}
  1. Deploy the Alexa skill with the following command (it will also link your Lambda source code in the repository to the skill):
ask deploy
  1. Make sure to save your skill ID that comes out from the deploy command, as you need it later in the instructions.
-------------------- Create Skill Project --------------------
Profile for the deployment: [default]
Skill Id: **<Skill ID>**
Skill deployment finished.
Model deployment finished.
Lambda deployment finished.
Your skill is now deployed and enabled in the development stage.
Try invoking the skill by saying “Alexa, open {your_skill_invocation_name}” or simulate an invocation via the `ask simulate` command.
  1. Enable Testing - In order to test the skill before publishing, you need to enable testing on the Alexa Developer Console.

You can directly jump to the page by substituting your Skill ID into the following URL: https://developer.amazon.com/alexa/console/ask/test/<Skill ID>/development/en_US

Click the slider next to Disabled for testing. It should now say Enabled.

  1. For extra security, you can also go to your Lambda function and re-create the Alexa Skills Kit trigger with Skill ID verification enabled. For more details, see the Alexa Skills Kit documentation.

Continue with Github instructions

At this point, you can continue with the rest of the setup starting at Step 3: Account Linking in the Github repository.