Skip to main content

Integration

The standard data interchange format of JSON makes using and integrating a REST API very easy in most modern programming languages.

Using Java

With Java here's how you could get your enrichment calls done.

    String requestBody = "{ \"contactEmail\" : \"someemail@somedomain.com\"}";
HttpClient client = HttpClient.newBuilder().version(Version.HTTP_2).build();
HttpRequest request =
HttpRequest.newBuilder(URI.create("https://api.smarte.pro/v7/enrich"))
.header("Content-Type", "application/json")
.header("Apikey", "ab6bac70-8ede-4934-9805-534b45exxxxx)
.timeout(Duration.ofSeconds(60))
.POST(BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> httpResponse = client.send(request, BodyHandlers.ofString());
System.out.println(httpResponse.statusCode());
System.out.println(httpResponse.body());

While Java doesn't have JSON support out of the box, there's plenty of libraries out there that can help with this. For example, with Java EE or now Jakarta EE you could just use the JsonObject class to build your request.

  JsonObject json =
Json.createObjectBuilder().add("contactEmail", "someemail@somedomain.com").build();

Similarly, the response could also be read:

    StringReader reader = new StringReader(httpResponse.body());
JsonObject responseJson = null;
try (JsonReader jsonReader = Json.createReader(reader)) {
responseJson = jsonReader.readObject();
System.out.println(responseJson.getString("recordStatus"));
}

Basic call using curl command

If you haven't already seen the curl sample shared in the Quickstart section then here's it in the simplest form:

curl command.

  curl --request POST \
--url 'https://api.smarte.pro/v7/enrich' \
--header 'Apikey: ab6bac70-8ede-4934-9805-534b45exxxxx' \
--header 'Content-Type: application/json' \
--data '{
"contactEmail": "<Person-Email-Id>"
}'

Marketo Integration

Create a Webhook

We'll need to create a webhook which will call Enrich API.

  1. Go to the Admin section
  2. Expand the Integration group
  3. Select Webhooks
  4. New Webhook

Fill with the following properties:

  1. Suggested Webhook Name : SMARTe Enrich API
  2. URL : https://api.smarte.pro/v7/enrich
  3. Request Type : POST
  4. Payload Template with Default Marketo Fields :
{"recordId":{{lead.Id}},
"companyName":{{Company.Company Name}},
"companyWebAddress":{{Company.Website}},
"contactFullName":{{lead.Full Name}},
"contactFirstName":{{lead.First Name}},
"contactMiddleName":{{lead.Middle Name}},
"contactLastName":{{lead.Last Name}},
"contactEmail":{{lead.Email Address}},
"contactJobTitle":{{lead.Job Title}},
"contactCountry":{{lead.Country}}}
  1. Request Token Encoding : JSON
  2. Response type : JSON

Add Custom Headers in Webhook

Once the Webhook has been created, you'll need to reselect it and click to Set a Custom Header

  1. Go to the Admin section

  2. Expand the Integration group

  3. Select Webhooks : SMARTe Enrich API

  4. Webhook Actions / Set Custom Header

  5. Fill with the Header and Value properties from the wizard

    • apikey : Generate and Copy/Paste from Bulk Enrich Webapp
    • Content-Type : application/json

Hubspot Integration with Zapier

SMARTe’s Enrich HubSpot connector enriches the data into CRM through Enrich API. It works with Zapier application which connects the Enrich API and HubSpot CRM.

HubSpot <--> Zapier <--> Enrich API

Steps To Configure

Step 1 Create Zap using Zapier app with below options (To get the fields from HubSpot for contacts object, which underwent changes or were newly added contact):

Trigger

  • Set App Event as HubSpot
  • Set Trigger Event as "Contact Recently Created or Updated" (Trigger can be set as per your choice)
  • Set Choose account. (This will be the account for which you want these actions to happen)
  • Set Up Trigger. (Make no changes to this)

Step 2 Set Choose app as "Webhooks by Zapier" Set Action Event as POST Set up action

  • Set URL to https://api.smarte.pro/v7/enrich
  • Set Payload Type to json
  • Mapping : Left hand side will need below variables. You can map them to HubSpot variables on right hand side. (contactEmail), (contactFirstName), (contactLastName), (contactJobTitle), (companyWebAddress), (companyName) & (contactCountry)
    • Set header as below
      • Content-Type | application/json
      • apikey | 1b7b4899-3bdb-4a8d-9cab-6b1347xxxxxx

(Note: the text before pipe character should be in input box on left side and text on right side should be pasted in right side)

Step 3

  • Set app event as Hubspot
  • Set Action Event as Update Contact
  • Set HubSpot account, same as in set 1.
  • Set up action
    • Here you would map Enrich API fields to HubSpot properties.
    • Set Object ID to (Contact ID).
    • Map Other properties with the Enrich API output fields.

Conclusion

Setting up this ZAP and switching it ON will lead to below actions-

  • Every time a contact is added or any property is updated these set of action will be triggered.
    • It will call Enrich API using the inputs from HubSpot.
    • It will write back the enriched responses from API to HubSpot.