Sync customer information to Marketo

Introduction

It can be difficult to use Kintone as a marketing automation tool with only its current standard features. To resolve this issue, this article introduces how to integrate Kintone with Marketo, a powerful marketing automation tool.

Check out the official website for in-depth information on Marketo.

https://www.marketo.com/

Integration Overview

An overall image of the structure of the integration between Kintone and Marketo is shown below.

marketo001-fix.png

 

This tutorial introduces the customization involved in steps 2 and 4 of the above diagram. When a customer is added to Marketo, a record is also added to Kintone with the same customer information. Additionally, a button is created on the Record Details page to update the Marketo lead.

Preparing the Kintone App

Create a Sales Leads Management App from the Kintone Marketplace. For help with creating Apps from the Kintone Marketplace, refer to Creating an App from the Marketplace in the Kintone Help Center.

 

marketo002.png

 

Navigate to the created App, and click on the gear icon to open the App Settings.

Click on the App Settings tab and click on API Token to generate an API token. Check Add records to give the API token permission to add records to the App. Make note of the generated API token as it will be used later.

 

marketo003.png

 

Go back to the Form tab and add a Number field to store the Marketo Lead ID. Name the field, Lead ID and the field code, leadID.
As the Marketo Lead ID is a unique key, check the Prohibit duplicate values option for this number field, from the number field's settings.

Next, add a Radio Button field. Name the field, Priority and the field code priority. Then, give the field the options A, B, and C.

Field Type

Field Name

Field Code

Radio Button

Priority

priority

Number

Lead ID

leadID

 

Screen_Shot_2019-01-07_at_3.56.49_PM.png

 marketo006-after.png

Screen_Shot_2019-01-07_at_3.58.16_PM.png

 

Additionally, change the field codes of the following existing fields as shown in the table.

Field Name

Field Code

Organization Name

companyName

Department

department

Contact Name

contactName

Email

mail

Telephone #

tel

 

After completing the set up, save the form and click on the Activate App / Update App button to reflect the changes to the App.
Take note of the App ID of the Kintone App. This can be found in the URL of the App, which follows the following format: https://{subdomain}.kintone.com/k/xx/. The App ID can be found in the xx part of this URL.

Preparing Marketo

Create an Access API Role

Refer to the Marketo Developer Website for information on how to add users that will call Marketo REST APIs.
At the Create New Role stage, check Access API to give the necessary role permissions.

 

marketo007.png

 

Next, create a LaunchPoint and make a note of the Client ID and Client Secret. They will be used later.

 

marketo008.png

 

In the Web Services section, check the REST API Endpoint and Identity. Make a note of these by referring to the locations shown in the following link and image.

http://developers.marketo.com/rest-api/authentication/#creating_an_access_token

marketo009.png

 

Create a Marketo Webhook

Next, create a Webhook to register data from Marketo to Kintone.

Go to (1) Admin and click (2) Webhooks. Then, click (3) New Webhook as shown below.

 

marketo010-before.png

 

marketo011-before.png

 

marketo012-before.png

 

The webhook creation screen opens as shown below .
(4) Set the URL as follows, replacing {subdomain} with the name of the Kintone subdomain to integrate with Marketo.
https://{subdomain}.kintone.com/k/v1/record.json
(5) Select POST as the Request Type.
(6) For the Template, paste in the JSON sample template and change the value of the app key to the Kintone App ID created in the Preparing the Kintone App section.
(7) Select JSON as both the Request Token Encoding and Response type.

marketo013-before.png

 

JSON Sample Template

(8) Set a Custom Header.

 

marketo014-fix.png

 

In the pop-up, set Content-Type to application/json and set X-Cybozu-API-Token to the API token generated in the Preparing the Kintone App section.

marketo015-before.png

 

Click SAVE to create the Marketo webhook.

Run the created webhook when new customers are created

Click the logo icon in the upper-left corner of the Marketo screen. Go to (1) Marketing Activities and select (2) the workspace to run the webhook, and (3) Create a New Smart Campaign.

The Folder and Name fields can be set to any desired value.

marketo016-before.png

 

marketo017-before.png

 

marketo018-before.png

 

After creating a smart campaign, in the (4) Smart List tab, select the (5) Person is Created trigger and drag it to the open space on the left.

marketo019-before.png

 

Similarly, drag Call Webhook to the open space in the (6) Flow tab and select the webhook created in the Create a Marketo Webhook section from the drop-down menu.

 

marketo020-before.png

 

Finally, click (7) Activate in the Schedule tab.

 

marketo021-after.png

 

The setup of the data flow from Marketo to Kintone is now complete.

Kintone Customization

Sample Codes

Save the following Sample Code as a JavaScript file by copying and pasting the code into a text editor and saving with the .js extension.

In lines 7-10, replace the values of the  client ID, client secret, Identity URL, and Endpoint URL with values that were noted during preparation.

 

JavaScript and CSS Customization

Click on the App's gear icon to access the App's settings. Then, click on the App Settings tab and click the JavaScript and CSS Customization settings to set the various necessary files as shown below. For detailed instructions on adding JavaScript and CSS files to a Kintone App, see Customizing Kintone with JavaScript & CSS in the Kintone Help Center.

connect-to-Marketo.js refers to the Sample Code created in the previous section. The other files are explained below.

 

marketo022.png

Kintone UI Component

The Kintone UI Component is used to display the Marketo Lead update button and spinner.
Download the JavaScript and CSS files from GitHub and apply them to the App.
Check Kintone UI Component for instructions on usage.

Kintone CDN

Specify the URLs of jQuery and SweetAlert2 found in the Kintone CDN.

Testing the Integration

Creating a new customer in Marketo adds a new Kintone record

sample-01.gif

Clicking the "Update Marketo's Lead" button in the Kintone App updates the Marketo Lead

sample-02.gif

Sample Code Explanations

showSwalQues

SweetAlert2 creates an alert dialog when pressing the update Marketo lead button.

getAuthToken

kintone.proxy() is used to run Marketo's REST API, that retrieves the Marketo access token.

createPutButton

Creates the "Update Marketo's Lead" button using functions from the buttons section of the Kintone UI Component.

putLeads

kintone.proxy() calls Marketo's REST API to update the Marketo Lead.
As Marketo's REST API is an Upsert API that executes creating and updating with the POST method, the POST method is also used when updating.
Please check the documentation for more details.

buttonAction

Sets the action to occur when the button is pressed.
The spinner of the Kintone UI Component is displayed until processing for the Marketo lead update is completed.

Finally

Kintone and Marketo have been integrated to register leads into Kintone as they are registered in Marketo, and to update the Marketo lead at the click of a button.
The following customizations can be implemented as well:
• Updating Marketo lead when changing the Kintone Record status
• Updating Marketo lead when changing the values of a Kintone record
• Displaying the Marketo lead score on the Kintone record details page in real time
In addition to the lead information, Marketo's REST API is abundant in many other functions as well.
For details, please check the following Marketo Developer website.
http://developers.marketo.com/

Was this article helpful?
0 out of 0 found this helpful
Do you have any questions or issues related to this article?
Please share your views with us in the Community forums!