How do I delete a Message Center message?

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:

  1. Confirm that the Push ID or Message ID is correct.
  2. Confirm that message was delivered to the inbox of your test devices
  3. 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:

    1. Download Postman and open the Application
    2. Click on Import > Paste Raw Text Postman Import button

      Figure 1 - Postman: Import


      Postman_Paste_Raw.png

      Figure 2 - Postman: Paste Raw Text

    3. 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'
      

      Postman_Import.png

      Figure 3 - Postman: Import

    4. In the request url replace PushID with the Push IDPostman_Push_ID.png

      Figure 4 - Postman: Push ID

    5. Under the Authorization tab select Basic Auth from the Type dropdown list
    6. Add your App Key to the Username text field and your App Master Secret to the Password text field.Postman_Auth.png

      Figure 5 - Postman: Basic Authorization

    7. Click on the Send button

      Postman_Send.png

      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'
    

     

  4. 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.
  5. Allow approximately 5-10 minutes for processing.
  6. Confirm the message has been deleted from the inbox of test devices.
  7. For Message Center messages with local delivery, repeat steps with each Push ID.

 

Related Content

Was this article helpful?
0 out of 0 found this helpful
Submit a request