Script to send an API payload to return message and Survey Link to third party app | Query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi All,
I have a requirement where I need to send a message and a survey link via a API payload when a HR Case gets resolved.
Third Party has provided the below details -
- Webhook
- Client ID
- Client Secret
My Payload looks like -
{
"case_number": "HRC00xxxxx",
"subject_person": {
"name": "abc",
"email": "abc@gmail.com"
},
'message': your case is resolved
'url':<survey_link>
}
Since I have never written any scripted REST API, can someone please help me frame one? Also is there any other way to send these details?
Regards,
Saurabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
42m ago
If the payload needs to be sent from your side, then a Scripted REST API is not required. Scripted REST APIs are only needed when a third-party system is calling ServiceNow.
To achieve this:-
Use Flow Designer with REST Step
Steps
Go to System OAuth → Application Registries
Create OAuth 2.0 Client Credentials profile
(enter Client ID + Secret from third party)Go to Flow Designer
Trigger: HR Case → State changes to Resolved
Add Action: REST step
Method → POST
URL → Webhook URL provided
Authentication → OAuth 2.0
Body → Include API payload.
