knadh / listmonk

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
https://listmonk.app
GNU Affero General Public License v3.0
15.41k stars 1.41k forks source link

Auto reply on subscription #206

Open rezaa1 opened 4 years ago

rezaa1 commented 4 years ago

Hi, Is there any way we can send custom email after someone subscribed to a list.

It can be a campaign which remain active and send email as soon as someone subscribe to a list.

jackdanielux commented 4 years ago

If they're added to an opt in list (via API) post subscription they'll automatically receive an opt in confirmation mail.

On Sun, 11 Oct 2020, 20:10 rezaa1, notifications@github.com wrote:

Hi, Is there any way we can send custom email after they subscribed to a list.

It can be a campaign which remain active and send email as soon as someone subscribe to a list.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/knadh/listmonk/issues/206, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARESAVAD2MOZNHBHG4L4NTDSKG7U7ANCNFSM4SLZ7S6A .

rezaa1 commented 4 years ago

Yes, but I can not customize the opt in message for each list. can I?

knadh commented 4 years ago

listmonk doesn't have auto-responses yet. Will explore this.

apkd commented 2 years ago

Dropping by to let you know that I'm also looking forward to this feature!

Specifically, ideally I'm hoping for an ability to set up a series of onboarding e-mails that new subscribers receive over a time period. For the reference, here's how it works in MailChimp.

An autoresponder is an email (or multiple emails in succession) that a user receives once they sign up to an email list or perform a certain action (such as purchasing a product). You set them up ahead of time, configure how much time should go by between each message, and then sit back and monitor your campaign’s performance.

josephfugata commented 2 years ago

Please. Looking forward to this as well

nkosi23 commented 2 years ago

I think the underlying need behind this feature is broader than just auto-reply but also probably conceptually simpler. What is needed is the ability to automatically send one or more specific campaigns to new subscribers added to a list. So maybe, every list could have an optional list of campaigns that would be automatically sent to new subscribers. The transactional message feature may make implementing this simpler.

Beyond welcome messages, applications may need to send both transactional and marketing messages to users at various parts of the customer journey. Using lists is great since a single subscriber can belong to multiple lists. These basic primitives are all we would need to cover all scenarios needed by our applications.

From that point, if the upcoming multi-user feature provides us a way to conveniently group campaigns and templates, this will make it easier to localize our applications (for example by creating users for translators only having read access to the reference English campaigns and templates, and read-write access to the templates of the languages they are covering). And at that point, we are able to use listmonk to cover all the marketing and transactional messaging needs of our applications.

Not trying to hijack the thread, I just wanted to contextualize this feature.

Edit: Actually for localization, we could simply run a separate instance of listmonk for every language. Translators would need to keep a separate tab open anyway to check the reference text to translate, so there is no need to add complexity to listmonk. Maybe LDAP authentication could be introduced to ease the management of separate instances but this is a whole different topic.

ccfiel commented 2 years ago

Any update on this?

ccfiel commented 2 years ago

Any work around?

knadh commented 2 years ago

Apologies for the delayed reply. There is no simple workaround for this unfortunately. A really clunky way would be to run a cron job every 10 mins that checks the subscription status + updated time of subscriptions in the subscriber_lists table and then triggers a transactional mail via the /api/tx API.

t3hmrman commented 2 years ago

Would the idea of adding a best-effort webhook firing at certain events (subscriber addition, cancellation, etc) be possible/likely to be merged if contributed?

I could see writing a sidecar to run alongside listmonk and watch the subscribers and make this change, but it would be much easier to write that sidecar if it was just a server waiting to receive a webhook as well!

knadh commented 2 years ago

This isn't trivial I feel:

t3hmrman commented 2 years ago

I definitely agree that it isn't trivial, but maybe a v1 could be?

If the internal protocol is quite minimal you might be able to get away with:

I think if the protocol is at least in place, then as retries and other stuff get added it can be migration-free for downstream users (as the complexity behind the Send() method increases))

I think at this point just being able to receive any webhook (on a good day, with happy DNS/HTTP servers, a stable network, etc) would be a good pareto improvement.

candidexmedia commented 1 year ago

@t3hmrman : have you (or anyone) found and successfully implemented a workaround?

There is some interest in this feature on Twitter: https://twitter.com/statsandr/status/1625172227153854466?s=20

t3hmrman commented 1 year ago

Nope I haven't found a work around, but I haven't made a PR either -- if anyone wants to contribute a possible v1 they're free to!

@knadh is an approach like the one above something that you'd be open to?

anaclumos commented 1 year ago

I would also like to know if this is possible!

Twix53791 commented 1 year ago

I confirm this feature is a must. I don't understand why it is so complicated to implement: the opt-in double option send actually emails automatically no? So why the opt-in simple process does not just follow the same process, sending an email (but a welcome email) and auto confirm the subscription behind?

knadh commented 1 year ago

@Twix53791 Auto-reply isn't complex but it isn't simple either. I just haven't had the time to prioritise it over other higher priority features yet, unfortunately.

ffabbr commented 1 year ago

Any updates on this? Can we help you somehow?

nielsmouthaan commented 1 year ago

Ooh, not having this unfortunately prevents me from using Listmonk. Other than that, it looks great. I need it to send a series of onboarding emails. Heck, also just one email will do. It could be as simple as setting a (non-expiring) campaign as a "welcome campaign" setting on a list. I'll watch this issue and switch immediately from MailerLite to this once this gets in.

knadh commented 1 year ago

