|
1 | 1 | # whatsapp-tracking
|
2 | 2 |
|
| 3 | +Proof of concept about tracking contacts in WhatsApp. |
| 4 | +Check out my [blog entry](https://jorislacance.fr/blog/) for in-depth info. |
| 5 | + |
| 6 | +## architecture |
| 7 | + |
| 8 | +The POC is composed of: |
| 9 | + |
| 10 | +* The Node.js WhatsApp scraper robot - Gather the data |
| 11 | +* The InfluxDB 2.0 service - Store the data |
| 12 | +* The Grafana 6.7 service - Visualize the data |
| 13 | + |
3 | 14 | ## setup
|
4 | 15 |
|
5 | 16 | ```bash
|
6 |
| -npm install |
| 17 | +# run the InfluxDB and Grafana services |
| 18 | +docker-compose up -d |
| 19 | +``` |
| 20 | + |
| 21 | +### influxDB setup |
| 22 | + |
| 23 | +* Go to [https://localhost:9999](https://localhost:9999), setup an admin account |
| 24 | + * Name the initial organization like you want, `initial-org` for instance |
| 25 | + * Name the initial bucket anything, like `yolo`, we won't use the initial one because there will be sample data in it |
| 26 | +* Create a new bucket `whatsapp-tracking` |
| 27 | +* Generate a token `whatsapp-tracking-scraper` with write permission to `whatsapp-tracking` bucket |
| 28 | +* Generate a token `grafana` with 'all access' |
| 29 | + |
| 30 | +### grafana setup |
| 31 | + |
| 32 | +* Go to [https://localhost:3000](https://localhost:3000), setup an admin account |
| 33 | +* Add the data source using the plugin `Flux (InfluxDB) [BETA]` (for InfluxDB 2.0) |
| 34 | + * URL: `http://influxdb:9999` |
| 35 | + * with credentials: `true` |
| 36 | + * Organization: `initial-org` |
| 37 | + * Default Bucket: `whatsapp-tracking` |
| 38 | + * Token: the grafana token |
| 39 | +* Import the dashboard (file `grafana-dashboard.json`) |
| 40 | + |
| 41 | +### scraper setup |
| 42 | + |
| 43 | +Create a file `.env` in the root directory to setup your environment. |
| 44 | + |
| 45 | +```text |
| 46 | +CONTACT_TARGET=YourContactName |
| 47 | +INFLUXDB_TOKEN=The whatsapp-tracking-scraper token |
| 48 | +INFLUXDB_ORG=initial-org |
| 49 | +INFLUXDB_BUCKET=whatsapp-tracking |
7 | 50 | ```
|
8 | 51 |
|
9 |
| -## usage |
| 52 | +## scraper usage |
10 | 53 |
|
11 | 54 | ```bash
|
| 55 | +# init the robot |
| 56 | +npm install |
| 57 | +# run the robot |
12 | 58 | node index.js
|
13 | 59 | ```
|
14 | 60 |
|
| 61 | +## limitation |
| 62 | + |
| 63 | +Not sure if the scraper runs on Linux... |
| 64 | + |
15 | 65 | ## todo
|
16 | 66 |
|
17 |
| -* Dockerize the scraper too ? Hardly with the peering procedure that require to scan QR code. |
| 67 | +* Update the link to portfolio blog entry |
| 68 | +* Add an image in this readme |
| 69 | +* Dockerize the scraper too ? Hardly with the peering procedure that requires us to scan the QR code. |
0 commit comments