In a recent post, I covered creating chatbots in AWS Lex and created a simple bot for ordering jellybeans. As promised, I took my bot and integrated it into a custom page in ServiceNow’s Service Portal. While I’ve worked on several integrations in this space before, this was my first time integrating an AWS service into ServiceNow.
In order to integrate Lex, I needed to provision the following:
- A ServiceNow instance (Helsinki or later)
- An AWS Account with a Lex Bot (Created during my previous experiment)
- An AWS User with the AmazonLexRunBotsOnly policy assigned
With these components in place, it was time to decide on an architecture. I needed a UI for users to chat with Lex, client-side code to handle the text and transact with Lex, and finally some server-side code to initialize parameters for the service layer that are stored in system properties.
What was critical to keep server side were the application credentials for the service account itself. There are several properties that must be gathered from your AWS configuration and added as system properties in the ServiceNow platform.
With all this in place, it was time to test! First by sending a message to Lex to invoke the Intent for ordering a jelly bean:
Then to follow the same flow of the Intent, telling the bot what flavor I want:
And finally confirm my order:
Depending on how you’ve configured your bot, you can either have Lex return parameters to ServiceNow or to pass them forward to an AWS Lambda or other endpoint. It’s easy to see the potential here for using Lex to drive another entry point for your Service Catalog or even things like Orchestration.
If you’d like to take a look at the app, I’ve got it on my GitHub here. I’m interested in any feedback you have as well as anything to share on ServiceNow app development or AWS Lex. As always, if you have any questions or comments, please feel free to add them here or address them to firstname.lastname@example.org.
Thanks for looking in!