Integration with Amazon SQS - how to import AWS SDK or CryptoJS libraries for server side coding?

tamarasylte
Mega Expert

I have a requirement to post a message on to AWS SQS when a certain type of incident occurs. The message payload is in a JSON format, and I have an ACCESS KEY, a SECRET KEY, a username and of course the AWS REGION and URL. What I can't figure out is how to build the v4 signature required to submit a message to AWS SQS.

Does anyone have insight on how to import either the AWS SDK or the CryptoJS libraries into ServiceNow in such a way that they can be used server-side to create such a message?

I attempted the method outlined in Mini-Lab: Adding Underscore.js Into ServiceNow without success, getting a Javascript parse error that prevents the library from being saved.

14 REPLIES 14

Quick question - did you install any loaders or other dependencies when you set this up? I'm reading through some webpack tutorials/doc and noticed a JSHint loader which could be helpful (going to do a bit more research on that one).


Sorry for the delay, have been out for the holidays!



I did not load anything additional, but this issue may be related to the ServiceNow version. There was an upgrade to the JavaScript engine in Helsinki that introduced support for ECMAScript 5 syntax. I'll try the same steps I took in a Geneva instance to see what happens.


That's encouraging, we are moving to Helsinki in the next couple weeks (have three systems to test / move). I'm looking forward to hearing if the SN version might be the issue. (and btw, I appreciate the point towards Webpack, did a bit of playing with that over the holidays!)



Thanks!!


Sad to report that installing Helsinki did not resolve the issue. As ServiceNow support indicated this wasn't a supported feature, I've opened an enhancement request for a path to add Javascript modules for use in server-side scripting.



We have taken the approach of installing the AWS SDK on a separate server and creating a REST request to that server, which then takes the SN information (incident sys_id, for example) and then formats and pushes the message to the Amazon SQS queue. It works, at the scale we are operating currently, but we will need a better solution long term as the amount of information we'll push will definitely increase.



I continue to explore / learn about webpack -- thanks so much for the reference -- and if I learn anything new about how to make this work I'll post here.


Sorry to hear that Helsinki did not clear this up, but thanks for the update! Would you mind emailing me the INT number at josh.nerius@servicenow.com? I'd like to gain a better understanding of support's findings.