Last active
June 26, 2019 05:58
-
-
Save anchetaWern/00c1da6ab0c483451ff256b8ed5402b0 to your computer and use it in GitHub Desktop.
React Native Stream Chat Profanity Filtering: Receiving new message webhook
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("/webhook", async (req, res) => { | |
try { | |
const is_valid = server_side_client.verifyWebhook(req.body, req.headers['x-signature']); | |
const event = JSON.parse(req.body); | |
if (is_valid && event.type === 'message.new') { | |
// next: add code for extracting user and message and filtering profanity | |
} | |
} catch (err) { | |
console.log("webhook error: ", err); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment