Twitter Delete Messages

Twitter sends a notification whenever one of their users deletes a Tweet. You receive these delete messages as part of your stream. If you are storing Tweets you must take account of all of these delete messages.

When a user deletes a Tweet, we automatically remove it from our database so it is no longer available on our Historics service.

Example

Delete messages in JSON follow this format:

{
   "deleted": true,
   "interaction": {
       "id": "1e15a4459481ae00e0749f9f39d1ef82",
       "type": "twitter"
   },
   "twitter": {
       "id": "170890901852405762"
   }
}

or this format:

{
   "deleted": true,
   "interaction": {
       "id": "1e15a4459481ae00e0749f9f39d1ef82",
       "type": "twitter"
   },
   "twitter": {
       "id": "170890901852405762",
       "user": {
          "id":123456789
       }
   }
}

Your responsibilities when writing client code

Your client code must process all delete messages. Use the Twitter id to identify the corresponding Tweet. You must discard the delete message itself; you are not permitted to store any delete messages and you must not create a service that publicizes delete messages.

If you write your own client code or client libraries, remember that they must be able to recognize and handle delete messages.

Our own client libraries provide support for delete messages. In your chosen client library, look for an on_deleted event handler and add code to locate and delete the corresponding Tweet.