Portugal Dreamin 24 - How to easily use an API with Flows

ThierryTROUIN 59 views 51 slides Jul 13, 2024
Slide 1
Slide 1 of 51
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51

About This Presentation

How to easily use an API with Flows


Slide Content

How to easily use an API with Flows

Diamond Sponsor Platinum Sponsors Gold Sponsors Silver Sponsor After Party Sponsor Speaker Dinner Sponsor THANK YOU!

Salesforce enthusiast since 2020 Salesforce Consultant at Accenture Fundation Admin certified Speaker on Albania Dreamin’ 2024 in April Volunteer at French Touch Dreamin 2022 2023 Karine IOST

Salesforce Architect at Orange Business birthday last week (7 years ) 13 years old on Salesforce eco -system 10 Salesforce Certifications + 3 partners Certifications Group Leader at Toulouse Salesforce User Group Certified Instructor (Salesforce Administrator ) Salesforce MVP since 2021 French Touch Dreamin Co-Organiser Speaker on Salesforce Events Thierry TROUIN

Agenda Definition Use Cases Tools and Features Setup Conclusion Q/A

Definition

Definition API = A pplication P rogramming I nterface API is a way for two or more programs or components to communicate with each other . It is a software interface , offering a service to other software . API Request Request Response Response Client / Application Base de données

Use Cases

Use Cases Some API use cases Today ’s or week’s weather List of public holidays for the current year Automatically update an exchange rate L ist of city in an area

Use Cases Our company has a needs : Retrieve the public holidays in France for the year 2024 .

Use Cases Our company has a needs : Retrieve the public holidays in France for the year 2024 . How can I answer it ?

Use Cases Our company has a needs : Retrieve the public holidays in France for the year 2024 . How can I answer it ? The site «  https://api.gouv.fr  » offers us a free API listing public holidays in France

Tools & Features

Tools & Features Tools : https://api.gouv.fr/documentation/jours-feries https://www.salesforce.com https://swagger.io

Salesforce Features : Tools & Features Tools : Named Credentials Flows (screen) External Services Remote Site Settings https://api.gouv.fr/documentation/jours-feries https://www.salesforce.com https://swagger.io

Setup

Setup - Identify our API Access the URL «  https://api.gouv.fr/documentation/jours-feries  » to view the API documentation I choose an API

Setup - Identify our API Access the URL «  https://api.gouv.fr/documentation/jours-feries  » to view the API documentation Here the API URL

Setup – Set connection Add the Url « https://calendrier.api.gouv.fr  » into the list of «  Remote Site Settings  » List of authorized sites from Salesforce

Setup – Set connection Click the «  New Legacy   » button to set the API connection in Salesforce

Setup – Set connection Enter the «  Name  » and «  URL  » https://calendrier.api.gouv.fr that corresponds to the API

Setup – Load API Click the «  Add an External Service  » button to add the API schema.

Setup – Load API Select «  From API Specification »

Setup – Load API Enter the information

Setup – Load API Enter the information

Setup – Load API Enter the information The schema provided by the site (YAML) is not compatible with Salesforce (JSON) You must use a conversion tool (swagger)

Expanded Registration Options in External Services Register More API Specs With Support For YAML Customer Need Integration builders spend too much time trying to convert specifications into the correct format to use for their integration workflow. Solution / How To Configure Users can now upload YAML formatted API schemas into External Services without having to convert it into JSON format. Use Case When an integration builder identifies the API they want to use and realize the API schema format is YAML, they can simply upload their specification and select the operations they want to convert into actions to use in automation tools like Flow, Einstein Bots, or program directly into Apex code. Impact Integration Builder/Admin productivity

Setup – Load API Let’s go to the swagger site « https://swagger.io/  »

Setup – Load API Click on the link to view the communication schema https://api.gouv.fr/documentation/jours-feries API Schema

Setup – Load API Click on the « File » menu Click on the « Import URL » menu Paste the API URL «  https://calendrier.api.gouv.fr/jours-feries/openapi.yml  »

Setup – Load API Click on the « File » menu Click on the «  Convert and save as JSON » menu The file is automatically saved on our PC

Setup – Load API Select «  Upload from local » Click on the «  Upload Files » button

Setup – Load API Select « Upload from local » Click on the « Upload Files » button

Setup – Load API Select the operation (s)

Setup – Load API Click on the « Finish » button to save the «  External Service » Summary of Operations in the external service

Setup – Load API Well done, you have configured your service.

Setup – Designing the Screen Flow In Setup Click on the « Flows » menu Click on the « New Flow » button Select « Screen Flow »

Setup – Designing the Screen Flow Step 1 : Add the Screen component Get the current year

Setup – Designing the Screen Flow Add the «  Number  » component to input the year Click on «  Defaut Value » then click on « New Resource »

Setup – Designing the Screen Flow Creating a resource to get the current year by default Input the name «  ThisYear  » Select the data type «  Number  » without decimal Use the function TODAY() to retrieve the today’s date Use the function YEAR() retrieve only the year of our date YEAR( TODAY() )

Setup – Designing the Screen Flow The 1 st form is created

Setup – Designing the Screen Flow Step 2 : Add the « Action » component Retreiving public holidays

Setup – Designing the Screen Flow Add an action In menu, select «  JourFeries  » Click on «  getZoneAndAnnee  » Name of our External Service created just before Public holiday ’s recovery function name

Setup – Designing the Screen Flow Input the action « Label » Select the «  txtAnnee  » corresponding to the text box of the 1 st form to retrieve the year Create the « Zone » constante with «  metropole  » value

Setup – Designing the Screen Flow Step 3 : Add the « Screen » component The result screen

Setup – Designing the Screen Flow Add the « Display Text  » component and name it «  txtResultat  » In the « Resource Picker  » area Click on « Outputs from GetJoursFeries  » Click on « 200 » ( which corresponds to our result ) Delete the dot « . » at the end of the « {!GetJoursFeries.200} » variable

Setup – Designing the Screen Flow The 1 st screen shows the current year The 2 nd screen shows the result

Conclusion

Conclusion Steps Action Comments Step 1 Identify our API https://api.gouv.fr/documentation/jours-feries Step 2 Set connection into Salesforce Remote site + Named Credential Step 3 Load API into Salesforce External Services (+ swagger) Step 4 Designing the Screen Flow Flow

Thank you ! Any Questions ? Download me here https://bit.ly/portugal-dreamin-api-flow

Diamond Sponsor Platinum Sponsors Gold Sponsors Silver Sponsor After Party Sponsor Speaker Dinner Sponsor THANK YOU!