ServiceNow Integration With Amazon Alexa Configuration

 1. Log into your ServiceNow instance, for example, https://<yourinstance>.service-now.com/

2. Make your application scope as Global

3. Go to the System OAuth > Application Registry.









4. Create new record

5. Select the Create an OAuth API endpoint for external client’s option.

6. Enter the following values (or substitute your own values):
a. Name = Amazon Alexa
b. Client Secret = alexa

7. Take note of the fields just entered as they are custom to your implementation and will be needed during the Amazon setup phase:
a. Client ID
b. Client Secret

8. You will need to come back and enter the redirect URL once you have completed the Amazon setup.

Scripted REST API

NOTE: This setup results in an unsecured REST API endpoint. Anyone connecting to your endpoint will be able to see the data it returns without being authenticated for the first few exercises. Authentication and authorization are added in later sections.

1. Go to System Web Services > Scripted Web Services > Scripted Rest APIs.









2. Enter the following values (or substitute your own values):
a. Name = Servicenow Buddies
b. API ID = ask_snowy

3. Click Submit.

4. Reopen the record you just added.

5. Take note of the following field as it will be custom to your implementation:
a. Base API Path

6. Under the Resources tab enter the following values (or substitute your own values):
a. Name = Servicenow Buddies
b. HTTP Method = POST
c. Relative Path = /
d. Requires Authentication = Unchecked 

 Enter below script:

(function process(/* RESTAPIRequest */request, /* RESTAPIResponse */response) {
var req = request.body.data.request;
var ses = request.body.data.session;var alexaResponse = {};
alexaResponse.version = "1.0";
alexaResponse.sessionAttributes = {};
alexaResponse.response = {};
alexaResponse.response.shouldEndSession = false;
alexaResponse.response.outputSpeech = {};
alexaResponse.response.outputSpeech.type = "SSML";
alexaResponse.response.outputSpeech.ssml = "<speak>Hello, I'm Servicenow Buddies your Virtual Assistnce. How may I help you!</speak>";
response.setStatus(200);
response.setContentType("application/json;charset=UTF-8");
var writer = response.getStreamWriter();
writer.writeString(global.JSON.stringify(alexaResponse));
return;
})(request, response);


Now Alexa part start:

Amazon Setup

Create new skill

1. Login to Amazon Alexa Developer Console (https://developer.amazon.com/edw/home.html)

2. Click the Create Skill button. 





3. Enter the following values (or substitute your own values)  and select Custom and click Create Skill.

                        Skill Name = My Instance



                        

      4. Select Hello World Skill and click on Continue with template button.


                        

           

5. Click Invocation tab and enter Invocation Name.

            Skill Invocation Name = my instance

NOTE: You should substitute your own name and invocation name values here.



 

 

 

 

 




6. Now Move to endpoint section and select HTTPS and add the value as following

Default Region : https://<your instance name>.service-now.com/api/195763/ask_snowy

My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority











7. Now move to account Linking and make the changes as following

1.       Do you allow users to create an account or link to an existing account with you?

Selected

2.      Allow users to enable skill without account linking (Recommended).

Selected

3.       Your Web Authorization URI*: https://<your instance name>.service-now.com/oauth_auth.do

4.       Access Token URI* : https://<your instance name>.service-now.com/oauth_token.do

5.       Your Client ID*

6.       Your Secret*

7.       Your Authentication Scheme*: Credentials in request body

8.       Scope  : Useraccount

9.       Please Note down Alexa Redirect URLs



8. Now Click on Build to build your code


Time to move back to ServiceNow

Open System Oauth -> Application Registry -> Open the record created earlier

Add 1st two URL of Alexa Redirect URLs on Redirect URL of ServiceNow


Device and Skill Setup

Enabling the Alexa Skill

You will need to enable your Alexa skill before testing:

1. Log in to https://alexa.amazon.com/

2. Select Skills from left navigation bar.

3. Select Your Skills











4. Select your skill, for example, My Instance From DEV SKILLS











5. Click Enable. If your skill is already enabled, then proceed to the next step.

 

Linking Account

1. Navigate to your skill as described above.

2. Click Settings button











3. Link Account to authenticate with the ServiceNow instance. You may need to try this step a more than once.










Click on Allow button











You are now ready to test.





Comments

  1. This is really helpful.. each and every step precisly explained.
    Keep up the good work!!

    ReplyDelete
  2. Very useful.. explanation is very clear :)

    ReplyDelete
  3. Superb piece of information shared.
    Step by step instructions provided.
    The icing on the cake are the snapshots which makes it more easy to relate things.
    Appreciate your efforts in sharing this quality stuff.

    ReplyDelete

Post a Comment

Popular Posts