HerokuChris MarinoTutorial
Extend Flows with Heroku Compute: An Event-Driven Pattern
Summary
The post presents an event-driven pattern for extending Salesforce Flow with custom business logic deployed as a Heroku app and exposed as an external service. It uses an OpenAPI specification to define the interface, generates a Node.js application stub, adapts it for Heroku with a Procfile and port configuration, and registers the API in Salesforce. Flow accesses the service through a Named Credential using basic HTTP authentication, while the Heroku app authorizes Salesforce access with a JWT account token and API token. The example begins with product retrieval and then adds a Get Inventory method that can read inventory and update the Salesforce Product object. A Platform Event can trigger a flow that calls this method, while programmers and low-code builders iterate against the shared API contract before completing their work independently.
Context
The post addresses the need to incorporate custom, imperative business logic into Salesforce flows while avoiding the operational overhead associated with deploying scalable, available, and reliable off-platform applications. It also describes collaboration between programmers and low-code builders through a shared API contract.
Approach / What changed
Define an OpenAPI specification, generate and adapt a Node.js application stub for Heroku, register the API as a Salesforce external service, authorize flow access with a Named Credential, and authorize the app's Salesforce access with a JWT account token. Extend the API with a Get Inventory method and invoke it from a Platform Event-triggered flow.
Takeaways
An OpenAPI specification serves as the contract between flow developers and programmers and can generate server-side application stubs.
Salesforce Flow accesses the Heroku service through a Named Credential using a single login with basic HTTP authentication in the example.
A Platform Event-triggered flow can call Get Inventory so the Heroku app updates the Salesforce Product object with current inventory data.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.