After creating a Message Center message and sending it to your audience you may encounter the need to remove the message from users' inboxes. For example, a typo was found in a campaign advertising a sale of 50% off when it should have been only 5% off. This article will walk you through the Message Center message removal process.
You will need the Push ID or Message ID to perform this action. |
It will not work with a group_id from an automated message or a push to local time delivery. To delete rich messages that were part of automated or local time deliveries, you must use relevant push_id (s) from the operation. |
Follow the steps below to delete a Message Center message:
- Confirm that the Push ID or Message ID is correct.
- Confirm that message was delivered to the inbox of your test devices
-
Leverage the API to delete the message. There are a variety of ways to accomplish this task. Below are examples for two different methods, a Postman request and a cURL request.
Postman Request:
- Download Postman and open the Application
- Click on Import > Paste Raw Text
Figure 1 - Postman: Import
Figure 2 - Postman: Paste Raw Text
- Paste the following code and click on Import
curl -X DELETE \ https://go.urbanairship.com/api/user/messages/PushID \ -H 'accept: application/vnd.urbanairship+json; version=3;' \ -H 'content-type: application/json'
Figure 3 - Postman: Import
- In the request url replace PushID with the Push ID
Figure 4 - Postman: Push ID
- Under the Authorization tab select Basic Auth from the Type dropdown list
- Add your App Key to the Username text field and your App Master Secret to the Password text field.
Figure 5 - Postman: Basic Authorization
-
Click on the Send button
Figure 6 - Postman: Send
cURL Request:
A cURL request will follow this basic format:
curl -X DELETE \ https://go.urbanairship.com/api/user/messages/PushID \ -H 'accept: application/vnd.urbanairship+json; version=3;' \ -H 'authorization: Basic AppKey:AppMasterSecret' \ -H 'content-type: application/json'
- In the request URL replace PushID with the Push ID
- In the authorization replace AppKey:AppMasterSecret with the App Key and App Master Secret encoded to base64.
Below is an example of a request to delete a message with Push ID 78cdc4e3-22ab-4543-ab9c-b4d7d787dc55
curl -X DELETE \ https://go.urbanairship.com/api/user/messages/78cdc4e3-22ab-4543-ab9c-b4d7d787dc55 \ -H 'accept: application/vnd.urbanairship+json; version=3;' \ -H 'authorization: Basic MTIzNGFwcF9rZXk0MzIxYXBwX2tleToxMjM0YXBwX21hc3Rlcl9zZWNyZXQ0' \ -H 'content-type: application/json'
- You should receive a response similar to the example below. This is an asynchronous call; as such, a success response means that the deletion has been queued for processing.
HTTP/1.1 202 Accepted Content-Type: application/json { "ok": true }
An "ok": true response indicates that the request was properly formatted and accepted for processing. There is no validation of the Push ID when the request is received. - Allow approximately 5-10 minutes for processing.
- Confirm the message has been deleted from the inbox of test devices.
- For Message Center messages with local delivery, repeat steps with each Push ID.