Using Flow and AI to Detect Spam Cases

Using Flow and AI to Detect Spam Cases

Case is one of the core objects in Salesforce and it represents a customer's question, feedback, or issue. There are various ways to create Case records. For instance, it is possible to use email-to-case, web-to-case, or custom integrations to create Case records in Salesforce. Although there are ways to block spam cases (e.g., using reCAPTCHA), they cannot detect spam cases in all situations. Moreover, it is not possible to use reCAPTCHA in email-to-case, since there is no form. This may lead to a waste of time because support reps will need to go over the Case records.

There are endless use cases for integrating ChatGPT with Salesforce. Let's see how to use Flow to integrate with ChatGPT in order to detect spam Cases in Salesforce.

Using Flow to Integrate with ChatGPT

Read this post to learn how to use an HTTP Callout to integrate with ChatGPT. Make sure to build it as an autolaunched flow so that you can use this integration in many places.

The autolaunched flow should have an input variable to pass the question/prompt from the main flow.

Input Variable

Create another variable and mark it available as output. This will be the output of the autolaunched flow.

Output of the Flow

The autolaunched flow should look like this. Again, read this post to learn how to build it.

Autolaunched Flow to Integrate with ChatGPT

Using a Record-Triggered Flow to Detect Spam Cases

Let's build a record-triggered flow that runs when a Case record is created.

1- We will pass the Case's description to ChatGPT and ask if it sounds like spam. Therefore, add an entry condition so that it runs only if there is a description.

Start of the Flow

2- Call the autolaunched flow you created and set the Question like this:

Does this support ticket description sound fake or like spam? Return only one word true or false. Description: {!$Record.Description}

This will ensure that ChatGPT returns either true or false.

Calling an Autolaunched Flow to Detect Spam Cases

3- Create a checkbox field called Spam and mark it if the output of the callout is "true".

Decision Element to Check if the Case is Spam

To save time for your support reps, you can also change the status to "Closed".

Update Case Record

At the end, your record-triggered flow should look like this.

End of the Flow to Detect Spam Cases


Here is a little POC. As you can see, the flow detected that this Case record is spam and closed it. Now, imagine you are getting a lot of cases like this every day (true story); it will save a lot of time!

Moreover, ChatGPT can work with almost every language, which means that our solution works in almost every language!

Spam Detector

Be the first to comment

Leave a Reply

Your email address will not be published.