Company
Date Published
Author
Phil Nash
Word count
1049
Language
English
Hacker News points
None

Summary

You can redact or delete SMS messages as they arrive with Node.js using Twilio's webhooks. To do this, you'll need a Twilio account, a Twilio phone number, Node.js, and ngrok to expose your development server to Twilio's webhooks. You'll also need to install the Express framework, body-parser, and the Twilio Node.js helper library. Once you've set up your application, you can create a webhook endpoint that receives POST requests from Twilio whenever your Twilio number receives a message. In this endpoint, you can log the incoming message or redact its text by using the Twilio REST API to update the message resource with an empty body. If you want to delete the message completely, you'll need to check its status and wait until it's marked as "received" before deleting it. With these steps, you can keep your messages under the sole control of your system and maintain message privacy.