Salesforce Introduce Flow Action To Make HTTP Callouts to External Systems Without Code

 With the Spring ’23 Release, Salesforce introduces a new Flow Action to allow admins to make HTTP Callouts to external systems without code (Beta).  Our expert  consultant and developer Paris has compiled this how to guide to show you how to put this into place in your organisation.

*Only a GET request is supported in this version. Admins must have the Manage Flow and Customize Applications permissions.  

In this example we will use an API provided by Amadeus. It allows us to search for Flights by destination and maximum Price. If you wish to follow along with this example, you need to create an account. That will allow you to get any API Keys needed and to access the API. 

STEP A. Create a Named Credential 

Prior to creating this callout Action, we need to create a Named Credential, which is used to define the Endpoint URL and the authentication parameters. Go to Setup > (Type in the Quick Find box) Named Credentials 

  1. Click on the External Credentials Tab and New. 2.
  2. Provide a Label and Name. 
  3. Choose Custom, on the Authentication Protocol dropdown. 
  4. In the Permission Set Mappings, click on New. 
  5. Either choose an existing Permission Set or create a New one (Users who need access to this Named Credential instance and the Callout Flow, will need to be assigned with this PS). 
  6. Click New on the Authentication Parameters box. 
  7. Give a Name. In the Value field, copy-paste the actual Bearer Key* value. 

  1. Press Save.
  2. In the Custom Headers, press New. 
  3. As Name write Authorization. 
  4. In the Value field, write this expression {!’Bearer ‘ & $Credential. ExternalCredentialName. AuthenticationParameterName}. 

  1. Click Save. 
  2. Go Back to the Named Credential Tab and press New. 
  3. Provide a Name and Label. 
  4. In the URL add the base URL, in our example: https://test.api.amadeus.com/v1/shopping/flight-destinations 
  5. Choose the External Credential we created. 
  6. Untick the Generate Authorization Header. 
  7. Tick the Allow Formulas in HTTP Header. 
  8. Press Save. 

*(This can be generated via your Amadeus Account in this link: https://developers.amadeus.com/self-service/category/air/api-doc/flight-inspiration-search/api-reference) 

1) Click on the API Explorer Tab, and in the URL box write: https://test.api.amadeus.com/v1) 

2)Click Get Access Token. 

3) Copy-Paste the value into the Value field in step g. (Keep in mind that this token expires after 30 mins). 

 

STEP B. Create HTTP Callout Flow 

  1. Create a Screen Flow and add an Action element 
  2. At the bottom left side of the popup, press on the Create HTTP Callout Beta button. 

 

  1. Give a Name (no spaces).  
  2. Choose the Named Credential we created. 
  3. Press Next. 
  4. In the next screen, provide a Label for this Action. 
  5. In the Method field, choose GET (Only GET requests are supported for now). 
  6. In the ‘Add Query Parameter Keys’ section:

          1st Pair: Key => origin, Data Type => String 2nd Pair: Key => maxPrice, Data Type => Integer 

  1. In the ‘Provide Sample Response’ section, click on New. 
  2. In this step we need to find the JSON Response which our API returns in our query and provide it here. Then SF will create a response APEX class that it will use each time to return our results. Most API Documentations provide example responses. (To get the response for this example follow this link: https://developers.amadeus.com/self-service/category/air/api-doc/flight-inspiration-search/api-reference. On the Documentation Tab, below the flight-destinations section, click on GET. This will open a Details window below. Scroll down in the Responses Section. The first response with Code 200 is the value we need to paste in our field. 

 

  1. Once you have pasted the JSON response into the field, click on Review. Press Done.  

  1. Press Done. 
  2. Provide a Label and a Name and click Done. 
  3. You should see Set Input Values in the Action screen, if not save the flow and then refresh the page. 
  4. Provide a value in the origin field, for example MAD. 
  5. Provide a maximum Price in the maxPrice field, for example 200. 
  6. Click on the Advanced and untick the Manually assign variables option. 
  7. Click Done. 

To display the results we can add a Screen Component. 

  1. Click on the plus icon after our Action, choose Screen. 
  2. Drop the Display Text component into the New screen area. 
  3. In the Insert Resource, click in the action, then in the 2XX parameter. This is where all the response data are saved. From there we can print any available data. 

 

Contact Us

If you would like to find out more about working with our development team or any of our other services drop us a message and we will be happy to set up a call with one of our experienced team.

Xenogenix Logo