In this final guide, you will be leveraging work created from guides one, two and three of the quick start series to learn how to use Flow Designer to connect data from our API to Salesforce. Flow Designer is an easy to use tool to develop common integrations in a web-based interface. In this tutorial, we are going to use the HTTP Connector to GET in data from our API that we created in the previous tutorials, and automatically add each object as a new Salesforce Lead.
Sign in to Anypoint Platform. Go into Design Center, click the Create button at the top right, and then click Create new application.
The first step to building our integration is to add an HTTP Connector as the trigger. When you open your project, select the option to go straight to the canvas. Click on the Trigger component, and select HTTP Listener and under path type /submit.
Next, click the plus button, then search for the HTTP Request component. In the URL field, insert your unique URL for your API that you’ve deployed in the previous tutorials. You can find this URL in Runtime Manager. Once you have added the URL, click the X to add the next component to your flow.
Next, click the plus button again after your HTTP Request connector, and search for the Foreach connector. Add the connector to your flow, then click the X button again to add the next component to your flow.
Lastly, search for the Salesforce Connector and select the operation Create. When you create the configuration:
Enter your Salesforce username and password and login, along with your security token. If you don’t have your security token in your inbox, login to Salesforce and go to Setup > Personal Setup > My Personal Information > Reset My Security Token.
After all your credentials are entered, make sure you select Lead under Type, and under Record type: payload. Then click the Save button and test your application.
If you get the error:
Cannot coerce Object, please type in
[payload] instead of
payload under record type.
To test out your API and integration, grab the URL that is generated in the temporary environment and paste that into either the Mocking Service or Postman. Don’t forget to add /submit to the end of the URL, and then click the Send button to make the POST request to the endpoint.
This execution should take around 30 seconds, and once it’s complete, you should see the complete JSON payload of 100 customer data entries returned in the response. When you log into Salesforce and navigate to New Leads, you should now see each entry added to Salesforce as a New Lead.
Amazing right? That’s it! You’ve built your very first integration using Flow Designer which grabs data from your API and inserts it into Salesforce as a new lead.
Next, don’t forget to deploy your application! Go up to the top right, click the blue arrow, and select Deploy Application. For the environment, choose Sandbox and then lastly Deploy.
Nice work! If you want to learn more about MuleSoft’s Anypoint Platform, check out our other developer tutorials or our developer certification training.