Personas hablando

January 30, 2023

What is Heroku? What is it for? How does it integrate with Salesforce?

Within Salesforce: Could you have an integration using message queuing? What if I need to open a WebSocket for communication? And could facial recognition be implemented? Yes, yes and yes! And all this without leaving the Salesforce ecosystem, as Heroku has been part of it since 2010.

What is Heroku?

Heroku is a cloud-based Platform as a Service (PaaS) solution that allows clients to develop their applications, while Heroku takes care of the infrastructure behind it.

As part of this service, virtual containers are provided to maintain and run the applications. These virtual containers are fully scalable on demand. Both in number and capacities.

One advantage of choosing Heroku is its ability to support multiple programming languages. The main ones are: Node.js, Ruby, Python, Java, PHP, Go, Scala and Clojure. The number of languages can increase in the case of using Heroku Buildpacks, which allow applications to be compiled in a multitude of other languages.

lenguas de java

Features galore (Dynos, CLI, and more)

Heroku's depth becomes apparent only once you start using it. At first, you only see the tip of the iceberg. Here we highlight some of its more curious or striking features:

  • Git

Git is indispensable in any development project, but with Heroku, even more so. Git is not only used as version control, but also serves as a connection between local development and the Heroku cloud. Deploying the application on Heroku is accomplished by employing the well-known git push command.

  • Dynos

Dynos (no dinosaur jokes, please) is the name given to the virtual containers that keep the application running. There are different types depending on the processing capacity, and they can be combined in quantity and type as desired. They are fully scalable on demand, an advantage for applications that receive spikes in requests on special dates (Black Friday, Christmas., etc.). It is important to keep track of when and how many dynos are active, as Heroku charges per second of processing.

  • CLI

For terminal lovers, Heroku offers the commands of its customised Command Line Interface. It is so powerful that you can quickly perform any task that would be done using the web interface.

  • Add-ons

Add-ons are tools that complement the application — they are not applications themselves — so they have the ability to adapt and provide utility independently of the application. While Heroku does offer certain add-ons, a significant portion of them has been created by partnering companies or other developers. They make a profit as they have the ability to sell such developments in store for a range of fees depending on the capacities needed. Much in the same way as with Salesforce and AppExchange.

  • Buttons

Buttons are components, libraries or application templates that are deployed in Heroku in a single click. Once the button's application is deployed, it can be modified to suit your needs. Open Source becomes relevant in this context (especially for buttons that explicitly mention it), as clicking a Heroku button is analogous to forking on GitHub.

4 pasos para deploy

How do I create an app with Heroku?

Believe it or not, going from zero to 'Hello world' is quite fast on Heroku. The complexity lies mainly in the application to be developed, as the rest is already provided simply by Heroku.

