Custom Flow Integration with AI Request Action

The AI Request Apex Action enables you to build dynamic AI prompts using a structured messages array based on OpenAI’s Chat API format. This approach allows you to define multi-part messages that include system instructions, user inputs, and contextual Salesforce data—making each AI interaction flexible and deeply personalized.

What Are Messages?

Each message in the array represents a piece of the prompt. It includes:

  • Role — Defines the context of the message
  • Content — The text content sent to the AI model
  • Type of Input — Specifies where the message content comes from (manual input, flow variables, formulas, etc.)

Peeklogic AI Orchestrator provides an Apex Action ‘AI Request’ in flow for implementing automations according to own use cases:

Content Image

1. Select the Salesforce Record that should be related to the Request and Response and Model that you created in Peeklogic AI Setup

Content Image

Content Image

2. Click on the icon in order to choose Type Of Input firstly and then select the appropriate resource where you can describe the main task for AI provider

Supported Input Types:

For each message, you can choose from the following input types:

  • Manual — Static text written directly in the flow
  • Record Field Value — Pulls data from the triggering record
  • Formulas — Combines values using Salesforce Flow formulas
  • Text Templates — Predefined text templates, supporting merge fields and formatting
  • Constants — Static values defined in the flow
  • Variables — Flow variables captured during runtime

This enables the AI request to be context-aware, highly customized, and adaptable to your business logic.

Content Image

Content Image

3. Select role, if AI provider demands it. It helps structure the conversation.

Content Image

4. For Chat PDF, provide PDF file as:

  • public URL

 

Content Image

OR

  • record of Content Document Link

Content Image

 

Ready to simplify your Salesforce integrations?

    Peeklogic AI Orchestrator