<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Youssef Bezza</title>
    <description>The latest articles on DEV Community by Youssef Bezza (@youssef_bezza_db2995b9e7d).</description>
    <link>https://dev.to/youssef_bezza_db2995b9e7d</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4112642%2F4ca4de00-19a5-4be2-bc4e-cfe611e42c27.jpg</url>
      <title>DEV Community: Youssef Bezza</title>
      <link>https://dev.to/youssef_bezza_db2995b9e7d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/youssef_bezza_db2995b9e7d"/>
    <language>en</language>
    <item>
      <title>Why most Instagram DM automation tools get accounts banned (and the timing model we built instead)</title>
      <dc:creator>Youssef Bezza</dc:creator>
      <pubDate>Sun, 06 Sep 2026 18:29:17 +0000</pubDate>
      <link>https://dev.to/youssef_bezza_db2995b9e7d/why-most-instagram-dm-automation-tools-get-accounts-banned-and-the-timing-model-we-built-instead-1a45</link>
      <guid>https://dev.to/youssef_bezza_db2995b9e7d/why-most-instagram-dm-automation-tools-get-accounts-banned-and-the-timing-model-we-built-instead-1a45</guid>
      <description>&lt;p&gt;I've been building &lt;a href="https://www.followtodm.com" rel="noopener noreferrer"&gt;FollowToDM&lt;/a&gt;, a tool that auto-DMs new Instagram followers, and the single biggest lesson from running it in production has nothing to do with message copy or targeting. It's timing.&lt;/p&gt;

&lt;p&gt;Almost every DM automation tool, ours included, in an earlier version, follows the same pattern: detect a trigger, queue a message, send it after some delay. The problem is that "some delay" is almost always a single fixed number. Wait 2 minutes, send. Wait 2 minutes, send. That's not a delay, it's a metronome, and a metronome is trivially easy to fingerprint. No real person replies to things on a perfectly even interval.&lt;/p&gt;

&lt;h3&gt;
  
  
  The naive version
&lt;/h3&gt;

&lt;p&gt;Here's roughly what the first version looked like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;FIXED_DELAY_MS&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sendDm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Works fine in a demo. Falls apart in production the moment you have more than one follower to message, because every send after the first is spaced identically. Over a few hundred messages, that interval shows up as a flat line if you plot time-between-sends. That's the pattern that gets flagged, not the automation itself, the regularity of it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer one: delays that stack instead of repeat
&lt;/h3&gt;

&lt;p&gt;The fix we run now: when a new follower is detected, the message gets a randomized delay somewhere in a 5–15 minute window and critically, that delay stacks on top of whatever's already queued for that same account, instead of resetting to a flat interval each time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;enqueueDispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;integrationId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;targetUserId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;delayMs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;randomBetween&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;dispatchQueue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dispatch-dm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;integrationId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;targetUserId&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;delayMs&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If three people follow the same account in a ten-minute window, they don't all fire in a burst, each one lands with its own randomized offset from the one before it. Plotted over time, it looks like a person checking notifications on their own schedule, not a queue draining.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer two: the check that catches everything the first layer can't
&lt;/h3&gt;

&lt;p&gt;Randomizing at queue-time solves the common case, but not the failure case: what happens when the worker goes offline for a few hours (deploy, crash, restart)? Every queued job becomes overdue the instant the worker comes back, and without a second check they'd all fire back-to-back, which is a far worse signal than a fixed delay ever was.&lt;/p&gt;

&lt;p&gt;So there's a second, independent check that runs right before anything actually sends, not at queue time, at send time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lastSent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getLastSentTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;integrationId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;requiredGapMs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;randomBetween&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lastSent&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;lastSent&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;requiredGapMs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;requiredGapMs&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;lastSent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;dispatchQueue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dispatch-dm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;remaining&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sendDm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the part that actually controls pacing once a backlog exists. It doesn't care when the job was originally queued, only when that specific account last actually sent something for real. A fresh random gap gets recalculated on every check, so even a fully backlogged queue drains at an irregular pace instead of settling into "one every N minutes."&lt;/p&gt;

&lt;h3&gt;
  
  
  Why you need both, not just one
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Queue-time randomization alone breaks down the moment a backlog forms (offline worker, crash, restart).&lt;/li&gt;
&lt;li&gt;A send-time floor alone works, but without queue-time randomization every message clusters right at the boundary of the minimum gap — which is its own detectable pattern.&lt;/li&gt;
&lt;li&gt;Together, a message's timing depends on two clocks that have nothing to do with each other: when it was queued, and when that account last actually sent something. That combination is much closer to how a person behaves than either check alone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What we deliberately didn't build
&lt;/h3&gt;

&lt;p&gt;No fake read receipts, no device fingerprint spoofing, no attempt to reverse-engineer Instagram's actual detection thresholds. Those are arms races you lose the moment the platform changes something server-side and they're the kind of shortcut that gets an account banned overnight the day it stops working silently. Randomized, stacking delays and a real last-sent check aren't clever evasion, they're just what sending messages on human timing actually requires.&lt;/p&gt;




&lt;p&gt;If you're building anything that sends automated messages on someone's behalf, email, DMs, notifications, I'd genuinely be curious how you're handling pacing. Happy to compare notes in the comments.&lt;/p&gt;

&lt;p&gt;(We build this stuff at &lt;a href="https://followtodm.com" rel="noopener noreferrer"&gt;FollowToDM&lt;/a&gt; if you want to see it running.)&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>saas</category>
      <category>automation</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
