Difference between revisions of "Marketing Endpoint"

From DreamFactory
Jump to: navigation, search
m (Payload)
m
Line 31: Line 31:
 
| -------- | ---- | ----------- |
 
| -------- | ---- | ----------- |
 
| `new_contact` | boolean | Contact is new |
 
| `new_contact` | boolean | Contact is new |
| delete_contact| boolean| Contact will be opted-out of all lists|
+
| `delete_contact` | boolean| Contact will be opted-out of all lists|
| welcome_registration| boolean| Was from an optional Welcome page|
+
| `welcome_registration`| boolean| Was from an optional Welcome page|
| welcome_skipped| boolean| Optional Welcome page was skipped|
+
| `welcome_skipped`| boolean| Optional Welcome page was skipped|
| registration_skipped | boolean | Registration was skipped|
+
| `registration_skipped` | boolean | Registration was skipped|
| name | string | User name/full name (not email) |
+
| `name` | string | User name/full name (not email) |
| first_name | string| First name |
+
| `first_name` | string| First name |
| last_name| string| Last name|
+
| `last_name`| string| Last name|
| email| string| Email address|
+
| `email`| string| Email address|
| phone_number| string| Phone number|
+
| `phone_number`| string| Phone number|
| company_name| string| Company name|
+
| `company_name`| string| Company name|
| title| string| Title|
+
| `title`| string| Title|
| address_1| string| Address 1|
+
| `address_1`| string| Address 1|
| address_2| string| Address 2|
+
| `address_2`| string| Address 2|
| city| string| City|
+
| `city`| string| City|
| state_province| string| State/Province|
+
| `state_province`| string| State/Province|
| zip_postal_code| string| Zip/Postal code|
+
| `zip_postal_code`| string| Zip/Postal code|
| installation_source| string| A string indicating the source of the installation (i.e. Bitnami, GitHub, etc.). See InstallTypes enum!|
+
| `installation_source`| string| A string indicating the source of the installation (i.e. Bitnami, GitHub, etc.). See **InstallTypes** enum!|
| client_cookie_hubspotutk| string| The client's client hubspotutk cookie, if any|
+
| `client_cookie_hubspotutk`| string| The client's client `hubspotutk` cookie, if any|
| client_remote_addr| string| The client's client $_SERVER['REMOTE_ADDR']|
+
| `client_remote_addr`| string| The client's client `$_SERVER['REMOTE_ADDR']`|
| client_request_uri| string| The client's client $_SERVER['REQUEST_URI']|
+
| `client_request_uri`| string| The client's client `$_SERVER['REQUEST_URI']`|
| client_referrer| string| The client's client $_SERVER['HTTP_REFERER']|
+
| `client_referrer`| string| The client's client `$_SERVER['HTTP_REFERER']`|
| created| string| Creation date|
+
| `created`| string| Creation date|
| last_login| string| Last login date|
+
| `last_login`| string| Last login date|
| timezone| integer| Time zone. Defaults to 0|
+
| `timezone`| integer| Time zone. Defaults to `0`|
  
 
The following properties are inferred by the payload and passed on to HubSpot:
 
The following properties are inferred by the payload and passed on to HubSpot:
Line 60: Line 60:
 
| Property | Type | Description |
 
| Property | Type | Description |
 
| -------- | ---- | ----------- |
 
| -------- | ---- | ----------- |
| mobile_lead | boolean | Calculated |
+
| `mobile_lead` | boolean | Calculated |
| local_installation | boolean | Calculated |
+
| `local_installation` | boolean | Calculated |
| local_installation_skipped | boolean | Calculated |
+
| `local_installation_skipped` | boolean | Calculated |
| website_lead_source | string | Calculated |
+
| `website_lead_source` | string | Calculated |
| hs_email_optout | string | Calculated |
+
| `hs_email_optout` | string | Calculated |

Revision as of 23:41, 23 September 2015

Configuration

In `common.config.php` there are a few configuration options. These are shown in the snippet below:

//*************************************************************************
//* Marketing
//*************************************************************************
'marketing.lead-endpoint'    => 'https://forms.hubspot.com/uploads/form/v2/247169/d48b5b8e-2274-488b-9448-156965d38048',
'marketing.blacklist'        => array('[email protected]', '[email protected]', '[email protected]',),
/** Installation sources */
'marketing.install-sources'  => array(
    /**
     * Format: [ "<hubspot_id>" => "<pattern>", ... ]
     * Pattern is used in stripos comparison of "installation_source" and/or "client_referrer"
     */
    'bitnami'       => 'bitnami',
    'standalone'    => 'standalone',
    'deb'           => 'deb',
    'rpm'           => 'rpm',
    'html5landing'  => '/html5landing',
    'nativelanding' => '/nativelanding',
),

The options are used to control where on HubSpot the contact is posted and which emails to exclude. There is an additional *install source* translation that is attempted via pattern matching. The patterns to match, and their associated `installation_source` value are in the `install-sources` config array.

Payload

Set your content type to `application/json` and POST your payload. The following properties are allowed/used in your payload:

| Property | Type | Description | | -------- | ---- | ----------- | | `new_contact` | boolean | Contact is new | | `delete_contact` | boolean| Contact will be opted-out of all lists| | `welcome_registration`| boolean| Was from an optional Welcome page| | `welcome_skipped`| boolean| Optional Welcome page was skipped| | `registration_skipped` | boolean | Registration was skipped| | `name` | string | User name/full name (not email) | | `first_name` | string| First name | | `last_name`| string| Last name| | `email`| string| Email address| | `phone_number`| string| Phone number| | `company_name`| string| Company name| | `title`| string| Title| | `address_1`| string| Address 1| | `address_2`| string| Address 2| | `city`| string| City| | `state_province`| string| State/Province| | `zip_postal_code`| string| Zip/Postal code| | `installation_source`| string| A string indicating the source of the installation (i.e. Bitnami, GitHub, etc.). See **InstallTypes** enum!| | `client_cookie_hubspotutk`| string| The client's client `hubspotutk` cookie, if any| | `client_remote_addr`| string| The client's client `$_SERVER['REMOTE_ADDR']`| | `client_request_uri`| string| The client's client `$_SERVER['REQUEST_URI']`| | `client_referrer`| string| The client's client `$_SERVER['HTTP_REFERER']`| | `created`| string| Creation date| | `last_login`| string| Last login date| | `timezone`| integer| Time zone. Defaults to `0`|

The following properties are inferred by the payload and passed on to HubSpot:

| Property | Type | Description | | -------- | ---- | ----------- | | `mobile_lead` | boolean | Calculated | | `local_installation` | boolean | Calculated | | `local_installation_skipped` | boolean | Calculated | | `website_lead_source` | string | Calculated | | `hs_email_optout` | string | Calculated |