Direct import allows you to programmatically import contacts contained in a .csv file into the platform by posting a form with various parameters. To synchronize contact information in Bronto using the Direct Import feature on a daily basis, follow the steps below:
1. Create custom fields in Bronto
2. Write CURL command
3. Install CURL on client server, if it’s not already installed
4. Set up the crontab on client server
5. Match file header to Bronto’s fields, and schedule daily data dump from client database
Create Custom Fields in Bronto
Under Contacts -> Fields -> Create New Field:
- Add fields that will be used to collect the information about your contact such as first name, last name, address, zip, etc.
- Make sure to remember the column names you assign. They will be used as the header of the files you will import. Mapping column names and file headers to import is detailed in section 5 below.
You can also create new fields by calling addFields.
Write a CURL Command
To be able to import data into Bronto though the Direct Import feature, you will need to get the URL, site_id, user_id and key associated with your account in Bronto.
Log in your Bronto account
- Go to Home -> Settings -> Data Exchange
- Scroll down to the Direct Import section
- Make note of the URL and parameters displayed. This information will be needed in order for direct import to work properly.
The CURL command will look like this:
curl -v -F 'source="Daily direct import"' -F 'firstname.lastname@example.org' –F 'site_id=your_site_id' -F 'user_id=your_user_id' -F 'key=your_key' –F 'action=addupdate' -F 'format=csv' -F 'email@example.com' -F 'listname=directimport_list' http://app.bronto.com/mail/subscriber_upload/index/
The email and the list name are optional. The email address is where the confirmation report will be sent. The list name is the name of the list to add the contacts to. If the list name does not exist, it will be created.
CURL Command On Your Server
CURL is a command line tool for getting or sending files using URL syntax. Install CURL on your server if it is not already installed.
Determine how often the data will be uploaded, and set up the crontab to run the CURL command. For example, if you wish to run the Direct Import daily at 7:30am, the crontab will look like this:
30 7 * * * root /usr/bin/curl -v -F 'source="Daily direct import"' -F 'firstname.lastname@example.org' –F 'site_id=[your site id]' -F 'user_id=[your user id]’ –F 'action=addupdate' -F 'key=[enter your key]'-F 'format=csv' -F 'email@example.com' -F 'listname=directimport_list' http://app.bronto.com/mail/subscriber_upload/index/ > /home/logs/cronlogs/evanity_cron.log
Match the headers in the file you want to import to the field names in Bronto and schedule daily file dump from client database The Direct Import will automatically match the file headers to import with Bronto’s field names. When scheduling the daily export from your database, make sure the column headers match Bronto’s field NAMES (not labels).