-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there possible to run two Wechaty instance with Puppet Whatsapp? #393
Comments
Here's an example code of this scenario:
Here's the error code when a second account logs in
|
According to this discussion, I found that the Whatsapp instance is created with fixed authStrategy
Is there a way that wechaty users can change this? According to this, we should allow the Wechaty wrapper to take in this Client ID.
For example
@su-chang Given that you are the most recent author, could you response to this? Thank you. |
@kaihungc1993 thank you very much for the detailed investigation and the solution proposal! We will have a community meeting the day after tomorrow and I believe the @su-chang will be there, you are welcome to join and let’s add this issue to the discussion agenda! see: https://docs.google.com/document/u/0/d/1fVCk8qRYc4RKGMf2UY5HOe07hEhPUOpGC34v88GEFJg/mobilebasic |
@kaihungc1993 I hope you can resolve it using this approach. If you still have any questions or concerns about it, please feel free to let me know. Exampleimport MemoryCard from 'memory-card'
import { WechatyBuilder } from 'wechaty'
import PuppetWhatsapp from 'wechaty-puppet-whatsapp'
(async () => {
const MEMORY_SLOT = 'PUPPET_WHATSAPP_CLIENT_ID'
const puppet = new PuppetWhatsapp()
const memoryCard = new MemoryCard('wechaty')
await memoryCard.load()
const puppetMemoryCard = memoryCard.multiplex('puppet') // DO NOT CHANGE IT!
await puppetMemoryCard.set(MEMORY_SLOT, 'client-1') // user defined
const bot = WechatyBuilder.build({
puppet: puppet,
memory: memoryCard,
})
bot
// base event
.on('scan', (data) => {
console.log('data :>> ', JSON.stringify(data));
})
.on('login', (user) => {
console.log('user :>> ', JSON.stringify(user));
})
await bot.start()
})() Screenshot |
I have modified the code accordingly. It now shows the QR code image and allows me to scan it. However, the scan doesn't seem to be successful. Here's the error log:
Appreciate your help. |
@kaihungc1993 Please use
It seems that the version of |
Thank you. I'm able to support multi-user now. |
There's a scenario where in one Node.js process, we need to instantiate two Wechaty instances to support managing two Whatsapp accounts.
We know that Puppet Whatsapp will use
.wwebjs_auth
folder to store the session data. Have we tested this situation? Will it work or not?The text was updated successfully, but these errors were encountered: