How to Make HTTP Callout (POST) from Salesforce Flow to OpenAI API

The Summer '23 Release of Salesforce brings an exciting feature—you can now use the HTTP Callout POST method to send data from Salesforce to external applications, right from your Flows and without any coding. Before this, you could only use the GET method to fetch data from outside into Salesforce.

This enhancement extends the simplicity of "No Code" development with the power of APIs, letting Salesforce admins and consultants work with APIs and connect Salesforce to external applications by themselves. Gone are the days when only developers/integration architects could handle such tasks.

Salesforce Meets OpenAI

In this blog post, we're set to take a deep dive, step-by-step, into integrating Salesforce with external applications using the latest HTTP Callout (POST) feature. And to illustrate this process, what could be better than integrating Salesforce with the OpenAI API (of ChatGPT fame), which is currently setting the tech world abuzz. Get ready to blend the forces of Salesforce and AI like never before!

Real-World Use Case: Customer Sentiment Analysis

To show how useful the HTTP Callout POST method with the OpenAI API can be, we'll use a practical example. Imagine a customer logs a case, and you want to know how they're feeling—are they happy, upset, or angry? Detecting customer sentiment can help you identify and prioritize which cases need to be handled urgently and which ones can wait, which can improve overall efficiency and customer satisfaction.

Consider this your launchpad. Once you've grasped the fundamentals, the potential applications are only limited by your creativity and vision. Picture these powerful technologies (Salesforce Flows, HTTP Callout, AI) working in unison to deliver unprecedented results for your business.

Step-by-Step Guide

In this power-packed step-by-step guide, you will learn:

  1. How to configure External Credentials with Named Credentials and Permission Sets in Salesforce.

  2. How to make an HTTP callout using the POST method from Salesforce Flows.

  3. How to make an API call to OpenAI, send the request, and process the response.

  4. How to detect the customer's sentiment from the case subject and description and update the sentiment on the case record.

Now, let's transform words into action and explore something truly groundbreaking. Enjoy your journey to the frontier of Salesforce and OpenAI integration!

References & Useful URLs