---
title: "Extend Flows with Heroku Compute: An Event-Driven Pattern"
description: "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."
---

# Extend Flows with Heroku Compute: An Event-Driven Pattern

[Heroku](https://yomu.fyi/company/heroku) · Chris Marino · Dec 11, 2020

**Type:** Tutorial

## 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.

**Tags:** [API](https://yomu.fyi/topic/api), [Heroku](https://yomu.fyi/topic/heroku), [OpenAPI](https://yomu.fyi/topic/openapi)

- Source: [Heroku](https://www.heroku.com/blog/extend-flows-heroku-event-driven)
- Source URL: https://www.heroku.com/blog/extend-flows-heroku-event-driven
- Ingested by Yomu: 2026-09-09T20:02:48.511Z

[Read original post](https://www.heroku.com/blog/extend-flows-heroku-event-driven)
