2020-05-12 23:40:49 +02:00
< h1 align = "center" > Welcome to trackmyd-bot 🗺️< / h1 >
< p >
< a href = "https://github.com/franjsco/trackmyd-bot/graphs/commit-activity" target = "_blank" >
< img alt = "Maintenance" src = "https://img.shields.io/badge/Maintained%3F-yes-green.svg" / >
< / a >
< a href = "https://github.com/franjsco/trackmyd-bot/blob/master/LICENSE" target = "_blank" >
< img alt = "License: GPL--3.0--or--later" src = "https://img.shields.io/github/license/franjsco/trackmyd-bot" / >
< / a >
< a href = "https://twitter.com/franjsco" target = "_blank" >
< img alt = "Twitter: franjsco" src = "https://img.shields.io/twitter/follow/franjsco.svg?style=social" / >
< / a >
< / p >
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
> A telegram bot to track your devices.
2019-03-04 16:40:53 +01:00
2019-03-04 17:03:00 +01:00
2020-05-12 23:40:49 +02:00

2019-03-04 17:15:58 +01:00
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
## Install
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
Steps:
1. Install **Node.js** and **npm** .
2. Clone this repository.
3. Install dependencies with `npm install` .
4. Create a new bot with ** @BotFather ** on Telegram.
5. Enter the **token** generated by BotFather in (app.token) into `config.json` .
6. Enter your **Telegram ID** in (app.authorizedUsers) into `config.json` .
7. Configure Basic Authentication in (app.api.headers) into `config.json` .
8. Configure API endpoint(*).
### Architecture
(*) **trackmyd-bot** uses the [**trackmyd-api** ](https://github.com/franjsco/trackmyd-api ) project APIs to get device locations.
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
To configure the server API, refer to the [**trackmyd-api** ](https://github.com/franjsco/trackmyd-api ) repository.
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
In order to use trackmyd-bot, in addiction to the configuration of the trackmyd-api, it’ s also necessary to configure [**GPSLogger** ](https://github.com/mendhak/gpslogger ).
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
< img align = "center" src = "architecture.jpg" height = "200px" >
2019-03-04 16:40:53 +01:00
## Usage
2020-05-12 23:40:49 +02:00
Start server:
```sh
npm run start
```
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
### Steps
2019-03-04 16:40:53 +01:00
Before requesting the position to the bot you need to add a new device and configure it.
2020-05-12 23:40:49 +02:00
1. **Add a new device (on Bot).**
2019-03-04 16:40:53 +01:00
2019-03-05 16:04:38 +01:00
Send the `/add` command to the bot. You will be prompted to add the device name.
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
2. **Configure GPSLogger (on Android).**
2019-03-04 16:40:53 +01:00
2019-03-04 17:08:13 +01:00
Once confirmed the device name, the bot will return 3 messages:
- URL (full-path including the device ID)
- HEADER (HTTP header, used for authentication to APIs)
- BODY (HTTP body with the parameters that will be automatically evaluated by GPSLogger).
2019-03-04 16:40:53 +01:00
2019-03-05 16:04:38 +01:00
Take the values and insert them in the GPSLogger app under "Logging details > Log to custom URL" specifying HTTP Method = 'PATCH'.
2019-03-04 16:40:53 +01:00
2019-03-05 16:04:38 +01:00
Then press "Start Logging" on GPSLogger.
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
3. **Request the position (on Bot)**
2019-03-04 16:40:53 +01:00
Send the `/position` command to the bot and select the device. If the device (with GPSLogger) has sent the information to the API, 2 messages will be returned (one with the location on the map, and one with additional information).
2020-05-12 23:40:49 +02:00
## Author
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
👤 **franjsco (Francesco Esposito)**
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
* Website: https://franjsco.github.io/
* Twitter: [@franjsco ](https://twitter.com/franjsco )
* Github: [@franjsco ](https://github.com/franjsco )
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
## Show your support
Give a ⭐️ if this project helped you!
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
## 📝 License
2019-03-04 16:40:53 +01:00
2020-05-12 23:40:49 +02:00
Copyright © 2020 [franjsco (Francesco Esposito) ](https://github.com/franjsco ).< br />
This project is [GPL--3.0--or--later ](https://github.com/franjsco/trackmyd-bot/blob/master/LICENSE ) licensed.
2019-03-05 17:02:57 +01:00
2020-05-12 23:40:49 +02:00
***
_This README was generated with ❤️ by [readme-md-generator ](https://github.com/kefranabg/readme-md-generator )_