AppLink Fundamentals II: Advanced AppLink Integrations – Automation & AI
- Last Updated: July 30, 2025
In our previous posts, we introduced Heroku AppLink and explored its foundational integration patterns for connecting Heroku applications with Salesforce. Now, we’ll delve into how AppLink truly expands Salesforce capabilities, focusing on advanced integrations with Data Cloud, Flow, Apex, and Agentforce. This blog will highlight how AppLink empowers you to infuse your Salesforce orgs with powerful external logic, real-time data processing, and intelligent automation.
Extending Salesforce automation, code, and AI
Once your Heroku application is deployed and connected using AppLink, it becomes available for invocation from Apex, Flow, and Agentforce. The key to this integration is the OpenAPI specification that describes your endpoints, enabling automatic service discovery and registration in Salesforce.
OpenAPI specification integration
AppLink uses your OpenAPI (YAML or JSON) specification to understand your service capabilities and generate the appropriate Salesforce integration artifacts. Here’s an example from the Pattern 2 sample showing how the generateQuote
operation is defined:
components:
schemas:
QuoteGenerationRequest:
type: object
required:
- opportunityId
description: Request to generate a quote, includes the opportunity ID to extract product information
properties:
opportunityId:
type: string
description: A record Id for the opportunity
paths:
/api/generatequote:
post:
operationId: generateQuote
summary: Generate a Quote for a given Opportunity
description: Calculate pricing and generate an associated Quote.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/QuoteGenerationRequest"
x-sfdc:
heroku:
authorization:
connectedApp: GenerateQuoteConnectedApp
permissionSet: GenerateQuotePermissions
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/QuoteGenerationResponse"
The x-sfdc
section contains Salesforce-specific metadata that AppLink uses to configure authentication and permissions. When you run heroku salesforce:publish
, this specification becomes:
- Generated Apex classes with strongly-typed request/response objects
- External Service definitions visible in Flow Builder’s Action palette
- Agent Actions available for Agentforce configuration
- Connected App and Permission Set configurations for secure access
Rather than writing OpenAPI specifications manually (which can be tedious and error-prone), most AppLink samples leverage the schema definition features already built into popular Node.js frameworks. The Pattern 2 sample uses Fastify’s schema system to automatically generate the specification, but similar approaches work with Express.js using libraries like swagger-jsdoc
or express-openapi
:
// From heroku-applink-pattern-org-action-nodejs/src/server/routes/api.js
const quoteGenerationSchema = {
operationId: 'generateQuote',
summary: 'Generate a Quote for a given Opportunity',
'x-sfdc': {
heroku: {
authorization: {
connectedApp: 'GenerateQuoteConnectedApp',
permissionSet: 'GenerateQuotePermissions'
}
}
},
body: { $ref: 'QuoteGenerationRequest#' },
response: {
200: { schema: { $ref: 'QuoteGenerationResponse#' } }
}
};
This approach ensures your API documentation stays synchronized with your implementation while providing the metadata Salesforce needs for seamless integration.
Invoking from Apex
AppLink enables both synchronous and asynchronous invocation from Apex:
Synchronous Invocation: Your Heroku service appears as a generated Apex class that you can invoke directly:
// From heroku-applink-pattern-org-action-nodejs sample
HerokuAppLink.GenerateQuote service = new HerokuAppLink.GenerateQuote();
HerokuAppLink.GenerateQuote.generateQuote_Request request = new HerokuAppLink.GenerateQuote.generateQuote_Request();
HerokuAppLink.GenerateQuote_QuoteGenerationRequest body = new HerokuAppLink.GenerateQuote_QuoteGenerationRequest();
body.opportunityId = '006SB00000DItEfYAL';
request.body = body;
System.debug('Quote Id: ' + service.generateQuote(request).Code200.quoteId);
The generated classes handle authentication, serialization, and HTTP communication automatically. Synchronous calls are subject to Apex callout limits and timeout constraints.
Asynchronous Invocation with Callbacks: For long-running operations beyond Apex governor limits, AppLink supports asynchronous processing with callback handling. This requires additional OpenAPI specification using the standard callbacks
definition to define the callback endpoint that Salesforce will invoke when processing completes.
This pattern enables background processing workflows where your Heroku application can perform extensive calculations or external API integrations without blocking the Salesforce user interface. For detailed callback configuration examples, see Getting Started with AppLink and Pattern 3: Scaling Batch Jobs.
Invoking from Flow
Flow Builder provides no-code access to your Heroku applications through External Service Actions. After publishing your service, it appears automatically in the Action palette:
Flow Builder integration
Flow developers can drag your Heroku operation onto the canvas, configure input variables, and capture output data just like any other Flow action. This enables sophisticated business automation combining Salesforce’s declarative tools with your custom processing logic.
Invoking from Agentforce
Agentforce leverages your Heroku applications as Agent Actions organized within Agent Topics through the enhanced OpenAPI configuration detailed in the dedicated Agentforce section below. Once configured with the appropriate x-sfdc
agent extensions, agents can automatically invoke your Heroku endpoints to fulfill user requests requiring specialized processing, external API calls, or complex calculations beyond native Salesforce capabilities.
Permission elevation and security
AppLink operates using User Mode authentication, meaning your code inherits the exact permissions of the Salesforce user who triggers the operation. This provides the most secure integration by following the principle of least privilege.
However, for scenarios where your application needs to access data or perform operations beyond the triggering user’s permissions, AppLink supports elevated permissions (known as “user mode plus” in the main documentation) through Permission Sets. This optional advanced feature allows administrators to grant specific additional permissions that are activated exclusively during code execution.
For example, your Heroku application might need to access sensitive discount override fields that regular users cannot see, or create records in objects where users have read-only access. The Permission Set approach ensures these elevated permissions are:
- Explicitly defined and administrator-controlled
- Only active during Heroku application execution
- Visible through standard Salesforce Permission Set management
- Applied temporarily without changing the user’s permanent permissions
For detailed implementation guidance including permission set configuration and testing approaches, see the Pattern 2 sample documentation.
What’s next?
This blog has explored how AppLink facilitates advanced integrations with Salesforce, extending capabilities across Data Cloud, automation with Flow and Apex, and intelligent interactions with Agentforce. We’ve seen how OpenAPI specifications streamline service discovery and how AppLink’s permission model offers granular control over elevated access.
In our final blog, we’ll shift focus to the practical aspects of the development workflow, including local testing, managing OpenAPI changes, and crucial considerations when choosing between Apex and other programming languages for your Salesforce extensions. Stay tuned for insights into building and deploying your AppLink solutions with confidence.
Read More of the AppLink Fundamentals series
- AppLink Fundamentals I: AppLink Integration Patterns – Connecting Salesforce to Heroku Applications
- AppLink Fundamentals II: Advanced AppLink Integrations – Automation & AI
- AppLink Fundamentals III: Building with AppLink – Development Flow and Language Choices
- Originally Published:
- AppLinkAppLink FundamentalsIntegrationssalesforce