Subscribers from external database

Hi,
I would like to setup a script to update (or insert) users from an external database every night.
Is there some phplist command/component already prepared to accomplish that task?
If not, would be safe to just write to phplist user/attributes tables?

Thank you
Alex

@alex.zambonin you can run the phplist import2 page from the command line using the Subscribers plugin, see plugin:subscribers [phpList Resources]

You would need to construct a csv file with fields for the email address and each attribute.

Thank you Duncan,
I’ll give it a shot.

It seems that, if the email field is blank, the user is imported with blank email, and not with “invalid mail [n]” text, like the gui process.
Is it by design?

Subscribers Plugin version: 2.37.0+20230912
Phplist version: 3.6.14

@alex.zambonin You should probably use the phplist page to import a file instead. When I replied to your post I couldn’t remember the syntax but it is very similar

php /path/to/phplist/admin/index.php -p import -f /path/to/file.csv -l 1

The -c parameter is needed only if the config.php file is not in the default location

Thank you Duncan, it worked.
But wouldn’t be possibile to accomplish the same task through the APIs?

If yes, how can I enable the APIs? I mean: following these instructions I cannot find the config_modules.yml file on production environment.
I have it in my local environment and it says: # This file is autogenerated. Please do not edit, so I don’t understand what to do exactly.

Thank you
Alex

@alex.zambonin Yes that is the file to edit, despite the warning. But the API was broken in release 3.6.10 and I don’t think it has been fixed, see API broken in release 3.6.10 · Issue #906 · phpList/phplist3 · GitHub

The REST API plugin is probably going to be simpler to use if you want to use an API, see plugin:restapi [phpList Resources]