https://github.com/arbisyarifudin/wwebjs-aws-s3
A remote authentication plugin for whatsapp-web.js. Use the AWS S3 to keep your WhatsApp MultiDevice session data safe and secure.
https://github.com/arbisyarifudin/wwebjs-aws-s3
aws aws-s3 whatsapp whatsapp-web-js
Last synced: 6 months ago
JSON representation
A remote authentication plugin for whatsapp-web.js. Use the AWS S3 to keep your WhatsApp MultiDevice session data safe and secure.
- Host: GitHub
- URL: https://github.com/arbisyarifudin/wwebjs-aws-s3
- Owner: arbisyarifudin
- License: mit
- Created: 2023-07-12T20:22:23.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T20:32:30.000Z (11 months ago)
- Last Synced: 2024-09-28T11:35:14.313Z (8 months ago)
- Topics: aws, aws-s3, whatsapp, whatsapp-web-js
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 3
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wwebjs-aws-s3
A remote authentication plugin for [whatsapp-web.js](https://wwebjs.dev/). Use the AWS S3 to keep your WhatsApp MultiDevice session data safe and secure. [](https://badge.fury.io/js/wwebjs-aws-s3)
[](https://npm-stat.com/charts.html?package=wwebjs-aws-s3)
## Quick Links
* [Whatsapp-web JS](https://wwebjs.dev/guide/authentication.html)
* [GitHub](https://github.com/arbisyarifudin/wwebjs-aws-s3)
* [npm](https://www.npmjs.com/package/wwebjs-aws-s3)## Installation
The module is now available on npm! `npm i wwebjs-aws-s3`
## DEBUG mode
To see detailed logs about object health, set the environment variable STORE_DEBUG to "true".
```bash
# linux
$ export STORE_DEBUG=true# windows
$ SET STORE_DEBUG=true
```## Example usage
```js
const { AwsS3Store, S3Client } = require('../src/AwsS3Store');
const { Client, RemoteAuth } = require('whatsapp-web.js');
const qrcode = require('qrcode-terminal');const s3 = new S3Client({
region: 'AWS_REGION',
credentials: {
accessKeyId: 'AWS_ACCESS_KEY_ID',
secretAccessKey: 'AWS_SECRET_ACCESS_KEY'
},
httpOptions: {
timeout: 600000, // 10 minutes <-- increase this value for large file uploads
},
});const store = new AwsS3Store({
bucketName: 'example-bucket',
remoteDataPath: 'example/dir',
s3Client: s3
});const client = new Client({
authStrategy: new RemoteAuth({
clientId: 'yourSessionName',
dataPath: './.wwebjs_auth',
store: store,
backupSyncIntervalMs: 600000 // in milliseconds (10 minutes) <-- decrease this value if you want to test the backup feature
})
});client.on('qr', (qr) => {
// Generate and scan this code with your phone
console.log('QR RECEIVED', qr);
qrcode.generate(qr, { small: true });
});client.on('ready', () => {
console.log('Client is ready!');// trigger whatsapp client is started and ready
});client.on('message', msg => {
if (msg.body == '!ping') {
msg.reply('pong');
}
});// it will done early (so use event 'ready' listener to know when the whatsapp client is ready & started)
client.initialize();
```## Delete Remote Session
How to force delete a specific remote session on the Database:
```js
await store.delete({session: 'yourSessionName'});
```