List of users vs. SQL database of customers

Mr.Scully

New Member
Hi, I installed MailWizz a couple days ago and I'm still considering how to use it. I'm talking about the list of newsletter recipients. I have a SQL database of customers and this database is growing every day. Also there are duplicates in there (a customer can do multiple purchases so he appears in the database again and again). I would like all these customers (incl. the new ones) to appear in the list of newsletter recipients automatically (without having to sign in anywhere). What is the best way to do it? I can do CSV or SQL imports manually (for example every week) but that's not very comfortable. Also if he signs off from the newsletter in the meantime and I add him in the next import (because he made another purchase AFTER he signed off the newsletter), does the import script check for him in the signed-off recipients list or would it add him again?

Can you advise what's the best way how to solve this? It's easy to do one-off imports but I need something automated that I wouldn't have to do manually every week or so. Also I don't know if the import does or doesn't add users who have already signed off in the meantime...
 

twisted1919

Administrator
Staff member
Hey,

The importer will check for duplicates, so you won't have same email address twice.
Secondly, in order to automate this use case of yours, the key is to use the API, (see: https://github.com/twisted1919/mailwizz-php-sdk)
You can set it up so that after a new customer is added in your database via whatever system you use, to use this api and send it to mailwizz too, or, you can have a cron job to run once at X hours and check your database of subscribers that have been added in last X hours and then send them to mailwizz one by one. Eitherway you do, using the API is the solution.

Thanks.
 

Mr.Scully

New Member
Brilliant, thank you - I have probably overlooked the API tutorial download link. Now I'm browsing it and reading the examples. It's really good that the customers are kept in the list even though their status is "unsubscribed" - because duplicates are avoided this way.

The "adding subscriber" example says "the confirmation email will be sent!!!" - is there any way or attribute to add a subscriber without sending an email to him? I want to avoid all kinds of confirmation emails. The customers will be added automatically (an unsubscribe option will be in the footer of each newsletter) and I don't want to send him any confirmation emails at all.

[edit] Or perhaps the confirmation email is not sent if the list of subscribers is in the single opt-in mode? I thought I'd better ask before I launch a script that adds 2000 subscribers via this API :)
 
Last edited:

twisted1919

Administrator
Staff member
Or perhaps the confirmation email is not sent if the list of subscribers is in the single opt-in mode? I thought I'd better ask before I launch a script that adds 2000 subscribers via this API
Yes, you are totally right, no email is sent when single opt in because there's nothing to confirm.
 

Mr.Scully

New Member
I will continue in my thread because my next question is related to my original question :) I'm currently using the API to add, delete or list subscribers. But there's one thing I can't find - how to tell whether the user is or isn't subscribed to a list? I can use the emailSearch() or getSubscriber() classes to find a particular subscriber but it returns "success" (and the subscriber's ID) if the user IS in the list - but it doesn't say anything about whether he is or isn't subscribed at the moment. Is there any way how to find that out? Some kind of attribute in the response?

(The reason I'm asking about that is that I want people to subscribe/unsubscribe in a special section on my website - so I must be able to tell them whether they are subscribed or not at the moment :)
 

twisted1919

Administrator
Staff member
@Mr.Scully - makes sense, could you unzip attached and put the php file inside apps/api/controllers folder to override the old one?
It should now also make the api calls return the status of the subscriber.
 

Attachments

  • List_subscribersController.php.zip
    5.2 KB · Views: 9

Mr.Scully

New Member
Man, you're brilliant, thank you for the quick response :) Speaking of the status, can I also update his status via API? I mean can I update user's status from "unsubscribed" to "subscribed"? Because if I try to add him, it won't do anything (duplicate) and updating seems to work only for his personal data, not for the status itself?
 

twisted1919

Administrator
Staff member
Changing status directly might have other implications because the subscriber has to explicitly subscribe in your list by confirming.
You could add a new endpoint in the API to do this, should be simple enough given the examples you have.
 
Top