Skip to content

Instantly share code, notes, and snippets.

@sendbird-community
Created January 12, 2024 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sendbird-community/452fac81f33ff409d17f5b5919c2cb92 to your computer and use it in GitHub Desktop.
Save sendbird-community/452fac81f33ff409d17f5b5919c2cb92 to your computer and use it in GitHub Desktop.
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