chat-adapter-wwebjs 0.1.4 → 0.1.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
@@ -1,5 +1,13 @@
1
1
  # chat-adapter-wwebjs
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Fixed
6
+
7
+ - The README and the example imported `LocalAuth` by name, which throws under Node: whatsapp-web.js is CommonJS, so ESM sees only its default export. They now import it as `wwebjs` and take `LocalAuth` from it.
8
+ - The README's install failed on pnpm 10, which refuses to build whatsapp-web.js from GitHub and skips Puppeteer's Chromium download until both are allowed in `onlyBuiltDependencies`. It now installs the tested commit in one command and says how to allow both.
9
+ - The README now warns that the `LocalAuth` directory signs in as your WhatsApp account and belongs out of version control.
10
+
3
11
  ## 0.1.4
4
12
 
5
13
  ### Changed
package/README.md CHANGED
@@ -22,12 +22,20 @@ Documentation: [chat-sdk.dev/adapters/community/wwebjs](https://chat-sdk.dev/ada
22
22
  ## Installation
23
23
 
24
24
  ```bash
25
- pnpm add chat-adapter-wwebjs whatsapp-web.js chat @chat-adapter/shared
25
+ pnpm add chat-adapter-wwebjs chat @chat-adapter/shared github:pedroslopez/whatsapp-web.js#064a3d5
26
26
  ```
27
27
 
28
- ESM only, Node >= 20. `chat`, `@chat-adapter/shared` and `whatsapp-web.js` are peers, so you control their versions. whatsapp-web.js downloads a Chromium build through Puppeteer on install.
28
+ ESM only, Node >= 20. `chat`, `@chat-adapter/shared` and `whatsapp-web.js` are peers, so you control their versions. WhatsApp Web renamed the IDs whatsapp-web.js reads, and 1.34.7 cannot send or find chats since, so until a release carries the fix, install the commit this adapter is tested against, as above.
29
29
 
30
- WhatsApp Web renamed the IDs whatsapp-web.js reads, and 1.34.7 cannot send or find chats since. Until a release carries the fix, install the commit this adapter is tested against: `pnpm add github:pedroslopez/whatsapp-web.js#064a3d5`.
30
+ whatsapp-web.js builds when installed from GitHub, and Puppeteer downloads a Chromium build on install. pnpm 10 and later run those scripts only when you allow them, in `pnpm-workspace.yaml`:
31
+
32
+ ```yaml
33
+ onlyBuiltDependencies:
34
+ - whatsapp-web.js
35
+ - puppeteer
36
+ ```
37
+
38
+ pnpm pins the commit in the lockfile rather than in `package.json`, so commit the lockfile.
31
39
 
32
40
  ## Usage
33
41
 
@@ -36,7 +44,9 @@ import { createMemoryState } from "@chat-adapter/state-memory";
36
44
  import { Chat } from "chat";
37
45
  import { createWWebJSAdapter } from "chat-adapter-wwebjs";
38
46
  import qrcode from "qrcode-terminal";
39
- import { LocalAuth } from "whatsapp-web.js";
47
+ import wwebjs from "whatsapp-web.js";
48
+
49
+ const { LocalAuth } = wwebjs;
40
50
 
41
51
  const whatsapp = createWWebJSAdapter({
42
52
  adapterName: "whatsapp",
@@ -75,7 +85,7 @@ Puppeteer's bundled Chromium covers most machines. On slim Linux images install
75
85
 
76
86
  ### 2. Keep the session
77
87
 
78
- Pick an auth strategy from whatsapp-web.js. `LocalAuth` stores the session in a directory, `RemoteAuth` in a store you provide. Persist it, or you scan again on every start.
88
+ Pick an auth strategy from whatsapp-web.js. `LocalAuth` stores the session in a directory, `RemoteAuth` in a store you provide. Persist it, or you scan again on every start. The session signs in as your WhatsApp account, so keep its directory out of version control, for example by adding `.wwebjs-auth` to `.gitignore`.
79
89
 
80
90
  ### 3. Link the device
81
91
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-adapter-wwebjs",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "WhatsApp adapter for Chat SDK, backed by whatsapp-web.js",
5
5
  "author": "nivandres",
6
6
  "license": "MIT",