Flow, New Release

HTTP Callout in Salesforce Summer 23 – POST – 1/3

HTTP Callout in Spring 23 got many people excited. The blog post and the video by Josh Dayment and I drew quite some attention. We heard one criticism for this functionality: the solution was incomplete without the POST method.

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.

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.

The solution consists of many parts. The list is as follows:

  • 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)
  • A record-triggered flow with an async path that uses the HTTP callout to Bit.ly to shorten the URL (2)
  • A public digital experience (community) site that houses a screen flow to display the critical field values for the Opportunity (3)
  • A screen flow that runs at system context without sharing to show the critical Opportunity field values on the community site. (4)
  • A simple record-triggered flow to create the long URL on the record (this can also be a formula field) (5)
  • A simple record-triggered flow that generates the email with the short link. (6)

And a few custom fields on the Opportunity object: URL (long) and Short URL text fields and a Short URL Requested checkbox field.

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.

*I wiped my values from the screenshot; you will need to copy yours by going to this screen.

We will come back to this later.

Let’s walk you through the flow that will execute the HTTP Callout.

Create these custom fields on the Opportunity object:

URL (Text)

Short URL (Text)

Short URL Requested (Checkbox)

Then create the HTTP callout async record-triggered flow.

This is how the flow looks after it is completed.

Set up the start element as follows.

Build an assignment element to assign field values. 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.

Get your group Id from Bit.ly from your browser address bar when you display this screen here.

The only input parameter that the callout action needs is the Apex defined variable.

The short URL is again inside an Apex defined variable under 2XX>link. We will update this value to the short URL custom field of the Opportunity record.

But you can do all this after properly creating your HTTP callout action. And that requires a few steps.

Read the next post to learn how the HTTP Callout action is set up.

Please continue to the second post by clicking here.

Related links:

Create HTTP Callout – POST 2/3

Create HTTP Callout – POST 3/3

Create HTTP Callout – GET

Standard

6 thoughts on “HTTP Callout in Salesforce Summer 23 – POST – 1/3

  1. Pingback: How to set up HTTP Callout (Beta) in Salesforce Spring 23?

  2. Pingback: Blog - Salesforce Break

  3. Pingback: Blog - Salesforce Break

  4. Pingback: Winter 23 Flow Formula Syntax Check - Salesforce Break

  5. Pingback: HTTP Callout in Salesforce Summer 23 - POST (Beta) - 3/3 - Salesforce Break

  6. Pingback: HTTP Callout in Salesforce Summer 23 - POST (Beta) - 2/3 - Salesforce Break

Leave a Reply