SharinPix Generative AI Analysis/Extract Image Capabilities
This article demonstrates how to use the latest GPT models to integrate AI capabilities with SharinPix Images.
In the following sections, you will learn:
Information:
The AIConnect feature can be used:
- In your own Lightning Component development
- In Flows
Note:
To be able to use this feature, you will need an OpenAI API key.
Prerequisite
To insert your OpenAI API key, you need to go to SharinPix Settings.
After saving your OpenAI API key, you are good to go.
SharinPix Playground
The SharinPix Playground is a tab on the SharinPix App, which allows users to test the Al Image capabilities as shown in the diagram below,
On the SharinPix Playground page, we have a SharinPix Album with prompt and result text boxes. The AI feature is called when the "Extract" button is clicked. The "Extract" button runs the Prompt entered against the image being viewed and updates the Result text box with the response.
AIConnect
The SharinPix package provides the Apex class, AIConnect, which includes methods that integrate OpenAI features. This enables us to execute prompts against the ChatGPT model, using images uploaded to SharinPix.
AIConnect Example
extractImageInfo
global static String extractImageInfo(String imageUrl, String prompt)
This method can be used to extract information according to the prompt provided from the image using the imageUrl.
String url = 'https://p.sharinpix.com/image.png';
String prompt = 'Provide the licenses plate number found on the image';
String result = sharinpix.AIConnect.extractImageInfo(url, prompt);
global static String extractImageInfo(String imageUrl, String prompt, String modelName)
This version performs the same action as the method above but also allows specifying a custom GPT model name to use for the analysis.
If the
modelNameparameter is left blank, the GPT Model defaults togpt-4o.
String url = 'https://p.sharinpix.com/image.png';
String prompt = 'Identify the type of vehicle and its color visible in the image';
String modelName = 'gpt-4o';
String result = sharinpix.AIConnect.extractImageInfo(url, prompt, modelName);
Using AIConnect in Flows
Using AIConnect in a Screen Flow
AIConnectAutomation is an Apex Invocable method that uses the AIConnect class. This enables the use of AIConnect in a Screen Flow to analyze SharinPix images using a prompt provided by the user.
This section demonstrates how to build a flow that allows the user to input a custom prompt, select a single image from a SharinPix Album, and display the AI-generated analysis result in real time.
Warning
This setup is optimized to analyze one image at a time. If the user selects multiple images, the flow will fail. For analyzing multiple images at once, refer to the SharinPix AI Extractor documentation.
Flow Configuration Overview:
Below is a visual representation of the flow:
- Screen – Prompt input and image selection
- Assignment – Create and assign variables
- Get Records – Retrieve the selected image
- Apex Action – Call AIConnectAutomation
- Screen – Display the AI-generated response
Step-by-Step Setup
Step 1: Create a New Screen Flow
- Go to Setup > Flows and create a new Screen Flow.
Step 2: Add a Screen – “Select Image to Analyse”
- Add a Long Text Area input for the user to type the AI prompt.
- Below the component, add a SharinPix Album component for image selection.
In the
AlbumIdfield, create a new resource of type Variable and Data Type Text. For the API Name, please type in " recordId ".
Step 3: Add an Assignment – “Set prompt and image”
- Create 2 variables:
selectedImage- Resource Type: Variable
- Data Type: Text
- Allow multiple values (collection): ✅ (Ticked)
prompt- Resource Type: Variable
- Data Type: Text
Assign:
selectedImage← selected image ID from album component from Select Image to Analyse screenprompt← user-entered prompt from Select Image to Analyse screen
Step 4: Add a Get Records Element – “Get SharinPix Image”
- Object:
SharinPix__Image__c - Condition Requirements:
sharinpix__ImagePublicId__cINselectedImage
- Store:
- Only the first record
- Automatically store all fields
Step 5: Add Apex Action – “Analyse Image”
- Search for and add AIConnectAutomation.
- Example input values:
- Image URL:
Get_SharinPix_Image.sharinpix__ImageURLFull__c - Prompt:
prompt - GPT Model:
gpt-4o(if no value is provided, defaults togpt-4o)
- Image URL:
Warning
- Different GPT Models (e.g., GPT-4o, GPT-5) have different pricing depending on their capabilities and token usage. You can check the latest pricing on OpenAI’s official page.
- Ensure your OpenAI account has sufficient credit balance to process requests.
Step 6: Add a Screen – “Display Analysis”
- Add a Read-only Long Text Area or Display Text component and set its default value to the output from the Apex Action. In this case
Text from Analyse_Image.
After sending the request, the AI-generated response will be displayed to the user in this screen.
Demo
Step 1 : Put your flow on the record page and make sure to tick the box to pass in the record ID to the flow.
Step 2: On your record page, select the image you want to analyse and and type in your prompt. Click the next button to proceed to the results page.
The AI Analysis result will be displayed on the next screen.
Using AIConnect in a Record Triggered Flow
- Create a new Flow on SharinPix Image creation. The Flow will be triggered every time a SharinPix image is created, and then the response from the AIConnectAutomation will be updated in its Description field.
-
Since a Response is expected from the AIConnect call, you need to check the box:
- “Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed“ as shown below.
- Create a new resource (Constant) for a static prompt as follows.
- Add an Apex Action and select the Apex class AIConnectAutomation.
- Image URL: Enter the image's URL.
- Prompt: Use the resource 'MyStaticPrompt' created earlier for the prompt.
- GPT Model: Input example value
gpt-5.
- Update the SharinPix Image Object with the response from AIConnectAutomation apex action.
Need help to write your GenAI image prompt?
The visual experts are here to help. Just send an email to [email protected] to get some help so we can explain you how we can deliver services through our experts to assist you on that duty!

















0 Comments
Add your comment