Just till few days ago we were able to detect if tweet is deleted using
window.twttr.widgets
.createTweet(tweetId, container, options)
.then(e => {
console.log("tweet loaded")
})
.catch(err)
where in the case of deleted tweet the promise would return undefined. It looks like now in the case of deleted tweet it returns the html for the below

Is there a new way to detect if tweet has been deleted?
1 Like
Hi @patrycja ,
Thank you for bringing this to our attention! May I ask for some context on how you use this API and what you normally do with the information about whether a Tweet is deleted? We’ve made some changes recently that could be impacting the sequencing but want to make sure I understand what you are trying to achieve first so we can help you accordingly and understand more about our publisher’s use cases.
Thanks!
Hi @elibelly ,
We display a list of tweets relating to certain topics but the data we receive from a third party sometimes includes tweets that have been deleted or they may have been deleted since the data has been ingested (as we ingest the data every couple of weeks). We use createTweet method to detect if tweet has been loaded (as we display spinner while tweets are loading) and to detect if tweet has been deleted (to hide the spinner and any other related content to the tweet that we display e.g. number of retweets). And now we would like to also hide the empty box that is currently being returned (from the image above) as it may confuse the user.
Ok, thank you for sharing. I’ll take that to the team.
@patrycja One more question, do you have a public link we could refer to?
Unfortunately I can’t share the link it’s a B2B platform.
Hey @patrycja. We’ve rolled back a recent change in how the tweets are loaded so your project should be back to normal while we re-evaluate the approach. We’d love to hear more about your use cases and which parts of an embed lifecycle you hook into in addition to deletion (creation, loading, etc)?
@elibelly thank you so much for looking into this and reverting the change. In our case we want to know when the tweet has finished loading and whether it’s been deleted. This is the code we currently use (angular):
twttr.ready(() => {
twttr.widgets.createTweet(
this.appTweetEmbed,
document.getElementById(element.id),
{
align: 'center',
}
).then((e) => {
this.loading.emit(false);
if (!e) { this.tweetIsDeleted.emit(true); }
});
});
system
closed
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.