app icon indicating copy to clipboard operation
app copied to clipboard

Can HTTP webhook with email body and attachment payloads be sent out by simple-login?

Open gc-ss opened this issue 3 years ago • 6 comments

Does simple-login currently have a mechanism to fire off a:

  1. HTTP GET webhook
  2. GraphQL/HTTP POST webhook
  3. with email body
  4. with attachment payloads

… when an email arrives?

A similar question was asked here https://github.com/simple-login/app/issues/98#issuecomment-595311277 but if I missed any details, please, let me know

gc-ss avatar May 15 '22 15:05 gc-ss

There are no HTTP webhooks afaik but as SimpleLogin's main feature is email forwarding... that's basically like an SMTP hook. You could run Postfix on another server and configure it to your liking, so you could process all incoming email automatically. You could probably even use the same dev stack as you would also use with HTTP hooks just with some minor adaptions.

salixh5 avatar May 17 '22 10:05 salixh5

There are no HTTP webhooks afaik

If I wanted to add webhooks into SimpleLogin - where in the source should I start looking?

To be clear, I want the email received by the SimpleLogin SMTP server to be forwarded over Webhooks instead over the regular email flow.

gc-ss avatar May 17 '22 12:05 gc-ss

Oh you want to run SimpleLogin by yourself, I thought you want to use the official hosted version and therefore need something like a webhook. In that case, instead of modifying SimpleLogin, it might be easier to just have a Postfix instance accepting email and then process incoming mail through a custom script.

But in any case a lot of the magic happens here: https://github.com/simple-login/app/blob/master/email_handler.py

This script receives the (internal) mails that are forwarded by the Postfix instance belonging to the SimpleLogin setup, and then processes them and sends them back. https://github.com/simple-login/app/blob/a224f4faa655c2a97d913d5d679d886001ce154a/email_handler.py#L1972 is kind of the entrypoint for a new message, and you can see from there.

salixh5 avatar May 17 '22 14:05 salixh5

instead of modifying SimpleLogin, it might be easier to just have a Postfix instance accepting email and then process incoming mail through a custom script.

The end result I'm hoping for is that SimpleLogin has a built in method to fire off webhooks and those webhooks can be configured via the UI. Until we get there, I have a question:

Is it possible to:

  1. Tell SimpleLogin NOT to process certain aliases - eg: [email protected]
  2. For these special aliases, another script processes the incoming emails (for now, this script is separate from SimpleLogin and just fires off the incoming email to an external server)
  3. This script reuses the same Postfix instance that SimpleLogin uses

?

If these are possible, I would be interested on how to proceed with 1, 3

gc-ss avatar May 17 '22 15:05 gc-ss

I would also love to see this feature.

nicoandmee avatar Aug 26 '22 06:08 nicoandmee