Salesforce Flows : Try out the new HTTP Callout(Beta) in 5 minutes
Step By Step Instructions
--
Edit: Five days after writing this story, one of the leading Salesforce content creators used the exact same Jokes API to show HTTP Callout. We had a chat and agreed this is by sheer coincidence. Just two people thinking alike.
In the Spring ’23 release, Salesforce has introduced the ability to make HTTP Callouts directly from Flows. Here’s a step by step by instruction to try this out. Please note that if you are reading this before the Spring ’23 release, then you would need to have a Salesforce instance which has preview of this functionality.
How to check if you have the preview available?
In your Salesforce instance, Create a new Flow (Screen flow) and add an Action step. You should be able to see a new option ‘Create HTTP Callout (Beta)’.
Ok, So, if you have got it, then follow the below steps to quickly create an HTTP Callout and see it in action. As mentioned in the title, this shouldn’t take more than 5 minutes to try out — So have a go!
Step 1 : Create Permission Set
Create a new Permission set named ‘HTTP Callout’ and assign it to yourself.
Step 2 : Find Named Credentials
In Setup -> Search for Credential and click on the result ‘Named Credential’.
Step 3 : Create External Credential and Jokes API
Create a new External Credential. We will use the free Public API : https://github.com/15Dkatz/official_joke_api. On calling this API, it will return random jokes. Create the External Credential with any name and select the Authentication Protocol as ‘Custom’ from the picklist.
Step 4 : Associate Permission Set to the External Credential
Associate the previously created Permission Set to this External Credential.
Select the Permission Set and leave all other fields as-is.
Step 5 : Create a Named Credential
Create a new Named Credential. (Please note that we had previously created an External Credential)
Set a suitable Label and Name. Set URL =
https://official-joke-api.appspot.com/random_joke
Select the previously created External Credential. Leave all other fields with the default values. Save.
Step 6 : Create a Flow, Action Step and HTTP Callout
Create a new Flow (Screen Flow) and add an Action step. Select ‘Create HTTP Callout (Beta)’. Choose a suitable ‘Name’ and select the previously created ‘Named Credential’. Click Next.
Step 7 : Complete Details on HTTP Callout
In the next screen, enter Label = ‘Get Jokes’ and select Method = GET from the picklist.
Step 8 : Provide a Sample Response for the HTTP Callout
Now, a sample response needs to be provided. For this, click new button in the ‘Provide Sample Response’ section.
Open a browser tab, paste this URL: https://official-joke-api.appspot.com/random_joke and go. This is basically an API call and you should get a response similar to below:
Copy the received response and paste it in the ‘Sample JSON Response’ side and click on ‘Review’ button. It will show the Data Structure on the right side.
Click ‘Done’ and click ‘Done’ again. This will take you back to the ‘New Action’ screen.
Step 9 : Finalise the Action Step
Enter a suitable Label and API name. Click Done. This will successfully add an Action step to the Flow.
Step 10 : Display the API Callout response on Screen
Now we need to somehow show this on screen. A simple way is to add a screen step and add display text component to show the values on screen.
Add a Screen Step to the Flow. Add a section and two Display Texts in it. On the first Display Text, show the data element ‘setup’ from the Jokes API response and in the second one select the ‘punchline’.
Step 11 : Test the API response.
Save the flow with any name and click on Debug. If all good, it should show a joke like below:
If you run the debug again, it will show a different joke.