-
Notifications
You must be signed in to change notification settings - Fork 65
/
example.js
59 lines (54 loc) · 2.15 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const wbm = require('./src/index');
(async () => {
await wbm.start({showBrowser: true}).then(async () => {
const phones = ['5535988841854', '35988841854', '5535988841854'];
const message = 'Good Morning.';
await wbm.send(phones, message);
await wbm.end();
}).catch(err => console.log(err));
// await wbm.start().then(async () => {
// const contacts = [
// { phone: '5535988841854', name: 'Bruno', age: 21 },
// { phone: '5535988841854', name: 'Will', age: 33 }
// ];
// const message = 'Hi {{name}}, your age is {{age}}';
// // Hi Bruno, your age is 21
// // Hi Will, your age is 33
// await wbm.send(contacts, message);
// await wbm.end();
// }).catch(err => console.log(err));
// await wbm.start().then(async () => {
// const contacts = [
// { phone: '5535988841854', name: 'Bruno', group: 'friend' },
// { phone: '5535988841854', name: 'Will', group: 'customer' }
// ];
// for (contact of contacts) {
// let message = 'hi';
// if (contact.group === 'customer') {
// message = 'Good morning ' + contact.name;
// }
// else if (contact.group === 'friend') {
// message = 'Hey ' + contact.name + '. Wassup?';
// }
// await wbm.sendTo(contact.phone, message);
// }
// await wbm.end();
// }).catch(err => console.log(err));
// await wbm.start().then(async () => {
// const contacts = [
// { phone: '5535988841854', name: 'Bruno' },
// { phone: '5535988841854', name: 'Will' }
// ];
// await wbm.send(contacts, 'Hey {{name}}');
// // Hey Bruno
// // Hey Will
// await wbm.end();
// }).catch(err => { console.log(err); });
// await wbm.start().then(async () => {
// await wbm.sendTo({ phone: '5535988841854', name: 'Bruno' }, 'Hey {{name}}');
// // send: Hey Bruno
// await wbm.sendTo('5535988841854', 'Hey man');
// // send: Hey man
// await wbm.end();
// });
})();