Contacts
View many or all contacts by including their ID's or various filters.
Table Specific Information
Select
The driver uses the ActiveCampaign API to process some of the filters.
For example, the following queries are processed server side:
SELECT * FROM Contacts WHERE Id = 10 SELECT * FROM Contacts WHERE Udate >= '2019-06-30T10:44:34-05:00' SELECT * FROM Contacts WHERE Udate <= '2021-06-30T10:44:34-05:00' SELECT * FROM Contacts WHERE Cdate >= '2019-06-30T10:44:34-05:00' AND Cdate <= '2021-06-30T10:44:34-05:00'
As a note, due to server-side performance issues, even when the property IncludeCustomFields is set to TRUE, the custom fields will appear only in the table schema with null values. To retrieve the values of the custom fields, please refer to the ContactCustomFieldData table.
Insert
Inserting a contact requires specifying the contact email.
INSERT INTO Contacts (Email) VALUES ('[email protected]') INSERT INTO Contacts (Email,FirstName,LastName,Phone) VALUES ('[email protected]','test','test','contactphonenumber')
Additionally, the driver supports inserting contact and contact custom fields data from the Contacts table. All custom field columns start with CF_.
INSERT INTO Contacts (Name,CF_Description,CF_Hidden,CF_Number) VALUES ('testcontact3','custom field value','custom field value',123)
Update
The driver supports updating contact information.
Additionally, it is possible to update contact custom fields data from the Contacts table.
UPDATE Contacts SET FirstName = 'updatedName' WHERE Id = 1 UPDATE Contacts SET CF_CustomField1 = 'custom field value', CF_CustomField2 = 'custom field value' WHERE Id = 1
Bulk Import Contacts
The driver supports uploading large numbers of contacts into your account. This operation includes:
- Creating new contacts
- Updating existing contacts
- Subscribing and unsubscribing from lists
Contacts are imported in batches of up to 250 items. The importer is not recommended to be used for a small number of contacts. You can import contacts as below:
INSERT INTO Contacts#Temp (Email) VALUES ('[email protected]') INSERT INTO Contacts#Temp (Email) VALUES ('[email protected]') UPSERT INTO Contacts (Email) SELECT Email FROM Contacts#Temp
Additionally, the driver supports BULK INSERT for the Contacts table. Please note this operation will cause a cost in performance as the driver validates if the submitted contacts exist before importing them.
INSERT INTO Contacts#Temp (Email) VALUES ('[email protected]') INSERT INTO Contacts#Temp (Email) VALUES ('[email protected]') INSERT INTO Contacts (Email) SELECT Email FROM Contacts#Temp
To subscribe and unsubscribe contacts from a specific list set a value for the SubscribeTo and/or UnsubcribeFrom columns which accept a comma-separated list of list ids. For example:
INSERT INTO Contacts#Temp (Email, SubscribeTo, UnsubcribeFrom) VALUES ('[email protected]','1,2','6,12') INSERT INTO Contacts#Temp (Email, SubscribeTo, UnsubcribeFrom) VALUES ('[email protected]','3,7','6,1') UPSERT INTO Contacts (Email, SubscribeTo, UnsubcribeFrom) SELECT Email, SubscribeTo, UnsubcribeFrom FROM Contacts#Temp
Contacts must meet all the following criteria in order to be created or updated with this API:
- The imported contacts may not exceed your account limit
- The contact must have an email address
- The contact's email address must not be on an exclusion list
- The contact's email must not be on a list of bounced email addresses
- The contact must not have unsubscribed to a list that the import would add them to
If contacts do not meet all of these requirements, they will be skipped by the importer.
Delete
Remove all contacts or a contact by specifying the Id of the contact.
DELETE FROM Contacts WHERE Id = 10003
Columns
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Id column of the Contacts table. |
Adate | Datetime | True |
The Adate column of the Contacts table. |
Anonymized | String | True |
The Anonymized column of the Contacts table. |
BouncedDate | String | True |
The BouncedDate column of the Contacts table. |
BouncedHard | String | True |
The BouncedHard column of the Contacts table. |
BouncedSoft | String | True |
The BouncedSoft column of the Contacts table. |
Cdate | Datetime | True |
The Cdate column of the Contacts table. |
CreatedBy | String | True |
The CreatedBy column of the Contacts table. |
CreatedTimestamp | Datetime | True |
The CreatedTimestamp column of the Contacts table. |
CreatedUtcTimestamp | Datetime | True |
The CreatedUtcTimestamp column of the Contacts table. |
Deleted | String | True |
The Deleted column of the Contacts table. |
DeletedAt | String | True |
The DeletedAt column of the Contacts table. |
Edate | Datetime | True |
The Edate column of the Contacts table. |
String | False |
The Email column of the Contacts table. | |
EmailDomain | String | True |
The EmailDomain column of the Contacts table. |
EmailEmpty | Boolean | True |
The EmailEmpty column of the Contacts table. |
EmailLocal | String | True |
The EmailLocal column of the Contacts table. |
FirstName | String | False |
The FirstName column of the Contacts table. |
Gravatar | String | True |
The Gravatar column of the Contacts table. |
Hash | String | True |
The Hash column of the Contacts table. |
Ip | String | True |
The Ip column of the Contacts table. |
LastName | String | False |
The LastName column of the Contacts table. |
AccountContactsLink | String | True |
The AccountContactsLink column of the Contacts table. |
AutomationEntryCountsLink | String | True |
The AutomationEntryCountsLink column of the Contacts table. |
BounceLogsLink | String | True |
The BounceLogsLink column of the Contacts table. |
ContactAutomationsLink | String | True |
The ContactAutomationsLink column of the Contacts table. |
ContactDataLink | String | True |
The ContactDataLink column of the Contacts table. |
ContactDealsLink | String | True |
The ContactDealsLink column of the Contacts table. |
ContactGoalsLink | String | True |
The ContactGoalsLink column of the Contacts table. |
ContactListsLink | String | True |
The ContactListsLink column of the Contacts table. |
ContactLogsLink | String | True |
The ContactLogsLink column of the Contacts table. |
ContactTagsLink | String | True |
The ContactTagsLink column of the Contacts table. |
DealsLink | String | True |
The DealsLink column of the Contacts table. |
FieldValuesLink | String | True |
The FieldValuesLink column of the Contacts table. |
GeoIpsLink | String | True |
The GeoIpsLink column of the Contacts table. |
NotesLink | String | True |
The NotesLink column of the Contacts table. |
OrganizationLink | String | True |
The OrganizationLink column of the Contacts table. |
PlusAppendLink | String | True |
The PlusAppendLink column of the Contacts table. |
ScoreValuesLink | String | True |
The ScoreValuesLink column of the Contacts table. |
TrackingLogsLink | String | True |
The TrackingLogsLink column of the Contacts table. |
Organization | String | True |
The Organization column of the Contacts table. |
Orgname | String | True |
The Orgname column of the Contacts table. |
Phone | String | False |
The Phone column of the Contacts table. |
RatingTStamp | String | True |
The RatingTStamp column of the Contacts table. |
SegmentioId | String | True |
The SegmentioId column of the Contacts table. |
Sentcnt | String | True |
The Sentcnt column of the Contacts table. |
SocialdataLastcheck | String | True |
The SocialdataLastcheck column of the Contacts table. |
Ua | String | True |
The Ua column of the Contacts table. |
Udate | Datetime | True |
The Udate column of the Contacts table. |
UpdatedTimestamp | String | True |
The UpdatedTimestamp column of the Contacts table. |
Updated_by | String | True |
The Updated_by column of the Contacts table. |
SubscribeTo | String | False |
Comma-separated list of list Ids to subscribe a contact to. |
UnsubscribeFrom | String | False |
Comma-separated list of list Ids to unsubscribe a contact from. |