Recently, Geoff and I were at a conference trying to find a place to eat for dinner. While we were both staring at our phones, scrolling through various Yelp reviews, Geoff commented on how cool it would be to extract Yelp data as prospective customers, and feed that information into the Leads area of Dynamics 365. It’s not much of a secret that I don’t code, but I often say it’s like cooking, “I may not be able to cook, but I can follow a recipe”. I knew that if I could find the right series of recipes, I’d have a good chance of making that happen. (Side note: I think I cook quite well, but that complicates the analogy)
I knew Microsoft Flow was going to be the backbone of this process for me, but I wasn’t expecting a Yelp connector to be among the hundreds of available choices. I had seen a few presentations on using the HTTP GET command, so thought I would chase it down there.
In order to get the data from Yelp, however, I’ll need to use an API Key. Essentially, an API key will set up a handshake between Flow and Yelp. As a result, data will be able to pass between the two without a bunch of pop ups or logins. API’s have much more complexity than my description, but we are limiting the focus for this scenario.
If you are trying to get information from a site, first check if they have an API and some documentation. This will be helpful as you start chasing down the various approaches to whatever problem you are trying to solve. Yelp has a fairly robust set of API’s, and their documentation is at a good reading level for non-code type folks (like myself). To get the API key, you will need to either sign up for an account, or use your regular Yelp login to access the Developer area.
Then, you will ‘create an app’ using Yelp's “Fusion API”. Creating an app is really just filling out a form to get the API Client ID and key (akin to a username and password). Once logged in, go to the Fusion page and click on the red “Get Started” to begin. Fill out the pertinent details as requested; "Description", "Name", "Industry", and "Email" seem to be the minimum. Once complete, you’ll be given the information below. You can refer back to it by going to the Manage App page on Yelp.
Take note of the URL and parameters on the Search Endpoint page to help customize your Flow later. Additionally, keep in mind that 'location' is a required parameter, so you will need a way to collect that information. Since my use-case begins on a mobile device, I’ll be able to capture the location through the Flow mobile app using a Manual Trigger. While I’m in the app, I’ll collect some other information using the inputs ability.
Begin with a new Flow from a blank template and select "Manual Trigger" as your starting point. I have added some inputs to collect information to pass along to Yelp to narrow my search. Matching the data type of the parameter to the input is moderately important. Not a huge deal if you get it wrong, but just one more thing to troubleshoot and fix later…all part of learning. Also, Flow gives me the ability to coach the users on the input format to help avoid complications from the “UI” side.
Now that we have the trigger and input parameters, we can send that information to Yelp through an HTTP GET command. This command is “Built-In” (native to Flow) and gives some great options for grabbing data from other sites.
This next bit took some trial and error on my part. When things don’t go as planned, it’s important to not be discouraged. Simply work through the issues as they come up (and they will come up).
The Method GET is part of a dropdown. My understanding is the two most popular options are GET and POST, depending on the direction of data. The URL comes from the API endpoint page. In my example, I use Yelp’s Business Search endpoint. The URL is shown at the top of the endpoint page with the parameters directly below it.
Authorization is what stumped me for a long while. Surprisingly (or not, I guess), Yelp had documented a guide solely on authentication. In there, I found this part:
And matched it to this part of the HTTP connector:
I added the key “Authorization” (without quotes) then “Bearer “ and my key. Full disclosure: I originally put “Bearer API_KEY” until I saw an example somewhere with the correct format. Queries is where you’ll put all of your parameters. In my example above, I show both the dynamic values from Flow (including the location information from the mobile device), as well as the static parameter of ‘rating’ for the sort_by.
Running the Flow now will return all of the results in a JSON format:
It looks cool, but not anything I can use just yet. We need to parse this out into usable, fielded data. I used the Parse JSON connector…more full disclosure: I had NO idea this connector existed until I typed “JSON” into the search box for connectors. I truly don’t know anything about JSON, or the results I got back, but I knew I needed the headers so that I’d have dynamic data to put into Dynamics 365. Flow also provides a handy way to generate the schema to help it parse the information. I found that if I limited my search to a single result, I was able to paste the ‘body’ of the previous HTTP step as a ‘payload’ sample.
Flow does all of the work and ends up with the (hopefully) correct JSON schema from your example:
From this point, you can use the fielded data however you would like. I am expecting multiple results, so I added an “Apply to Each” (Flow will sometimes do this for you automatically) and then converted the result to a Lead (using the company name as the required last name):
Here you can see the dynamic headers that were parsed from the previous step:
That’s it, really! It took some trial and error, but the idea behind Microsoft Flow is not necessarily to provide a template for the exact use-case you need. Rather, I think, the intent is to give (Power) users enough information on the ingredients so they can piece together something to make our lives a little better…and that’s always fun.
The complementary paper includes over 12 years of research, recent survey results, and CRM turnaround success stories.
This 60-second assessment is designed to evaluate your organization's collaboration readiness.
Learn how you rank compared to organizations typically in years 1 to 5 of implementation - and which areas to focus on to improve.
This is a sandbox solution which can be activated per site collection to allow you to easily collect feedback from users into a custom Feedback list.
Whether you are upgrading to SharePoint Online, 2010, 2013 or the latest 2016, this checklist contains everything you need to know for a successful transition.