Most mobile devices do not allow users to select or copy text directly from a push notification. To provide a copyable code, use one of the two methods below.
Use an in-app message
This method works for both iOS and Android. You can show the code on an in-app page that appears immediately after a user taps the notification.
- Create an HTML page for your in-app message that includes the coupon code and a copy button.
- Add a JavaScript function to the button that uses the Clipboard API:
function copyCode() {
var code = "SAVE20";
navigator.clipboard.writeText(code).then(function() {
alert("Code copied");
});
}
- In your customer journey, add a push notification.
- Enable the setting to split the flow when a user opens the message.
- Connect the opened branch to an in-app message element and select your HTML page.
Use a native action button (Android)
Android allows you to add custom buttons to the notification itself. This method requires a developer to modify the app code. They must use the NotificationFactory class to add a Copy action button to the notification builder. When the user taps this button, the app runs a background task to put the code into the system clipboard.
Comments
0 comments
Please sign in to leave a comment.