The project is created in educational purposes during my Go learning path.
Idea
The idea is to have a telegram bot that will notify you when your ELS order has new status.
Why
Before the creation of this bot you needed to visit the page with the tracking number of your order and then copy-paste the tracking at ELS site. Now you need to visit the page once and copy-paste the order's tracking number to the bot. From that moment you don't have to do more actions. You will be notified as soon as the status of your order will be changed.
How to use
Find @ElsGoBot in telegram. Add and type /start
.

Inline /add_tracking
To add a tracking you also can type /add_tracking -v="YOUR_TRACKING_NUMBER" -n="ORDER_NAME"
. Don't forget to wrap the values in quotemarks("YOUR_TRACKING_NUMBER"
)!

Updates
As soon as your added order has new status you will be notified immediately.

Local development
Create .env file looking at .env.example
Create DB container:
docker-compose up -d
Install goose.
Run migrations:
goose -dir migrations/postgresql postgres "Here is your DB url" up
Finally, start the bot:
go run ./cmd/run_bot/main.go
Deployment
Bot is ready to be deployed on Heroku.
Add PostgreSQL, set Heroku env vars according to .env.example and push.
IMPORTANT: If you need to receive notifications automatically on Heroku, you have to set up a periodic job check_updates. I've made it using Heroku Scheduler
Don't forget to set USE_WEBHOOK=true
for production.
TODO
- Improve logging
- Add tests
- Add Makefile
- Add Dockerfile
License
MIT License
Copyright (c) 2018 Teimur Gasanov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.