Your software
My Mautic version is: 2.15.x
My PHP version is: PHP Version 7.2.24-0ubuntu0.18.04.1
Your problem
My problem is:
I would like to import a list of DONOTCONTACT into my Mautic using a cronjob.
My file would contain two columns: “email”, “DONOTCONTACT”
I am already using mautic-custom-import-bundle to import my system info into Mautic, so cannot use this as well.
Thanks for the reply. Let me try and explain myself a bit better.
I am running multiple instances of Mautic and would like to centralise my DONOTCONTACT list automatically.
So what I have done is write a small bash script triggered by a cronjob, so each day the script connects to Mautic mysql, extracts the DONOTCONTACT from the table lead_donotcontact and saves this into a file. I then run a sftp cronjob to transfer this from my different Mautic instances to a central instance, and on this central instance (example Mautic1) I want to automatically import these contacts and flag them as DONOTCONTACT.
Now as I have mentioned there is a plugin that does this for you, however I am already using this plugin to automatically import data from my program platform into Mautic, and the limitations on this plugin is you can only have one type of mapping.
So my question is - is there a way to automatically import a file (csv) from the command line into Mautic, do I have to setup mapping ?
I then put this file in /var/www/mautic/app/cache/import/
and then ran the following two cronjob:
sudo php /var/www/mautic/app/console mautic:import:directory
sudo php /var/www/mautic/app/console mautic:import
The result was 1 inserted and 1 ignored, and then it added a records in contacts
Name = test1@gmail.com True and nothing else.
It did not merge the contacts and add the DNC flag to it.
I downloaded the 1.0.4 release, extracted it, renamed it and placed it in the /apps/plugins/ directory. I deleted the cache, configured the CustomImport features section and enabled the plugin.
I put a test.csv file with a dummy contact in /apps/cache/imports/.
I ran php7.2 console mautic:import:directory and php7.2 console mautic:import.
Thanks for the reply however I think you might have missed my initial post. I already use Mautic-custom-import-bundle:
" I am already using mautic-custom-import-bundle to import my system info into Mautic, so cannot use this as well."
This works great and I use it to bring in platform information into Mautic.
I am looking for an alternative method to import WITHOUT using the custom-bundle, as the limitation of custom bundle is that you can only use one template file.
Thanks for the help. I still am unable to get it to work
I have done exactly what you are explaining and still on the update all I am getting is under name the email and (1/0/TRUE). It is not updating the specific record, rather just adding a new one.
Feeling a little dumb at the moment as I am sure I am missing something so small.
I had a look at your screenshot and wonder what the results were in Mautic as the output of the results says: “2 lines were processed, 1 items created, 0 items updated, 1 items ignored in 0.142 s”. which makes me wonder if you get the same results I am seeing.
The actual import command works, but even on yours it created a NEW record and did not update any existing records.