Set up the Amazon Alexa spoke

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 4 minutes to read
  • Integrate the ServiceNow instance and Amazon Alexa account by creating a custom OAuth application in Amazon Alexa to authenticate ServiceNow requests.

    Before you begin

    • Request an Integration Hub subscription.
    • Activate Amazon Alexa spoke.
    • Role required: admin

    Create a security profile

    Create and register a security profile through the Developer Console to use Login with Amazon on your ServiceNow instance.

    Before you begin

    Role required: admin.

    Procedure

    1. Log in to Amazon Developer Portal with admin credentials.
    2. Create a security profile.
      For information about creating a security profile, see Create an LwA Security Profile in Amazon Developer Documentation.
    3. Copy and record the values of Client ID and Client Secret for later use.
    4. Configure the security profile and specify these values in Web Settings:
      Field Value
      Allowed Origins ServiceNow instance URL.
      Allowed Return URLs ServiceNow instance redirect URL in this format: https://<Instance-Name>.com/oauth_redirect.do
      For more information about configuring the security policy, see Add your Website to your Security Profile in Amazon Developer Documentation.

    Register Amazon Alexa as an OAuth provider

    Use the information generated during the configuration of security profile to register Amazon Alexa as an OAuth provider and allow the ServiceNow instance to request OAuth 2.0 tokens.

    Before you begin

    Role required: admin.

    Procedure

    1. Navigate to All > System OAuth > Application Registry.
    2. Open for the record, Amazon Alexa.
    3. On the form, fill these values.
      Table 1. Application Registries form
      Field Description
      Client ID Client ID created during the configuration of the security profile.
      Client Secret Client Secret created during the configuration of the security profile.
      Authorization URL OAuth authorization code endpoint. Enter: https://www.amazon.com/ap/oa
      Token URL OAuth server token endpoint. Enter: https://api.amazon.com/auth/o2/token
      Redirect URL OAuth callback endpoint in this format: https://<instance>.service-now.com/oauth_redirect.do
      Default Grant Type Grant type used to establish the token. Select Authorization Code.
      Application Application scope that contains this record.
      Active Option to actively use the application registry.
    4. Right-click the form header, and click Save.

    Create a credential record for the Amazon Alexa spoke

    Create a credential record for the Amazon Alexa account. The Amazon Alexa spoke connection and credential alias uses these credentials to authorize actions.

    Before you begin

    Role required: admin.

    Procedure

    1. Navigate to All > Connections & Credentials > Credentials.
    2. Click New.

      The system displays this message: What type of Credentials would you like to create?

    3. Select OAuth 2.0 Credentials.
    4. On the form, fill these values.
      Table 2. OAuth 2.0 Credentials form
      Field Description
      Name Name to uniquely identify the record. For example, Alexa Cred.
      Active Option to actively use the credential record.
      OAuth Entity Profile OAuth profile created during the registration of Amazon Alexa as an OAuth provider. For example, Amazon Alexa default_profile.
      Credential alias Credential alias associated with the spoke.
    5. Right-click the form header and click Submit.
    6. To generate the OAuth token, click the Get OAuth Token related link.
      You will be redirected to the Amazon portal.
    7. Click Allow.
      You will be redirected back to ServiceNow instance.

    Create a connection record for the Amazon Alexa spoke

    Create a connection record for your Amazon Alexa account. The Amazon Alexa spoke connection and credential aliases use these connections to perform actions in Amazon Alexa.

    Before you begin

    Role required: admin.

    Procedure

    1. Navigate to All > Connections & Credentials > Connections & Credentials Aliases.
    2. Open the alias record, AmazonAlexa.
    3. From the Connections tab, click New.
    4. On the form, fill these fields.
      Table 3. Connection form
      Field Description
      Name Name to uniquely identify the record. For example, Alexa Connection.
      Credential Credential record created for Amazon Alexa spoke. For example, Alexa Cred.
      Connection alias Alias record associated with this connection.
      Connection URL Base URL to connect to Amazon Alexa. Enter: https://api.amazonalexa.com
      Active Option to actively use the connection record.
      Domain Domain that the action runs in.
    5. In the Attributes tab, enter v1 for version.
    6. Click Submit.

    Setup webhook for the Amazon Alexa spoke

    Authenticate the inbound requests from Amazon Alexa account to your ServiceNow instance by creating a webhook registry.

    Before you begin

    Role required: admin.

    Procedure

    1. In the filter navigator, enter token_verification.list.
      Records in the Token Verifications [token_verification] table are displayed.
    2. Click New.
    3. On the form, fill these values.
      Table 4. Token Verification form
      Field Description
      Name Name to identify the token record. For example, Alexa token.
      Description Brief description of the token.
      Token Value of token. This value is encrypted before it is used.
    4. Click Submit.
    5. Navigate to Alexa Webhooks > Alexa Webhook Registries.
    6. Click New.
    7. On the form, fill these values.
      Table 5. Alexa Webhook Registry form
      Field Description
      Name Name to identify the webhook registry record. For example, Alexa token.
      Description Brief description of the webhook registry record.
      Token Token you have created. For example, Alexa token.
      Path Scripted REST endpoint. A default endpoint is available. You can change the default value as per your requirement.
    8. Right-click the form header and click Save.
    9. Click Callback URL.
      Webhook Callback URL is displayed in the confirmation message. Copy and record this value.
    10. Log in to AWS Management Console.
    11. In the AWS Lambda function, specify the Webhook Callback URL and save the changes.
      Webhook Callback URL
    12. Log in to Alexa Developer Console.
    13. Navigate to Build > CUSTOM > Endpoint and specify ARN of the AWS Lambda function you had configured.
      AWS Lambda ARN