Add placeholders

This commit is contained in:
Christopher Cookman 2026-01-09 00:30:34 -07:00
parent c745054e5a
commit 28d67ec0af
2 changed files with 8 additions and 5 deletions

View file

@ -100,7 +100,7 @@
"cid": "Emergency Announcement"
},
"sling_chat_id": "17132563",
"sling_chat_message": "A user has initiated an Emergency Announcement."
"sling_chat_message": "%initiatingUser% has initiated an Emergency Announcement."
},
{
"text": "Lightning Alert",
@ -128,7 +128,7 @@
"dial": "9000"
},
"sling_chat_id": "17132563",
"sling_chat_message": "CUDA ALERT: EAP Activation - Stand By"
"sling_chat_message": "CUDA ALERT: EAP Activation - Stand By - Initated by %initiatingUser%"
},
{
"text": "EAP Evacuate",
@ -143,7 +143,7 @@
"dial": "9000"
},
"sling_chat_id": "17132563",
"sling_chat_message": "CUDA ALERT: EAP Activation - Evacuate"
"sling_chat_message": "CUDA ALERT: EAP Activation - Evacuate - Initated by %initiatingUser%"
},
{
"text": "Fire Evac",
@ -158,7 +158,7 @@
"dial": "9000"
},
"sling_chat_id": "17132563",
"sling_chat_message": "Fire Evacuation"
"sling_chat_message": "Fire Evacuation Initiated by %initiatingUser%"
}
]

View file

@ -29,6 +29,9 @@ router.post("/message", global.apiAuth, async (req, res) => {
return res.status(500).json({ error: "Sling token not configured" });
}
try {
const replacedContent = typeof content === 'string'
? content.replace(/%initiatingUser%/g, req.body.initiatingUser || '')
: content;
const response = await fetch(`https://api.getsling.com/v1/conversations/${channel}/messages`, {
method: 'POST',
headers: {
@ -36,7 +39,7 @@ router.post("/message", global.apiAuth, async (req, res) => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'content': content
'content': replacedContent
})
});
const data = await response.json();