Site iconAxway Blog

Manually Start an Integration Builder Flow to HubSpot and Salesforce

Integration Builder and HubSpot

Axway AMPLIFY Integration Builder flows are used to orchestrate the execution of Connectors, APIs and business logic. A flow can be triggered automatically or manually. In Create a Simple Integration Builder Flow, we covered using a connector’s polling mechanism to trigger a flow. In Integration Builder – Manually Triggered Flow Example, we learned the basics of creating a manual trigger. In this blog, we’ll explore using a manual trigger to invoke a flow that automatically pushes a contact to both HubSpot and Salesforce Sales Cloud instances.

What is a manual flow trigger?

When an Integration Builder flow is created with a manual trigger, a corresponding API Proxy is generated in AMPLIFY Central. This provides a managed API that can be invoked programmatically. Using a flow with a manual trigger allows you to encapsulate the orchestration of service calls into a reusable asset that can be incorporated into larger services or applications.

Prerequisites

You’ll need the following for this tutorial:

Overview of steps

  1. Create instances of HubSpot and Salesforce Connectors
  2. Build a data mapping to create a normalized representation of a Contact
  3. Configure your connector instances to use the mapping
  4. Build a flow template with a manual trigger using the connector instances and mapping
  5. Create an instance of the flow
  6. Deploy the generated API Proxy in AMPLIFY Central
  7. Publish the API Proxy to the AMPLIFY Catalog

Create Connectors and Mapping

We will reuse the connectors and mapping from Create a Simple Integration Builder Flow. If you’ve completed that exercise then you are ready to go. If not, then follow the steps for Create Connector Instances, Create a Mapping, Associate Mapping with a Connector Instance and Associate Mapping with Salesforce Connector Instance. The process defined in this blog does not require polling to be enabled on the HubSpot Connector, but leaving it enabled will not cause problems.

Note: I have used the names HubSpot CRM and Salesforce CRM for the Connectors in this article. If you are reusing connectors from the previous article, just note that your connectors will have different names.

When finished, you should have the following connectors and mapping:

Create a Flow

Create Flow Variables

Build the Flow

You should now be in the flow editor with the beginning of a flow on the pallet.

Next, we’ll add a call to the HubSpot Connector instance:

This will send the JSON body received by the manual trigger and pass it as the request body to the myContacts API of the HubSpot Connector.

Now, add a call to the SalesForce Connector instance:

Similar to above, this will send the JSON body received by the manual trigger and pass it as the request body to the myContacts API of the Salesforce Connector.

The flow logic is now complete.

Create an Instance of the Flow

Once the Flow Instance has been created, an API Proxy is automatically generated in AMPLIFY Central.

Deploy the API Proxy

From here you can manage where the proxy is deployed, apply policies and test methods.

Test the Manual Flow Trigger

{
   "city" : "Phoenix",
   "country" : "United States",
   "email" : "patrick@axwaydemo.com",
   "firstName" : "Patrick",
   "lastName" : "Wilson",
   "postalCode" : "85054",
   "state" : "Arizona",
   "street" : "6811 E Mayo Blvd"
}

You should get a 200 response.

Consume the flow from an Application

The flow can now be invoked by making calls to the generated API.

From here, you can view the URL for the API Proxy representing your flow. Clicking on the download icon will retrieve the Swagger document for the API, which can be used when building applications. Expand the POST method and scroll down to see code examples for invoking the method programatically.

In this blog, we demonstrated how to create a manually triggered Integration Builder flow, deploy an instance of the flow, and use AMPLIFY Central to deploy an API Proxy for the flow to the AMPLIFY Catalog. Once the API Proxy has been published, it is available to be invoked programmatically, allowing you to include the encapsulated flow logic into your application logic.

Exit mobile version