Need help with automatic import of contact files

Your software
My Mautic version is: 3.0.2
My PHP version is: 7.3.20
I am using mautic/mautic:v3 docker image

Your problem
I am trying to create an automated pipeline for daily contact import however I cannot find API methods that I can use to achieve this.
mautic:import seems to only run queued background imports that are already created from the Web UI and in my case I do not want to create imports from Web UI. I want to import quite big amount of contacts every day, add new ones and update existing ones with custom fields used for segmentation so updating every single contact with separate request is also out of question.
I heard about MauticCustomImportBundle, however it seems broken on mautic 3.x.

Is there any way to achieve what I want in current version? I would really appreciate any help.

You can use the Bulk Create endpoint:
{{MauticDomain}}/api/contacts/batch/new

but that means that youll need to parse your file records to JSON array:
[{firstname:“Test”,lastname:“Testname1”,email:“test1@test.dk”},{firstname:“Test”,lastname:“Testname2”,email:“test2@test.dk”}];

1 Like

Thank you for reply.
Converting file to JSON does not seems problematic for me. I tried this API and everything worked flawlessly for a small data batch so far. I am not able to find that endpoint in documentation for some reason. Thank you for help!

1 Like

do you know if this would work if the data is hosted remotely?

There is a ecommerce add-on for Mautic 2.x that can import json hosted via a URL. We’re not sure if this is something custom or out of the box…

https://docs.mtcextendee.com/installation/import-items

Well, that cron in the example is definitely not out of the box. I suggest contacting the createor of that plugin @kuzmany