Created
January 12, 2024 02:13
-
-
Save sendbird-community/452fac81f33ff409d17f5b5919c2cb92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post("/hand_off", async(req, res) => { | |
const channelUrl = req.body.channel_url; | |
try { | |
const updateResponse = await updateTicketStatus(channelUrl); | |
if (updateResponse.success) { | |
res.status(200).send({ "message": "Handing over to a human. Just a minute please." }); | |
} else { | |
throw new Error(updateResponse.message); | |
} | |
} catch (e) { | |
res.status(400).send({ "error": true, "message": e.message || "Failed to perform hand over" }); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment