Legacy Notice: This extension is considered legacy and is scheduled for deprecation in the near future. It is no longer recommended for new integrations.Please note: Legacy extensions are no longer actively maintained and will not receive feature updates or enhancements.
The Data Masking Extension allows you to hide phone numbers, email address and other sensitive information in messages. You as a developer, can add regular expressions for matching & masking.
Once the Extension is enabled for your App and the Extension Settings are done, the recipients will receive metadata with the masked message. Here is a sample response:
Copy
Ask AI
"@injected": { "extensions": { "data-masking": { "data": { "sensitive_data": "yes", "message_masked": "My number is ***** & my email id is ****" } } }}
If the data-masking key is missing, it means that the extension is either not enabled or has timed out.
At the recipients’ end, from the message object, you can fetch the metadata by calling the getMetadata() method. Using this metadata, you can fetch the masked message.
Copy
Ask AI
var metadata = message.getMetadata();if (metadata != null) { var injectedObject = metadata["@injected"]; if (injectedObject != null && injectedObject.hasOwnProperty("extensions")) { var extensionsObject = injectedObject["extensions"]; if ( extensionsObject != null && extensionsObject.hasOwnProperty("data-masking") ) { var dataMaskingFilterObject = extensionsObject["data-masking"]["data"]; var sensitive_data = dataMaskingFilterObject["sensitive_data"]; var message_masked = dataMaskingFilterObject["message_masked"]; } }}