Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide function to add Tracking numbers remotely #8

Open
deg0nz opened this issue Jan 7, 2019 · 4 comments
Open

Provide function to add Tracking numbers remotely #8

deg0nz opened this issue Jan 7, 2019 · 4 comments

Comments

@deg0nz
Copy link

deg0nz commented Jan 7, 2019

It would be nice to have a function to remotely add Tracking numbers to this module.
For example by sending an email/notification/... to the mirror/module and then it adds the parcel automagically to the list.

I will think about a solution for this and try to implement it and send a PR if you'd like this as well.
(This could take some time since I'm currently writing my Master Thesis though)

@fewieden
Copy link
Owner

fewieden commented Jan 7, 2019

Sounds interesting

@deg0nz
Copy link
Author

deg0nz commented Jan 9, 2019

What do you think about email?

I was thinking about this a little bit and here's my proposal:

Email is the only thing that comes to my mind that has the most common usage and the least amount of caveats;

No service to make an account, no token, no fancy API to use and so on. Everybody has email and it is no problem to create a dedicated email address for this purpose i think. Just enter the imap credentials in the config and that should be it.
Additionally, you have no extra app to install on your smartphone or PC.

The only real problem that comes to my mind is Spam. But we can make an option that only accepts mails from specific email addresses and/or with a specific subject for processing (this won't stop anybody to add tracking numbers with a fake mail header, but let's be honest - if someone does this to spam your mirror, we are not talking about "usual" spam anymore...).

I was thinking about someting like this for the mail's content:

  • It should be possible to add/remove multiple tracking numbers.
  • One line of the mail has a structure like this: <command> <tracking number> <carrier>

Example:

From: [email protected] (accepted sender)
To: [email protected] (mail address of the mirror)
Subject: tracking numbers (subject accepted for changing tracking numbers)

add <TrackingNo1> dhl
add <TrackingNo2> landmark
remove <TrackingNo3> dhl
add <TrackingNo4> 17track

mail-listener sounds promising...

Additionally, currently used tracking numbers should be saved in a local file in the module's folder to survive a reboot of the mirror. Maybe a JSON file that has the same format as the tracking part in your config. We can then add this file name to the .gitignore.

If you are OK with this proposal, I will implement this and send a PR to you. :)

P.S. for additional stuff:

  • One could also provide some kind of IDs for every tracking entry and show them on the mirror to make deletion easier...
  • It would be nice to have an auto-delete function for mails that are added to the module (on the server)
  • It would be nice to have an auto-delete function for "delete every entry in the module after X days with status delivered"

@fewieden
Copy link
Owner

The idea itself is good, but this adds unnecessary complexity to this module and is not reusable for anything else.

According to me there should be another module e.g. notification forwarder. Which accepts input as you described before and then creates a specific notification and sends it to this module.

This could be ADD_TRACKING, REMOVE_TRACKING, those two notifications would need to be implemented then in shipment tracking.

The good part about this is that the logic of this module keeps kind of simple and the notification forwarder module can be extended to accept next to emails also http requests and other inputs. Also it can then be extended to parse other commands for other modules and in this way it is reusable.

@deg0nz
Copy link
Author

deg0nz commented Jan 11, 2019

Ok, that sounds fine for me. I'm going to make such a module.

We should then talk about the definition of the object that is transmitted via the notifications.
I'll come back to you when it's time for that :)

I created a placeholder-repository here:

https://github.com/deg0nz/MMM-ShipmentTrackingManager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants