@eryxenx/insta-chat 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable changes to `@eryxenx/insta-chat` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and uses
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [2.0.5] - 2026-10-10
8
+
9
+ ### Fixed
10
+
11
+ - **Empty text send logged the account out.** `MessageMethods.send()` now drops
12
+ an empty (or whitespace-only) body instead of firing an
13
+ `IGDirectTextSendMutation` with an empty `sensitive_string_value`. Instagram
14
+ answers that with a 302 to the login page, which the HTTP layer classifies as
15
+ `IG_SESSION_INVALID`, so a command that built an empty reply (for example
16
+ `adduser` handed a username it could not resolve) made the poller stop and
17
+ report the session as dead. The dropped send returns
18
+ `{ messageID: null, dropped: "empty" }`.
19
+
7
20
  ## [2.0.4] - 2026-10-10
8
21
 
9
22
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eryxenx/insta-chat",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": " Unofficial Instagram Chat API for Node.js | Build Instagram DM bots on personal accounts \u2014 send messages, media, voice notes, reactions, edit & unsend, listen for incoming chats. No browser at runtime",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "CHANGELOG.md"
24
24
  ],
25
25
  "scripts": {
26
- "test": "node test/smoke.js && node test/antiSuspension.test.js && node test/replyContent.test.js && node test/edit.test.js && node test/sendReply.test.js && node test/client.test.js && node test/relayError.test.js && node test/safetyWiring.test.js && node test/mediaOrder.test.js && node test/sessionSafety.test.js",
26
+ "test": "node test/smoke.js && node test/antiSuspension.test.js && node test/replyContent.test.js && node test/edit.test.js && node test/sendReply.test.js && node test/client.test.js && node test/relayError.test.js && node test/safetyWiring.test.js && node test/mediaOrder.test.js && node test/sessionSafety.test.js && node test/emptySend.test.js",
27
27
  "build": "node scripts/build.js"
28
28
  },
29
29
  "keywords": [
@@ -27,6 +27,15 @@ class MessageMethods {
27
27
  // (doc_id 26911679871773184). Passing it anywhere else sets a pointer without
28
28
  // rendering the quote bubble.
29
29
  async send(text, threadID, replyToItemId = null) {
30
+ // Instagram rejects an empty text send (IGDirectTextSendMutation with an
31
+ // empty `sensitive_string_value`) with a 302 to the login page. The HTTP
32
+ // layer classifies any 3xx as an auth failure, so emitting one was enough to
33
+ // make the poller declare the session dead. Commands that build a reply from
34
+ // resolvable input (e.g. adduser given an unresolvable username) can end up
35
+ // with an empty string; drop it rather than send it.
36
+ if (text === undefined || text === null || String(text).trim() === "") {
37
+ return { messageID: null, threadID: String(threadID), dropped: "empty" };
38
+ }
30
39
  // Pace outbound traffic so a personal account does not look scripted.
31
40
  await globalAntiSuspension.waitForTurn(threadID);
32
41
  const replyId =