Applications are run from a Heroku server, using Heroku DNS Server to point to the application domain (usually

Let's take a look at these simple steps:

  • Install Heroku, log in and create the app

Heroku can be installed on Linux, Windows or macOs. First you have to create an account (currently free of charge) and log in with "Heroku login". Creating the app is as instant as typing “heroku create ”.

  • Developing the application

First of all, it is necessary to choose the programming language to be used to develop the application and, naturally, coding is the next step. For example, one that greets with "Hello world".

  • Procfile

This file is important. Its responsibility lies in instructing each dyno (as well as each dyno type) regarding what tasks it will perform. It is a list of instructions. For instance, if you had developed a Python application and wished to create a Gunicorn application server for hosting a Django or Flask application, the Procfile would include "web: gunicorn main:app”.

  • Dependencies

Dynos need to know which other libraries (and their specific versions) need to be installed together with the application. For instance, when Python is used, simply generating an environment requirements file can be done by using "pip freeze > requirements.txt".

  • Connecting to Git

Once you've initiated Git locally, you need to connect it to Heroku's remote Git repository, where it will store your application's cloud-based version: “heroku git:remote -a ”.

  • (Optional) Using a DB

If your application requires an external database, you can start using the Heroku Postgres add-on at no cost.

  • Then deploy!

That's it! There is only one last step: run the command "git push heroku master".
How do Heroku and Salesforce integrate?

One of Heroku's strengths is its multitude of possibilities when it comes to integrating with Salesforce. Being within the same ecosystem, its absence would be noticeable.


The most interesting are:

  • Heroku Connect

It is a two-way synchronisation of data between Salesforce and another external database. Any changes to data made both inside and outside Salesforce are mirrored. The minimum wait, however, would be 10 minutes. If you need something more instantaneous you would have to resort to using the Salesforce Streaming API to achieve 'polling on demand'.

  • External Objects

This form of integration is not unique to Heroku, as Salesforce External Objects can be used with other external databases. But with Heroku it is really easy and quick to set up. It is a unique solution for saving space in Salesforce and storing data externally. Data is exposed within Salesforce and can be visualised, searched and linked.

  • Apex Callout

Sometimes simplicity is the best. A simple HTTP POST request from Apex to the Heroku-provided endpoint could be enough if we require Heroku's service on an ad-hoc basis.

Case examples

The main reason for promoting Heroku usage is the assurance that it handles all the infrastructure requirements to maintain a consistently available cloud service, allowing you to concentrate on developing your required application.

Common uses

Some of the most common uses of Heroku are:

  • Integration for Salesforce with external databases

We have already assessed the multitude of possibilities that Heroku offers to integrate with Salesforce. Simplicity of configuration, speed and not having to leave the Salesforce ecosystem are good reasons to opt for Heroku if necessary.

  • Bridge between Salesforce and a mobile app

Mobile applications usually have a RESTful API service that fits perfectly with Heroku-Salesforce integrations.

  • Embedding an external web application or user interface in Salesforce

If the application already exists, why redo it? Thanks to Heroku, the application can be loaded into a canvas via an iframe. Heroku guarantees a secure communication protocol.

  • Exposing a REST API to IoT devices

Internet of Things devices are the order of the day, and the information they collect is very useful. Heroku offers the opportunity to integrate this data into Salesforce for utilization.


In this blog post, we will delve deeper and explore the idea of incorporating into Salesforce those unique requirements that may arise at some point, areas where Apex falls short, including:

  • Integrating with message queues

Increasingly, integrations based on message queues (MQTT, RabbitMQ, etc.) are being promoted as a way of not losing information in times of collapse or saturation, as messages are stored until they can be processed. One possible idea would be to use Heroku to transform these messages into Salesforce Platform Events.

  • SDKs

In industrial environments or integrations with older machinery, it is common to integrate with SDKs and not with services. Heroku can be a solution to integrate that SDK and transform it so that it can be utilized by a service.

  • Open a Socket or WebSocket

There are also modern services that are structured around Sockets. Currently, if you need to accomplish such a task from Apex, you'll encounter a limitation. For instance, you won't be able to keep a socket listening for connections in Apex. As for WebSockets, they can be used from the frontend. But what if we need to use them from the backend? it would be very complicated from Apex. This is where Heroku comes into play.

  • Video and image management

Apex is still falls short in this field. This is something we can forgive, as Apex does not focus on images and video, and it is an area of computing in which, to be competitive, you have to specialise. For this purpose, there are already a multitude of libraries — some of them open source, such as OpenCV or FFMPEG — that work with artificial vision to detect movement, specific objects, distance, facial recognition, etc., in images or video. With Heroku, you are one step away from including these functionalities within Salesforce.

  • Creating a proxy to bypass CORS

Problems with CORS are very typical, as browsers currently block cross-origin requests if specific headers are not included. A possible solution would be to create and use a proxy server in Heroku to avoid these errors, as it acts as an intermediary between the browser and the API server.

  • Generation of scientific graphics

Sometimes the need to use statistical, mathematical or scientific graphing functions may be required. While solutions such as Einstein Analytics could be considered, sometimes their power (and price) are overkill. Existing open-source libraries like NumPy or Matplotlib can be incorporated deep into Salesforce using Heroku.

  • Web scraping

Although there may be solutions with JavaScript, if the solution is needed in Apex, Heroku could help with that. There are already open source libraries specialised in web scraping such as Selenium or ScraPy, which would leave you one step away from integration (a really small step thanks to Heroku).


And that concludes the tutorial on how Heroku can help extend Salesforce's functionalities. For more information, we strongly recommend going to the Heroku Dev Center. Here you will find all technical documentation about the configuration and use of Heroku. And of course, Trailhead is always supported by small modules where you can find out more about Heroku or step-by-step guides to get to 'Hello world' in a few minutes.