Important
These instructions will be integrated into an upcoming TDX 2025 mini-hack.
In this workshop, we're enhancing several agents with custom code written in languages of your choice, using Heroku and Heroku AppLink. This allows Apex, Flow, and Agentforce to perform complex, compute-intensive calculations on Heroku’s scalable managed infrastructure.
Note
The steps below do not require you to build or deploy the associated Heroku application, as this has already been done for you. However, if you want to review the source code for these actions later, you can do so through this repository.
- Access to a Salesforce Org with Agentforce enabled and the TDX mini-hack objects and apps deployed.
- Access to a Heroku environment enrolled in the
tdx25-minihack
Heroku team. - The latest Salesforce CLI installed link.
- The latest Heroku CLI installed link.
- The latest Heroku AppLink CLI Plugin installed link.
- The
git
CLI
-
Logging into Heroku and Cloning the Repository
Log in to Heroku and confirm that you have access to the required Heroku team:
heroku login heroku teams
The
heroku teams
command should showtdx25-minihack
in your list of teams:Team Role ──────────────── ──────────── tdx25-minihack collaborator
Clone this repository and change to the directory created:
git clone https://github.com/heroku-examples/heroku-tdx25-minihack-instructions cd heroku-tdx25-minihack-instructions
-
Connecting Heroku to Your Org
Run the command below. When prompted, enter the username and password for your org and accept the required permissions prompt:
heroku salesforce:connect my-org-yourname --app tdx25-minihack-actions --store-as-run-as-user
Replace
yourname
in the command above. For example, for Chris Wall, usemy-org-cwall
. -
Linking the Heroku Application with Your Org
The action code uses Heroku AppLink to seamlessly access data within the org. Run the following command to link the Heroku app to your org:
heroku salesforce:import api-docs.yaml --org-name my-org-yourname --app tdx25-minihack-actions --client-name ActionsService
TEMPORARY STEP REMOVE FOR TDX: Find the
ActionsService
under Named Credentials and check the URL field is set tohttps://tdx25-minihack-actions-3b047f6da5d2.herokuapp.com/
As per the last step, be sure to edit
my-org-yourname
in the command above.Navigate to Heroku under Setup to confirm that the application has been linked.
In the following steps, you will configure an Agentforce Action for one of the above operations.
-
Grant Permissions to the Heroku Application
Ensure the Agent user has permission to invoke the Heroku application imported above. Search for Permission Set Groups under Setup and open the
TDX25 Minihacks Agent Access
permission set group. Add theActionsService
permission set to the group.TEMPORARY STEP REMOVE FOR TDX: If the above Permission Set Group does not exist in your org, locate the
ActionsService
permission set and click Manage Assignments, then search for and add theEinsteinServiceAgent User
user. -
Deploy to Your Salesforce Org
Heroku actions need a small Flow wrapper to be used with Agentforce. Deploy these using the command below:
sf project deploy start --metadata Flow -o my-org
The above command assumes you have already authenticated your org with the
sf
CLI using an alias ofmy-org
. If this is not the case, use thesf org login web --alias my-org
command to authenticate with this alias or your chosen alias.Support for using Heroku applications directly with Agentforce is being rolled out to our service. This step will be removed once this is complete.
This action uses flight information from Salesforce and CO₂ emissions data to estimate the carbon footprint of a flight. Heroku integrates in real-time with environmental data APIs (ICAO Carbon Emissions Calculator, Google Flights API, IATA CO₂ Data), collates and queries flight data in memory, and calculates CO₂ emissions per route, traveler, aircraft type, and distance traveled.
-
Creating an Agentforce Action
To create an Agentforce Action, search for Agent Actions under Setup to navigate to the Agent Actions page. Click New Agent Action in the top right corner, select Flow, search for Calculate Carbon Footprint, select the action, and click Next. Complete the checkboxes as shown below and click Finish.
-
Adding an Action to an Agent
Locate Agents under the Setup menu, click Astro Airlines Travel Agent, and click Open in Builder. Click on the Topics tab and Travel Agent. In the This Topic's Actions tab, click New > Add from Asset Library. Search for Calculate Carbon Footprint, select it, and click Finish.
-
Testing Your Heroku Action
In Agent Builder, enter the following to invoke your action:
I want to travel from SFO to LAX
Agent lists the available flights for the user to choose.
What is the total carbon footprint for flight 1?
This action retrieves product information, including size and weight. It dynamically calls APIs of approved shipping companies, collates the shipping costs and timelines in memory, and returns them to Agentforce along with a recommendation.
-
Creating an Agentforce Action
To create an Agentforce Action, search for Agent Actions under Setup to navigate to the Agent Actions page. Click New Agent Action in the top right corner, select Flow, search for Calculate Shipping Options, select the action, and click Next. Complete the checkboxes as shown below and click Finish.
-
Adding an Action to an Agent
Locate Agents under the Setup menu, click Trailblazer Outfitters Service Agent, and click Open in Builder. Click on the Topics tab and Sales Assistant. In the This Topic's Actions tab, click New > Add from Asset Library. Search for Calculate Shipping Options, select it, and click Finish.
-
Testing Your Heroku Action
Enter the following in Agent Builder:
I am looking for warm clothes?
Agent responds with a list of options, enter the following:
Can you recommend shipping options for item 1 so that I receive it within a week for under $50?
This action evaluates real-time car valuations from industry sources (AutoTrader, Edmunds, KBB), assesses user credit status via finance APIs, and optimizes business margins while ensuring competitiveness. By leveraging Heroku’s scalable processing power, Agentforce-powered agents can make real-time financing decisions, delivering personalized finance offers within Salesforce.
-
Creating an Agentforce Action
To create an Agentforce Action, search for Agent Actions under Setup to navigate to the Agent Actions page. Click New Agent Action in the top right corner, select Flow, search for Calculate Finance Agreement, select the action, and click Next. Complete the checkboxes as shown below and click Finish.
-
Adding an Action to an Agent
Locate Agents under the Setup menu, click Koa Car Agent, and click Open in Builder. Click on the Topics tab and Koa Cars Sales Agent. In the This Topic's Actions tab, click New > Add from Asset Library. Search for Calculate Finance Agreement, select it, and click Finish.
-
Testing Your Heroku Action
Enter the following in Agent Builder:
I want to buy a car with a $1,000 down payment, a max 5% interest rate, and a term over 3 years. Can you provide a competitive finance estimate?
When the Agent requests further information enter the following:
My email is [email protected]
I like make Zig model M3
I choose 1