@nielsmouthaan would transactional e-mails suit your usecase (if you're triggering onboarding e-mails via APIs).

peterjcarroll commented 1 year ago

If there was a way to receive a notification of a new subscriber via a webhook, that would be helpful. Then at least I could use one of the many no-code workflow tools out there to trigger a welcome email.

nielsmouthaan commented 1 year ago

Exactly. Transactional email isn't the issue. It's the triggering (of the subscriber being added) that lacks.

cloudroaminghub commented 11 months ago

mark, need this great feature

1avender commented 11 months ago

Apologies for the delayed reply. There is no simple workaround for this unfortunately. A really clunky way would be to run a cron job every 10 mins that checks the subscription status + updated time of subscriptions in the subscriber_lists table and then triggers a transactional mail via the /api/tx API.

is there any such kind of workaround?

cloudroaminghub commented 11 months ago

Apologies for the delayed reply. There is no simple workaround for this unfortunately. A really clunky way would be to run a cron job every 10 mins that checks the subscription status + updated time of subscriptions in the subscriber_lists table and then triggers a transactional mail via the /api/tx API.

is there any such kind of workaround?

Here is a simple workaround script in centos, should add a 10 minutes job to crontab

#!/bin/bash

# Get the current time and format it as ISO 8601
current_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

# Define a threshold (e.g., 10 minutes)
time_threshold=$(date -u -d "10 minutes ago" +"%Y-%m-%dT%H:%M:%SZ")

# Authentication credentials (replace with your own credentials)
tx_auth_credentials="username@password"

# Construct query parameters, including a check on created_at time range
query_params="page=1&per_page=100&query=subscribers.created_at%20>%20'$time_threshold'"

# Call the API to get the current list of subscribers
response=$(curl -u "$tx_auth_credentials" -X GET "http://localhost:9000/api/subscribers?$query_params")

# Use jq to parse the response
new_subscribers=$(echo $response | jq -r '.data.results[] | .email')

# Loop through new subscribers and send emails
for email in $new_subscribers
do
  # JSON data template
  json_data=$(cat <<EOF
{
    "subscriber_email": "$email",
    "template_id": 3,
    "data": {"order_id": "1234", "date": "2022-07-30", "items": [1, 2, 3]},
    "content_type": "html"
}
EOF
  )

  # Send the email
  curl -u "$tx_auth_credentials" "http://localhost:9000/api/tx" -X POST \
       -H 'Content-Type: application/json; charset=utf-8' \
       --data-binary "$json_data"
done
cloudroaminghub commented 11 months ago

put the temp solution here

poblabs commented 10 months ago

Any updates here? My use case is to send subscribers a discount coupon once they confirm their subscription. Having a 10 minute delay may be a turn off for some potential customers. I don't want to run a cron minutely either for the low volume. Having some sort of webhook, event, or maybe even MQTT pub/sub action trigger once a subscription is confirmed would be beneficial

ffabbr commented 10 months ago

I agree, having some sort of email automation is a must-have. It can be the most basic and developer-first approach; but still.

poblabs commented 10 months ago

@knadh Any consideration for this with your 3.0.0 release? #1699

Even if it's developer-forward, a way to automate new subscribers, and unsubscribers seems to be in high demand here.

joerosenthal commented 10 months ago

There's already a mechanism for sending an opt-in email—why not hijack that pathway to send a welcome email (an opt-in email with no opt-in button) and just mark the user as opted in automatically?

ghostdevv commented 10 months ago

I had to implement something like this for my clients site, for us it was to send a webhook to n8n so we can send a series of marketing emails after someone joins a list. (also had to do various other patches based on the /api/tx route to allow sending marketing emails without an attached campaign)

There's already a mechanism for sending an opt-in email—why not hijack that pathway to send a welcome email (an opt-in email with no opt-in button) and just mark the user as opted in automatically?

My implementation was based on this idea, but there are a few api endpoints which don't call this optin system so that's worth considering.

poblabs commented 10 months ago

This is interesting and I'd like to learn more. Currently I am experimenting with a python script that is monitoring nginx proxy logs and any POST to my list id is captured and the subscriber ID is extracted from the URL so it gets users info. Then it calls the /campaign/test api on a completed campaign attached to a 0 user list. With the payload body containing the email contents, template id, etc. A concern I have is the python script exiting without notice. So some way to get this from the core would be ideal. I have no Go experience which is why I was playing around with python

ghostdevv commented 10 months ago

@poblabs You can look at the code changes I made here, I also have no go experience so I stumbled my way through it xD

The webhook specific changes I made are:

I've added a README to explain the changes I made in my fork, feel free to use/change. I'll only be supporting this fork as far as fixing bugs for the features we need. I hope that either listmonk adds these features (or similar enough to be usable for us) or I can find a viable alternative.

candidexmedia commented 6 months ago

Related, for drip campaigns: https://github.com/knadh/listmonk/issues/815

witten commented 3 months ago

I've got yet another work-around for this issue:

To be clear, this approach has a bunch of downsides:

The upsides are:

I hope this is useful to someone! And I'll join the chorus of folks clamoring for welcome email functionality to be built into Listmonk.

witten commented 1 month ago

An update to the approach above. Here's what I'm doing now:

Yes, this is total hack town. But it works pretty well! The user subscribes to the list. Once they confirm, they get a call to action link to read the welcome content they get for subscribing. They click the link and it takes them to their user-specific "view in browser" page for the welcome campaign. Would I rather have built-in welcome email functionality? Hell yeah. But for now, this appears to work.

sspaeti commented 1 month ago

@witten This sounds amazing and not too hacky, I'd like to try it. Thanks for taking the time to write it up. Would you mind sharing the Listmonk sign-up website, where I can see how that feels (so I know if I should start hacking or search for a workaround with other solutions)?

witten commented 1 month ago

The newsletter sign-up flow starts here: https://danhelfmanbooks.com/newsletter/

I'd be happy to delete your account after you try it out. Or I suppose you can just unsubscribe.