Difference between revisions of "Marketing Endpoint"

From DreamFactory
Jump to: navigation, search
m
m (Updated tables and code blocks from Markdown to MediaWiki)
 
Line 1: Line 1:
 
== Configuration ==
 
== Configuration ==
In `common.config.php` there are a few configuration options. These are shown in the snippet below:
+
In <code>common.config.php</code> there are a few configuration options. These are shown in the snippet below:
  
 
<pre lang=php>
 
<pre lang=php>
Line 23: Line 23:
 
</pre>
 
</pre>
  
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.
+
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 <code>installation_source</code> value are in the <code>install-sources</code> config array.
  
 
== Payload ==
 
== Payload ==
Set your content type to `application/json` and POST your payload.
+
Set your content type to <code>application/json</code> and POST your payload.
 
   
 
   
 
=== Authentication ===
 
=== Authentication ===
In order to make this call, a valid user id is required. For this purpose, use the constant value `5` for `user_id`:
+
In order to make this call, a valid user id is required. For this purpose, use the constant value <code>5</code> for <code>user_id</code>:
  
| Property | Type | Description |
+
{|
| -------- | ---- | ----------- |
+
! Property
| `user_id` | integer | Set this to `5` for all requests |
+
! Type
 +
! Description
 +
|-
 +
| <code>user_id</code>
 +
| integer
 +
| Set this to <code>5</code> for all requests
 +
|}
  
  
 
Then add the following properties (as necessary) to your payload:
 
Then add the following properties (as necessary) to your payload:
  
| Property | Type | Description |
+
{|
| -------- | ---- | ----------- |
+
!width="11%"| Property
| `new_contact` | boolean | Contact is new |
+
!width="6%"| Type
| `delete_contact` | boolean| Contact will be opted-out of all lists|
+
!width="15%"| Description
| `welcome_registration`| boolean| Was from an optional Welcome page|
+
|-
| `welcome_skipped`| boolean| Optional Welcome page was skipped|
+
| <code>new_contact</code>
| `registration_skipped` | boolean | Registration was skipped|
+
| boolean
| `name` | string | User name/full name (not email) |
+
| Contact is new
| `first_name` | string| First name |
+
|-
| `last_name`| string| Last name|
+
| <code>delete_contact</code>
| `email`| string| Email address|
+
| boolean
| `phone_number`| string| Phone number|
+
| Contact will be opted-out of all lists
| `company_name`| string| Company name|
+
|-
| `title`| string| Title|
+
| <code>welcome_registration</code>
| `address_1`| string| Address 1|
+
| boolean
| `address_2`| string| Address 2|
+
| Was from an optional Welcome page
| `city`| string| City|
+
|-
| `state_province`| string| State/Province|
+
| <code>welcome_skipped</code>
| `zip_postal_code`| string| Zip/Postal code|
+
| boolean
| `installation_source`| string| A string indicating the source of the installation (i.e. Bitnami, GitHub, etc.). See **InstallTypes** enum!|
+
| Optional Welcome page was skipped
| `client_cookie_hubspotutk`| string| The client's client `hubspotutk` cookie, if any|
+
|-
| `client_remote_addr`| string| The client's client `$_SERVER['REMOTE_ADDR']`|
+
| <code>registration_skipped</code>
| `client_request_uri`| string| The client's client `$_SERVER['REQUEST_URI']`|
+
| boolean
| `client_referrer`| string| The client's client `$_SERVER['HTTP_REFERER']`|
+
| Registration was skipped
| `created`| string| Creation date|
+
|-
| `last_login`| string| Last login date|
+
| <code>name</code>
| `timezone`| integer| Time zone. Defaults to `0`|
+
| string
 +
| User name/full name (not email)
 +
|-
 +
| <code>first_name</code>
 +
| string
 +
| First name
 +
|-
 +
| <code>last_name</code>
 +
| string
 +
| Last name
 +
|-
 +
| <code>email</code>
 +
| string
 +
| Email address
 +
|-
 +
| <code>phone_number</code>
 +
| string
 +
| Phone number
 +
|-
 +
| <code>company_name</code>
 +
| string
 +
| Company name
 +
|-
 +
| <code>title</code>
 +
| string
 +
| Title
 +
|-
 +
| <code>address_1</code>
 +
| string
 +
| Address 1
 +
|-
 +
| <code>address_2</code>
 +
| string
 +
| Address 2
 +
|-
 +
| <code>city</code>
 +
| string
 +
| City
 +
|-
 +
| <code>state_province</code>
 +
| string
 +
| State/Province
 +
|-
 +
| <code>zip_postal_code</code>
 +
| string
 +
| Zip/Postal code
 +
|-
 +
| <code>installation_source</code>
 +
| string
 +
| A string indicating the source of the installation (i.e. Bitnami, GitHub, etc.). See '''InstallTypes''' enum!
 +
|-
 +
| <code>client_cookie_hubspotutk</code>
 +
| string
 +
| The client’s client <code>hubspotutk</code> cookie, if any
 +
|-
 +
| <code>client_remote_addr</code>
 +
| string
 +
| The client’s client <code>$_SERVER['REMOTE_ADDR']</code>
 +
|-
 +
| <code>client_request_uri</code>
 +
| string
 +
| The client’s client <code>$_SERVER['REQUEST_URI']</code>
 +
|-
 +
| <code>client_referrer</code>
 +
| string
 +
| The client’s client <code>$_SERVER['HTTP_REFERER']</code>
 +
|-
 +
| <code>created</code>
 +
| string
 +
| Creation date
 +
|-
 +
| <code>last_login</code>
 +
| string
 +
| Last login date
 +
|-
 +
| <code>timezone</code>
 +
| integer
 +
| Time zone. Defaults to <code>0</code>
 +
|}
  
 
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:
  
| Property | Type | Description |
+
{|
| -------- | ---- | ----------- |
+
! Property
| `mobile_lead` | boolean | Calculated |
+
! Type
| `local_installation` | boolean | Calculated |
+
! Description
| `local_installation_skipped` | boolean | Calculated |
+
|-
| `website_lead_source` | string | Calculated |
+
| <code>mobile_lead</code>
| `hs_email_optout` | string | Calculated |
+
| boolean
 +
| Calculated
 +
|-
 +
| <code>local_installation</code>
 +
| boolean
 +
| Calculated
 +
|-
 +
| <code>local_installation_skipped</code>
 +
| boolean
 +
| Calculated
 +
|-
 +
| <code>website_lead_source</code>
 +
| string
 +
| Calculated
 +
|-
 +
| <code>hs_email_optout</code>
 +
| string
 +
| Calculated
 +
|}

Latest revision as of 20:51, 5 May 2016

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