We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Script to send an API payload to return message and Survey Link to third party app | Query

SaurabhC3189389
Tera Contributor

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

1 REPLY 1

Laveena-Agarwal
Mega Sage

Hi @SaurabhC3189389  

 

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

  1. Go to System OAuth → Application Registries

  2. Create OAuth 2.0 Client Credentials profile
    (enter Client ID + Secret from third party)

  3. Go to Flow Designer

  4. Trigger: HR Case → State changes to Resolved

  5. Add Action: REST step

  6. Method → POST

  7. URL → Webhook URL provided

  8. Authentication → OAuth 2.0 

  9. Body → Include API payload.