Setup and Configuration

Andrew Fawcett edited this page Sep 26, 2016 · 12 revisions
Clone this wiki locally


To bring voice control to your Salesforce world using this Amazon Alexa Skill, you will need.

  • Salesforce Login

    It is recommended you get familiar with this process through a free Salesforce Developer Edition account. The org you use will contain the Salesforce Flows that drive the conversations and capabilities you configure.

  • Amazon Login

    You can use your personal Amazon login, however you will need to connect this login with Amazon's EC2 and Developer services. You may want to signup to Amazon with a developer email if you want to keep the two separate.

  • Amazon Echo Device or Testing Tooling

    You will of course want to ideally experience this integration through an actual Amazon Echo device! However if that is not possible or you do not have one yet, it is possible to complete this configuration and test through speaking through your computer using EchoSim. Once your up and running you can easily connect your Amazon Echo device to the Amazon account you used here.

Salesforce Configuration

  1. Login to your Salesforce org as an Administrator

  2. Create a Connected App (in Setup under Apps).

    2.1. Enter any appropriate Connected App Name, API Name and Contact Email.

    2.1. Select the Enable OAuth Settings checkbox

    2.2. Enter the following in the Callback Url field


    2.3. Select for the Available OAuth Scopes following

    Access and manage your data
    Access your basic information
    Perform requests on your behalf at anytime

    2.4. Save and note down the values of the Consumer Key and Consumer Secret fields for use later

  3. Deploy the sample Flows.

Preparing the NodeJS Code

  1. Download the code from this repository.

  2. Open the index.js file in your favourite text editor.

  3. Locate these lines and update with your Salesforce user name, password and token (combine these).

     * Login to your Salesforce org
    var USER_NAME = "";
    var PASSWORD = "";
  4. Locate these lines and update with the yourclientid with Consumer Key and and yoursecret with Consumer Secret

    // Configure a connection (Salesforce Connected App, does not need setting up over and over)
    var org = nforce.createConnection({
        clientId: 'yourclientid',
        clientSecret: 'yoursecret',
        redirectUri: 'http://localhost:3000/oauth/_callback',
        mode: 'single'
  5. Zip the index.js, AlexaSkill.js files and the node_modules folder into a zip file, the name is not important. The files and the folder must be in the root of the zip file.

Deploying the NodeJS Code

  1. Login to Amazon AWS Console.

    • For a new login you will need to provide credit card details so that Amazon can charge you if you go beyond their free tier services. We will be deploying a single Lambda service. For testing and demonstration purposes it is unlikely you will exceed the free tier allowance. For more details see this page.
  2. Go to the Lambda services page.

  3. Creating an AWS Lambda Function for a Custom Skill.

    3.1. Click the region drop-down in the upper-right corner of the console and select US East (N. Virginia)

    3.2. If you have no Lambda functions yet, click Get Started Now. Otherwise, click Create a Lambda Function.

    3.3. Click the Skip button on the Select blueprint page.

    3.4. Select Alexa Skills Kit on the Configure triggers page.

    3.5. Enter the name of your skill, e.g. Jarvis and select Node JS 4.3 from the Runtime dropdown

    3.6. Select Upload a .ZIP file and upload the zip file you created earlier.

    3.7. Select Create a custom role from the Role drop down.

    3.8. This will open a new tab, select Create a new IAM Role and click Allow, the tab will then close.

    3.9. Select Choose existing role from the Role drop down and select the role you just created.

    3.10. In the Advanced Settings section, enter 10 in the Timeout sec field.

    3.11. Click Next and then click Create function.

    3.12. Click the Functions sidebar link to display your new function.

    3.13. Click your function to determine its ARN identifier and note it down for later.

Setting up and Testing your Amazon Alexa Skill

  1. Login to the Amazon Developer Portal

  2. Click the Alexa tab and click Get Started

  3. Click Add New Skill

  4. Enter an appropriate Name and Invocation Name, for example Jarvis and click Next.

  5. Paste the contents of the intentschema.json file from the examples repository into the Intent Schema field.

  6. Paste the contents of the sampleutterances.txt file from the examples repository into the Sample Utterances field.

  7. Click Next and paste in your ARN identifier captured earlier, then click Next again.

  8. Test your Alexa Skill by pasting in the phrase below and you should receive the response "Hello Tony from Salesforce Flow"

    My Name is Tony
  9. You can also test your Alexa Skill by using your spoken voice using

  10. Once your done testing, login to your Amazon account using the Amazon Echo companion app for your Amazon Echo.

  11. Speak to your Amazon Echo the following test phrase from above.

    You: Ask Jarvis, My Name is Tony
    Response: Hello Tony from Salesforce Flow
  12. Speak to your Amazon Echo the following test phrases to test conversation mode.

    You: Ask Jarvis, About favourite things
    Response: Tell me your favourite color?
    You: My favourite color is Red
    Response: What is your favourite number?
    You: My favourite number is 42
    Response: That is amazing my favourite colour and number is also Red and 42
  13. Refer to the README file for articles on how to create your own phrases and responses using Flow.