Skip to content

Instantly share code, notes, and snippets.

@anchetaWern
Last active June 26, 2019 05:58
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 anchetaWern/00c1da6ab0c483451ff256b8ed5402b0 to your computer and use it in GitHub Desktop.
Save anchetaWern/00c1da6ab0c483451ff256b8ed5402b0 to your computer and use it in GitHub Desktop.
React Native Stream Chat Profanity Filtering: Receiving new message webhook
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