Difference between revisions of "Marketing Endpoint"

From DreamFactory
Jump to: navigation, search
m
m
Line 26: Line 26:
  
 
== Payload ==
 
== Payload ==
Set your content type to `application/json` and POST your payload. The following properties are allowed/used in your payload:
+
Set your content type to `application/json` and POST your payload.
 +
 +
=== Authentication ===
 +
In order to make this call, a valid user id is required. For this purpose, use the constant value `5` for `user_id`:
 +
 
 +
| Property | Type | Description |
 +
| -------- | ---- | ----------- |
 +
| `user_id` | integer | Set this to `5` for all requests |
 +
 
 +
 
 +
Then add the following properties (as necessary) to your payload:
  
 
| Property | Type | Description |
 
| Property | Type | Description |

Revision as of 16:54, 24 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.

Authentication

In order to make this call, a valid user id is required. For this purpose, use the constant value `5` for `user_id`:

| Property | Type | Description | | -------- | ---- | ----------- | | `user_id` | integer | Set this to `5` for all requests |


Then add the following properties (as necessary) to 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 |