Just looking for some assistance on writing a script that will process the following inbound JSON into something that RC recognizes. Specifically, I want the message to come through to RC looking like this (going to use variables here so it makes sense what specifically from the JSON I’m looking for):
New Ticket: $client_name/$site_name
Contact: $user_name
Subject: $ticket.$summary
$details
I’m thinking that $details would have to have something like replace(/<a\b[^>]>(.?)</a>/i,"$details") to clean it up. Any help would be appreciated.
{
"method": "POST",
"path": "/",
"query": {},
"body": {
"id": "xxxx",
"webhook_id": "yyyy",
"notification_id": 6,
"escmsg_id": "1234",
"event": "new ticket logged",
"message": "New ticket logged for Clever Company ID:001.",
"object_id": 10011,
"timestamp": "2021-12-29T21:49:39.6810696Z",
"ticket": {
"id": 10011,
"dateoccurred": "2021-12-29T21:48:07.437",
"summary": "Windows Issue",
"details": "Attachment\r\nThere is a Windows issue\r\n\r\nAttachments\r\nScreenshot_tuzj1vgh.jpeg",
"client_name": "Clever Company",
"site_name": "Main",
"user_name": "Benjamin"
}
}
}