Skip to content

Instantly share code, notes, and snippets.

@bhumit070
Created March 20, 2026 08:52
Show Gist options
  • Select an option

  • Save bhumit070/51534fcbe0d39ed100a47701738a0750 to your computer and use it in GitHub Desktop.

Select an option

Save bhumit070/51534fcbe0d39ed100a47701738a0750 to your computer and use it in GitHub Desktop.
Delete all instagram chats - 2026
// goto https://www.instagram.com/direct/inbox/
// turn on developer mode and turn on mobile mode
// refresh the page, it should look like the same in your phone browser
// now paste the script, it will delete 100 messages but you can customize as per your message count
for (let i = 1; i < 100; i += 1) {
await new Promise(r => setTimeout(r, 5 * 1000))
console.log(`starting ${i}`)
document.querySelector('h1').parentElement.nextElementSibling.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].click()
await new Promise(r => setTimeout(r, 5 * 1000))
document.querySelectorAll('svg[aria-label="Conversation information"]')[0].parentElement.click()
await new Promise(r => setTimeout(r, 5 * 1000))
document.querySelectorAll('div').forEach(d => {
if (d.innerText == 'Delete chat') { d.click() }
})
await new Promise(r => setTimeout(r, 5 * 1000))
document.querySelectorAll('button').forEach(d => {
if (d.innerText == 'Delete') { d.click() }
})
console.log(`done ${i}`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment