How to convert JSON values using HTML tags , in a Rest call message?

yogesh15dd
Tera Guru

Hi,

I have set up an integration between Service Now and Slack for sending notifications to slack whenever there is a request created in Service Now, i'm successful in sending the notifications, but can't decorate the notifications message using   HTML tags, for example in the below 'text' i would like to make the 'Short description', 'Product Name' and 'Inquiry Type' as a bold texts and many other things.

Passing <b> </b> is not helping.

Any idea pls?

Script part:

var slack = new SlackMessageCC();

slack.payload.text = 'A new request has been assigned to ' + current.assignment_group.name + '. Please follow the link for more information.';

slack.payload.icon_emoji = ':exclamation:';

slack.payload.attachments.push({

    'title': current.number.toString(),

      'title_link': 'https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=sc_request.do?sys_id=' + current.sys_id,

    'text':"<b>Short Description : <\/b>"+current.short_description.toString()+"\nProduct Type : "+current.u_product_name+"         Inquiry Type : "+current.u_inquiry_type+"         Location : "+current.location.name

});

slack.send();

Current Output what i'm getting is

find_real_file.png

Thanks

Yogesh Dafedar

1 ACCEPTED SOLUTION

This should work



'text':"*Short Description* : "+current.short_description.toString()+"\n*Product Type* : "+current.u_product_name+"         *Inquiry Type* : "+current.u_inquiry_type+"         *Location* : "+current.location.name



Below are few slack tips



22 Handy Slack Hacks Everyone Should Know



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

9 REPLIES 9

Thank you so much Chuck, i agree, i forgot to do that.



Thanks


Yogish Dafear


This should work



'text':"*Short Description* : "+current.short_description.toString()+"\n*Product Type* : "+current.u_product_name+"         *Inquiry Type* : "+current.u_inquiry_type+"         *Location* : "+current.location.name



Below are few slack tips



22 Handy Slack Hacks Everyone Should Know



Please mark this response as correct or helpful if it assisted you with your question.

Thanks Saniv, that worked




Regards


Yogesh Dafedar


Runjay Patel
Giga Sage

Watch this video for Slack integration steps by step configuration. Post message on slack channel via flow designer.

https://www.youtube.com/watch?v=YEGLJLubCCY&t=1s&ab_channel=ServiceNowHelpdesk

 

Please mark reply as Helpful/Correct, if applicable. Thanks!!

Harini17
Tera Expert

Hi , I need help here. I'm trying to post message to slack in tabular format. The input is of type HTML and inserted table data. But the message is getting posted as html tags in slack. Can you please help here?