Sending Incident created notifications to Teams

Jason Nicholas
Tera Expert

Hi

 

I am trying to set up a process that whenever a certain incident type is created, a messages is sent to a teams chat or channel.

 

Researching this it looked quite simple, set up a webhook on the channel, paste the URL into a Flow Action and the message will be sent when the flow runs.

The issue is that Webhooks are no longer available (demised this month) and I now need to use Power Automate instead.

 

I have a premium license for Power Automate so I can establish the connection to ServiceNow and create a flow here to talk to teams. I have then tried to configure a Flow to push the incident details to Power Automate however I am failing every time

 

If I add the following into the Power Automate flow 

 

JasonNicholas_0-1780416105807.jpeg

 

 

when I run the flow in ServiceNow I get the error

Error: 400. Message: {"error":{"code":"InvalidRequestContent","message":"The input body for trigger 'manual' of type 'Request' must be of type JSON, but was of type 'application/octet-stream'.","messageTemplate":"The input body for trigger '{0}' of type '{1}' must be of type JSON, but was of type '{2}'."}}. (Process Automation.0e9862431324030039a039ed9344b05f; line 5)

 

 

If I remove the Json and run the flow, it does send something to the teams channel, 

 

JasonNicholas_1-1780416105807.jpeg

 

However my ServiceNow flow shows

Error: 202. Message: . (Process Automation.0e9862431324030039a039ed9344b05f; line 5)

 

Does anyone have any experience of sending messages to teams, should I be doing it this way or instead of a Flow should I be using 'Rest Message ' and Business Rules. 


Google search also mentions a ServiceNow connector in Power Automate but mine does not have this


I am new to this so any guidance would be appreciated.

6 REPLIES 6

nawalkishos
Kilo Sage

Hi @Jason Nicholas ,

 

I have done similar kind of requirements where we need to send the survey into the ms team . for that I have followed the below link and followed the steps on by one ( in service now) and power automate side as well and we have successfully now sending survey and receiving the feedbacks. 

 

Links--- https://www.servicenow.com/community/developer-forum/send-servicenow-surveys-to-microsoft-teams-chat...

 

hope that link will solve your or help to achieve your goal.

 

If you found my response helpful , please mark it as helpful 👍 and accept it as the solution .

Thank you! 🙏
Nawal Singh

Thanks for the advise,

 

I have taken a look at this and unsure what actions I would use for the 'Step 2 - Create a Flow action'

It seems I need to add a json builder and script action but I cant find these. 

 

Whilst I have a good deal of development with ServiceNow and  I understand the scripting I am completely new to flow designer. I have only built 1 previous example and that was a simple one to email users when an incident has not been updated for 24hrs.

Nawalkishos

 

Did you see my question below and are you able to assist further please

Tanushree Maiti
Tera Patron

Hi @Jason Nicholas 

 

The error occurs because the webhook expects the request payload to be sent in JSON format.

Currently, the payload is being sent in a different format.

 

To resolve this issue, edit the Post Message action in your flow and add the following header:

Content-Type: application/json.

 

Similar post: Microsoft Teams Spoke will not work with Microsoft Teams Workflows - They will stop working in Oct 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti