Start tracking your progress
Trailhead Home
Trailhead Home

Create a Connected App and Link to Alexa

What You'll Learn

In this step, you'll learn how to:

  • Obtain your Amazon Developer Account Linking Redirect URLs.
  • Create a Salesforce Connected App representing your skill.
  • Update your skill to link to your Salesforce org.
  • Test the linking flow.

Obtain Your Amazon Developer Account Linking Redirect URLs

In order to set up your Salesforce Connected App, you need your Amazon Developer Account Linking Redirect URLs. This is specific to your Amazon Developer account. You don't need to save any settings on this page during these steps.

  1. Go back to the Salesforce Demo Alexa Skill. If you need to, you can jump to it by entering<Skill ID>/en_US/configuration in your browser, replacing <Skill ID> with the skill ID you copied previously. Unless you've closed your Amazon Developer tab, you should not need to log in again.
  2. Click on Salesforce Demo.
  3. Scroll to the bottom of the Build tab and click Account Linking.
  4. Copy and save the three URLs that show next to Redirect URLs. They look like this:
  •<Vendor ID>
  •<Vendor ID>
  •<Vendor ID>

Screenshot of the Amazon Developer Configuration page showing account linking settings.

4. Once you've copied the URLs somewhere safe, you can close this browser window without further action.

Create a Connected App

To create a Connected App:

  1. Launch your Trailhead Playground org and click the Setup iconicon at the top right, then select the Setup link.
  2. Enter App Manager into the Quick Find box and select App Manager.
  3. Click New Connected App.
  4. In the New Connected App form, fill in:
    • Basic Information:
      • Connected App Name: Alexa Skill
      • API Name: Alexa_Skill
      • Contact Email: enter your email address
    • API (Enable OAuth Settings):
      • Check Enable OAuth Settings.
      • For the Callback URL, use the Redirect URLs you saved from the previous step (see the screenshot below):<Vendor ID><Vendor ID><Vendor ID>
      • In Available OAuth Scopes, select Access and manage your data (api).
      • Click Add
      • In Available OAuth Scopes, select Perform requests on your behalf at any time (refresh_token, offline_access).
      • Click Add.
        API Settings screen showing Callback URL filled out and the desired OAuth scopes selected.
    • Click Save
    • Click Continue.
  5. Click App Manager again. Locate your newly created Alexa Skill and click the dropdown arrow on the far right. Select View.
  6. Copy and save the Consumer Key and the Consumer Secret (click the Click to reveal button to see the secret key). You need this shortly.

Update Your Skill to Link to Your Salesforce Org

With the details set in your Trailhead Playground Org, we can set up account linking with the Alexa skill we created earlier.

  1. Go back to the ASK CLI. Enter the following command and fill out the resulting entries using your Connected App settings. Note that the Default Access Token Expiration Time In Seconds field needs to be provided for this skill. Set this to something less than your Salesforce session timeout value.
$ ask api create-account-linking -s <Skill ID>
? Authorization URL:
? Client ID:  <Your Connected App’s Consumer Key>
? Scopes(separate by comma):  api,refresh_token
? Domains(separate by comma):
? Authorization Grant Type:  AUTH_CODE
? Access Token URI:
? Client Secret:  [hidden] <Your Connected App’s Consumer Secret>
? Client Authentication Scheme:  REQUEST_BODY_CREDENTIALS
? Optional* Default Access Token Expiration Time In Seconds: 3600
Account Linking created successfully.

Test the Linking Flow

  1. Go to your Alexa companion application on your device (or go to and sign in using your Amazon Developer account.
  2. If you don't have an Echo device associated with your account, you can use, a community project that allows you to use an Echo in your web browser. Once signing in with your Amazon Developer account credentials, the Echosim device shows up in your Alexa app.
  3. Click Skills.
  4. Click Your Skills.
  5. Click Dev Skills.
  6. Find the Salesforce Demo skill and click it.
  7. Click Settings.
  8. Click Link Account.
    Settings result for Link Account selection.
  9. Your browser or device then opens a window to the Salesforce login screen.
  10. Enter your Trailhead Playground user credentials, and you should see a page letting you know that your skill was successfully linked.