Help articles

 

How to Use Database Sync

ActiveCampaign’s email marketing software allows you to add contacts in to your system through several different methods. One of these methods is through a feature called Database Sync.

Database Sync allows you to directly connect to an external database to automatically import contacts in to your account. Many users wish to import contacts directly from their pre-existing website database, billing system, CMS, or many other kinds of applications and databases. Our Database Sync feature allows you to connect to external MySQL databases, MSSQL databases, or PostgreSQL databases. Database Sync will connect to your external database, and using the criteria and conditions you supply, it will find contacts and import them in to your account, in to the contact list you choose.

Similar to the standard import feature, Database Sync will not import contacts who have unsubscribed or bounced in the past, and if it finds a pre-existing contact, that contact will be updated or skipped, depending on your preferences.

It is important to note that Database Sync is essentially an import function — it will never change any data in your external database, it will only select contacts from the external database and import them in to your account.

Now that you know a little bit about Database Sync, you can follow the instructions below to create a Database Sync in your email marketing account.

1. Create a New Database Sync

Log in to ActiveCampaign, and click on the Contacts tab. The Database Sync link will be on the Contacts page, on the right side of the page, under “Advanced Options.” Once you have located the Database Sync page, click the button that says “Add Sync.”

2. Database Info and Basic Configuration

This is the first step of the process. You will see options to name your sync (this will be the name you use to reference this sync later on), choose the type of database you are connecting to, and enter in your database connection details. You will also be able to choose which list in your account that you want to import these contacts in to, and what the contacts’ statuses should be.

If you import contacts as “Unsubscribed,” they will  not receive any emails from you in the future — they will be marked as having unsubscribed from that list. If you import contacts as “Unconfirmed,” they will receive a confirmation email asking them to confirm their subscription, and will not be added to the list until they click the confirmation link in that email. If you import contacts as “Excluded,” they will never be able to receive emails on that list in the future, nor will they be able to be added back to that  list in the future (unless you manually delete them from the Exclusion list).

If you are importing the contacts as “Active”, they will be a normal, active contact on your list, and will receive all campaigns sent to that list. You will also see some options pertaining to Autoresponders.

3. Choose database table

The next step of the process will connect to your database, and then show you a list of all of the tables in your database. Here you can choose the table which holds your contact details.

(NOTE: You will also notice that on the right, there is an option to add your own custom query. This is an advanced option that you can use if you already have a specific contact “SELECT” query in mind, which you want to use to select your contact information.)

4. Select Fields to Sync

The next step will show you a list of all of the fields/columns from the table you selected in your external database. These fields are shown on the left. On the right, you will see a drop-down menu next to each field. Using this drop-down menu, choose what each field from your external databases represents in your account. For example, if you have a field in your external database called “email,” which holds your contacts’ email addresses, make sure that that field is matched up to the “Email Address” option. If you have other data fields in your external database that you would like to import as well, such as First Name or Last Name, you can do so on this step as well. Any custom fields you have created in your account can be populated during Database Sync.

Please note that the only field that is required by default when syncing data using Database Sync is the “Email Address” field. If you have created other custom fields and marked them as “Required,” those fields will be required during Imports and Syncs as well.

Also, please note that you cannot match up more than one field in your external database to the same field in your account.

5. Rules and Configuration

The last step allows you to create “rules” for your Database Sync. Rules are an advanced, optional feature. You can use rules to add specific logic conditions to the sync. (If you are familiar with writing database queries, the rules are what will be added as the “WHERE” part in the SELECT query. If you have already used your own custom query previously, then you will not need to add rules here.)

For example, if you only want to import contacts from your external database where the ‘id’ column is greater than 1, or where ‘username’ is not left blank, etc, you would use the rules feature to accomplish this. You can add multiple rules to the same sync as well. In the image example below, a rule has been added saying “where username does not equal ‘test'” which basically means that the sync will import all contacts except ones where the username column in the external database equals the word “test.”

Again, sync rules are optional. Most users will not need to use this feature, and if no rules are added, then all of the contacts in the database table will be selected for the sync.

The last step of the sync process also allows you to choose specific importing options on the bottom of the page. These configuration options are exactly the same as what you would see on the Import Contacts page, except for the “Delete all items that are not affected by the sync each time the sync runs” option. If this option is enabled, all contacts who are present in your account, but not present in the external database, will be deleted. (Again, nothing will ever be changed or deleted from your external database.)

If the “Update existing contacts” setting is checked, then any contacts that already exist in your system, and are being synced again, will be updated with any new information they may have in your external database. For example, if you have a custom field that you are syncing called City, and a particular contact’s city has changed, that field will be updated. If the “Update existing contacts” box is not checked, any pre-existing contacts will be skipped during the sync. Duplicate contacts will not be added.

6. Save, Test, or Run the Sync

You’re done configuring your Database Sync. Now you can click “Add” to save the sync (choose this option if you plan on running it again or running it later), or “Test” if you’d like to see how many contacts will be synced or test the features before beginning, or simply click “Run” if you’re ready to start the sync right away.

If you click “Add” to save the sync, you can return to the main Database Sync page at any time to edit, delete, or run the sync directly.

When running the sync, a pop-up module will appear that will show you the database query that is being executed, along with a progress bar to monitor the progress of the sync.

When the sync is complete, you can click a link saying “View Report” to see a basic report of the sync. It will show you the number of contacts selected for the sync, how many were successfully synced, and how many failed. If any contacts failed to be imported, you will see a reason explaining why.

This image shows a completed sync:

This image shows a sync report, in which two of the contacts were not imported due to the ‘email’ field being left blank:

More questions?

For more information about any feature of ActiveCampaign’s email marketing software, please contact our support team. We’ll be happy to assist you.