API » Connecting With Contact Forms

Connecting The API With Your Contact Form

Not all contact entry forms and databases are the same. The Copy2Contact API returns various convenience elements to assist you in directly connecting its output to your application.

Names

The Copy2Contact API separates a person's name into first, middle, and last. However, many forms and databases support only the first and last name, or the first, last, and middle initial. The API provides these convenience elements that should fit the needs of any target form or database:

ContactFirstMiddleLast - The contact's first, middle, and last names together, separated by spaces, e.g. "John Adam Smith".
ContactFirstLast - The contact's first and last name together, separated by a space, e.g. "John Smith".
ContactFirstMiddle - The contact's first and middle name together, separated by a space, e.g. "John Adam".
ContactMiddleInitial - The contact's middle initial, if a middle name is present, e.g. "A".
ContactLastFirstMiddle - The contact's last name, first name, and middle name, e.g. "Smith, John Adam".
ContactLastFirst - The contact's last name, a comma, and first name, e.g. "Smith, John".

So for example, if your form only includes a first and last name, you may choose to use either the ContactFirst or ContactFirstMiddle elements for the first name, and the ContactName element for the last name.

Addresses

The Copy2Contact API includes all street address information in the single ContactAddress element. However, many forms and databases have a separate field for address line 1, line 2, etc. The API provides these convenience elements that should fit the needs of such forms and databases:

ContactAddress1 - The first line of the ContactAddress element if it contains more than one line.
ContactAddress2 - The second line of the ContactAddress element if it contains more than one line.
ContactAddress3 - The third line of the ContactAddress element if it contains more than one line.
ContactAddress4 - The fourth line of the ContactAddress element if it contains more than one line.

Phone Numbers

The Copy2Contact API finds all phone numbers tagged with an identifier (e.g. "Office:") as well as untagged numbers. However, many forms and databases contain a simplified set of phone fields instead of providing a field for each type. The API provides these convenience elements that should address any configuration:

ContactPhone1 - A convenience element for forms with only a generic "Phone" field. By default, this element will contain the data from the first element in this list that is not blank: ContactUnIdPhone1, ContactWork, ContactMobile, ContactHome.
ContactPhone2 - A convenience element for forms with only a generic "Phone" field. By default, this element will contain the data from the first element in this list that is not blank: ContactUnIdPhone2, ContactWork, ContactMobile, ContactHome.
ContactPhone3 - A convenience element for forms with only a generic "Phone" field. By default, this element will contain the data from the first element in this list that is not blank: ContactUnIdPhone3, ContactWork, ContactMobile, ContactHome.
ContactPhone4 - A convenience element for forms with only a generic "Phone" field. By default, this element will contain the data from the first element in this list that is not blank: ContactWork, ContactMobile, ContactHome, ContactFax.

The above elements can be configured by using the following optional parameters in the call to ParseContact:

phone1Sources - Comma-separated list of source fields for ContactPhone1 convenience element.
phone2Sources - Comma-separated list of source fields for ContactPhone2 convenience element.
phone3Sources - Comma-separated list of source fields for ContactPhone3 convenience element.
phone4Sources - Comma-separated list of source fields for ContactPhone4 convenience element.

See the examples below for two common types of forms. The solutions might not be obvious!

Examples

Phone Form1. Like most contact forms, if your form requires a phone number without being specific as to the type of phone, use the ContactPhone1 element to populate this field. This will assure that an untagged phone number in the parsed data is put into the field. If no untagged number is present, any phone tagged as "Office:" (or similar) will be used, and so on.

Phone Form2. If your contact form requires an office phone number, simply connecting that field with the ContactWork element returned from the API might not be the best way to go. If the parsed contact information includes an untagged phone but no phone tagged "Office:" (or similar), then the untagged phone will not appear in the ContactWork element and will not be placed into your form.

In this case, use the ContactPhone1 element to populate your office phone field and set the phone1Sources parameter to "ContactWork,ContactUnIdPhone1".

 

Newsletter
Signup