Andy Engin Utkan<p><strong>HTTP Callout in Salesforce Summer 23 – POST – 1/3</strong></p><p>HTTP Callout in Spring 23 got many people excited. The blog post and the video by <a href="https://www.linkedin.com/in/joshdayment/" rel="nofollow noopener" target="_blank">Josh Dayment</a> and I drew quite some attention. We heard one criticism for this functionality: the solution was incomplete without the POST method.</p><p>With Summer 23, the Salesforce Flow Product Team not only moves the GET method to GA, but also gives us the POST method in Beta.</p><p class=""></p> <span class=""></span>🚨 Use case 👇🏼<p></p><p class="">The use case we picked for this demo is based on a real-life client requirement. The client wants to shorten the long URL links before they send them to customers via email or text. Text (SMS) requirement is very important because we cannot hide the long URL behind a short label there since SMS does not support rich text. I don’t have texting set up in my preview Org, therefore, I will demo this using email.</p> <p><strong>The solution consists of many parts. The list is as follows:</strong></p><ul><li>Bit.ly is the service that supports an API with a POST method to shorten URLs. We will need an account with Bit.ly. The good thing is they allow us to use the service for free until we reach a certain number. (1)</li><li>A record-triggered flow with an async path that uses the HTTP callout to Bit.ly to shorten the URL (2)</li><li>A public digital experience (community) site that houses a screen flow to display the critical field values for the Opportunity (3)</li><li>A screen flow that runs at system context without sharing to show the critical Opportunity field values on the community site. (4)</li><li>A simple record-triggered flow to create the long URL on the record (this can also be a formula field) (5)</li><li>A simple record-triggered flow that generates the email with the short link. (6)</li></ul><p>And a few custom fields on the Opportunity object: <em>URL</em> (long) and <em>Short URL</em> text fields and a <em>Short URL Requested</em> checkbox field.</p><p>First, we go to Bit.ly to create a free account. They have API documentation available. However, I cannot say the documentation is very clear. Here is the relevant settings page we need to create the access token for the API.</p><p>*<em>I wiped my values from the screenshot; you will need to copy yours by going to this screen.</em></p><p>We will come back to this later.</p><p>Let’s walk you through the flow that will execute the HTTP Callout.</p><p>Create these custom fields on the Opportunity object:</p><p><em>URL</em> (Text)</p><p><em>Short URL</em> (Text)</p><p><em>Short URL Requested</em> (Checkbox)</p><p>Then create the HTTP callout async record-triggered flow.</p><p><strong>This is how the flow looks after it is completed.</strong></p><p><strong>Set up the start element as follows.</strong></p><p><strong>Build an assignment element to assign field values.</strong></p><p>You will assign the input parameters Bit.ly API needs to the Apex defined variable that the “Create HTTP Callout” builder provides us. Initially, enter a fixed URL here, such as SalesforceBreak.com, until you can get the flow to work without issues.</p><p><strong>Get your group Id from Bit.ly from your browser address bar when you display this screen here.</strong></p><p><strong>The only input parameter that the callout action needs is the Apex defined variable.</strong></p><p><strong>The short URL is again inside an Apex defined variable under 2XX>link.</strong></p><p>We will update this value to the short URL custom field of the Opportunity record.</p><p>But you can do all this after properly creating your HTTP callout action. And that requires a few steps.</p><p>The introduction of HTTP Callout in Salesforce Flow during Spring ’23 generated a lot of excitement, but one key limitation was the absence of the POST method. With Summer ’23, Salesforce not only moved the GET method to General Availability (GA) but also introduced the POST method in Beta, addressing a major user request.</p><p>To demonstrate the real-world application of this new functionality, a use case was chosen based on a client requirement: shortening long URLs before sending them via email or SMS. Since SMS does not support rich text formatting, a short URL is essential to improve readability. Bit.ly’s API, which supports a POST request to generate short links, was used for this purpose.</p><p><a href="https://salesforcebreak.com/2023/06/03/http-callout-in-salesforce-summer-23-post-beta-2-3" rel="nofollow noopener" target="_blank">Please continue to the second post by clicking here.</a></p><p>Explore related content:</p><p><a href="https://salesforcebreak.com/2023/06/03/http-callout-in-salesforce-summer-23-post-beta-2-3" rel="nofollow noopener" target="_blank">Create HTTP Callout – POST 2/3</a></p><p><a href="https://salesforcebreak.com/2023/06/03/http-callout-in-salesforce-summer-23-post-beta-3-3/" rel="nofollow noopener" target="_blank">Create HTTP Callout – POST 3/3</a></p><p><a href="https://salesforcebreak.com/2023/01/10/http-callout-beta-in-salesforce-spring-23/" rel="nofollow noopener" target="_blank">Create HTTP Callout – GET</a></p><p><a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://salesforcebreak.com/tag/api/" target="_blank">#API</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://salesforcebreak.com/tag/automation/" target="_blank">#Automation</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://salesforcebreak.com/tag/http-callout/" target="_blank">#HTTPCallout</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://salesforcebreak.com/tag/release/" target="_blank">#Release</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://salesforcebreak.com/tag/salesforce/" target="_blank">#Salesforce</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://salesforcebreak.com/tag/summer23/" target="_blank">#Summer23</a></p>