Hi all,

After calling the endpoint for a tweet by ID for an authenticated user (bearer token), the Tweet still shows in user time line as retweeted. The tweet ID will also be returned in subsequent calls to the GET /2/users/:id/tweets endpoint for the authenticated user.

Here is the endpoint documentation

The DELETE call does return the expected JSON that is in the documentation of the endpoint

‘{‘data’: {‘retweeted’: False}}’

but the behavior is inconsistent with the description of the endpoint.

It has been more than 24 hours since I made some test calls. The timeline has not been updated. Does not appear to be a queueing or batching issue.

Any advice appreciated,
rdp

Here is an example of tweet with ID 1468418228166737921 not being removed from timeline

(the tweet, call to the endpoint, response)

(the tweet still in my timeline)

(the tweet showing up in calls to timeline after DELETE endpoint was called)

(code snippet using pytwitter of what produced log just for reference)

try:
    user_tweets_query_result = api.get_timelines(user_id=my_twitter_id,
                                                 return_json=True,
                                                 max_results=50,
                                                 pagination_token=pagination_token)

    tweet_ids_to_delete = list(map(lambda t: t["id"], user_tweets_query_result['data']))
    logging.info(f"Tweets IDs to delete for user '{my_twitter_id}' {tweet_ids_to_delete}")

    tweets_to_process = user_tweets_query_result['data'] + tweets_not_processed
    tweets_not_processed = []

    for tweet in tweets_to_process:
        logging.info("archive of tweet '{}'".format(json.dumps(tweet)))
        try:
            if tweet['text'].startswith("RT "):
                delete_response = api.remove_retweet_tweet(user_id=my_twitter_id, tweet_id=tweet["id"])
            else:
                delete_response = api.delete_tweet(tweet_id=tweet["id"])
            logging.info("Response of delete tweet '{}' -> '{}'".format(tweet["id"], delete_response))

        except WrappedPyTwitterAPIRateLimitExceededException:
            # NOTE There is a rate limit of 50 'delete tweet' per 15 min window https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/delete-tweets-id
            # This is why get_timelines has max_results of 50
            tweets_not_processed.append(tweet)
            logging.info(
                "Unlike Tweet rate limit exceeded. Waiting 15min. Deleted so far {}".format(total_tweets_bleached))
            time.sleep(900)
            continue

    if 'next_token' not in user_tweets_query_result['meta'].keys():
        break

    pagination_token = user_tweets_query_result['meta']['next_token']