Slash Command - failed with error dispatch_failed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 02:49 AM
Hi all, Iam trying to get the payload of slash command(/procurement) used in slack to servicenow log..But its showing error. as
/procurement failed with the error "dispatch_failed"'
Below is the scripted rest Api.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 03:19 AM
Hi @SAM321 ,
Below is the modified script
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) { if (request.body.data.challenge) { response.setStatus(200); response.setContentType('text/plain'); response.getStreamWriter().writeString(request.body.data.challenge); } else { if (request.body.data.event && request.body.data.event.text && request.body.data.event.text.includes('/procurement')) { gs.info('Slack Payload: ' + JSON.stringify(request.body.data.event)); } } })(request, response);
This change ensures that the text field is present in request.body.data.event and then checks if it contains the '/procurement' command.
Regards
Shravan
Please mark this as helpful and correct answer, if this helps you
Shravan
Please mark this as helpful and correct answer, if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 03:30 AM - edited 06-08-2023 03:33 AM
Hi still the error in slack ...'/procuremnt failed with the error "dispatch_failed" ..'
just now checked .. in logs its showing ...'Requested URI does not represent any resource: /934350/procurement_slack: no thrown error'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 03:49 AM - edited 06-08-2023 03:49 AM
@Sai Shravan Hi sir, when i place some text before /procurement. the payload is getting created...How ever i need payload only just by selecting the /procurement command in slack.. as it will have trigger id in that payload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 10:14 PM
Hello,
Are you able to solve this issue..?