Within Salesforce Could you have an integration using message queue? What if I need to open a WebSocket for communication? And could facial recognition be carried out? Yes, yes and yes! And all this without leaving the Salesforce ecosystem, since Heroku has been part of it since 2010.
Heroku is a cloud-based Platform as a Service (PaaS) solution so that the customer only cares about developing their application while Heroku takes care of the infrastructure behind it.
To provide this service, virtual containers are available that are responsible for maintaining and running the applications. These virtual containers are fully scalable on demand. Both in number and capabilities.
One advantage of choosing Heroku is its ability to support multiple programming languages. The main ones to use are: Node.js, Ruby, Python, Java, PHP, Go, Scala and Clojure. Although this number of languages can increase in the case of using Heroku Buildpacks, which allow you to compile applications in many of them more.
Heroku is deeper than one can imagine before meeting him. At first you can only see the tip of the iceberg. But we can highlight some of its characteristics that are more curious or striking :
In any project or development, Git should be indispensable, but with Heroku it is even more so. Git is not only used as version control, but also serves as a connection between on-premises development and the Heroku cloud. The way to deploy the application in Heroku is with the famous git push command.
The dynos (it is not worth making jokes with dinosaurs) is what the virtual containers responsible for keeping the application running are called. There are different types depending on the processing capacity, and can be combined in quantity and type as desired. They are fully scalable on demand, an advantage for those applications that receive peaks of requests on specific dates (Black Friday, Christmas ...). It is important to keep under control when and how many dynos are active since Heroku charges per second for processing.
For terminal lovers, Heroku offers the commands of its customized Command Line Interface. It is so powerful that with it you can quickly perform any task that would be performed by going to the web interface.
Add-ons are tools that complement the application, not applications themselves, so they have the ability to adapt and provide utility regardless of the application. Although there are some add-ons made available by Heroku himself, many of them have been developed by partners or other companies. They get a profit since they have the ability to sell such developments in the store under various rates depending on the capacities to be hired. Much like Salesforce and AppExchange.
Buttons are components, libraries or application templates that are displayed in Heroku in a single click. Once the application of the button is deployed, it can be modified to adapt it to the needs. Here the Open Source comes into play (at least in some buttons that specify it), since clicking on a Heroku button would be equivalent, for example, to doing a fork on Github.
Actually going from zero to 'Hello World' is pretty fast on Heroku. The complexity will lie mainly in the application that you want to develop since the rest is already available by Heroku in a simple way.
Applications are run from a Heroku server, using Heroku DNS Server to point to the application domain (usually nombre.herokuapp.com).
Let's look at those simple steps:
Heroku can be installed either Linux, Windows or MacOs. First you will have to create an account (for the moment free) and log in with heroku login. To create the app is as instant as typing heroku create <name app>.
First of all, you have to choose the programming language with which you are going to develop, and, of course, program that application. For example, one that greets with Hello World.
This file is important. He is in charge of telling each dyno (and each type of dyno) what he is going to execute. It is a list of instructions. For example, if you had written an app in Python and wanted to build a Gunicorn application server to, for example, serve a Django or Flask application, the Procfile would contain web: gunicorn main:app.
Dynos need to know what other libraries (and their specific versions) need to be installed in conjunction with the application. If, for example, Python is used, it would be sufficient to generate an environment requirements file with pip freeze > requirements.txt.
Once the Git is started locally, you need to relate it to the one that Heroku has remotely and that is where it will store its cloud version of the application : heroku git:remote -a <name app>.
In case the application needs an external database, there is an Add-on, Heroku Postgres, that you can start using for free to try it out.
That's it! There is only one last step left: execute the command "git push heroku master".
One of the strengths of Heroku is its multitude of possibilities when it comes to integrating with Salesforce. Being in the same ecosystem, it would have been missing if it were not so.
NTS Seidor has been a Salesforce integrator for over 16 years. We have the experience of +800 projects carried out!
The most interesting are:
It's a two-way synchronization of data between Salesforce and another external database. Any changes to the data made both inside and outside Salesforce are reflected as if it were a mirror. The minimum wait, of course, would be 10 minutes. If you need something more instantaneous, you would have to resort to using the Salesforce Streaming API to achieve a 'polling on demand'.
This way of integrating is not unique to Heroku, as Salesforce External Objects can be used with other external databases. But with Heroku it is really simple and quick to set up. It's an interesting solution to save space in Salesforce and store data externally. Data within Salesforce is exposed and can be visualized, searched, and recounted.
The main reason with which they advertise the use of Heroku is the peace of mind that gives that it takes care of all the infrastructure that must be mounted so that a cloud service is always available, while one can focus on developing the application you need.
Some of the most common uses of Heroku would be :
We've previously appreciated the multitude of possibilities that Heroku provides to integrate with Salesforce. The simplicity of configuring, speed and the confidence of not having to leave the Salesforce ecosystem, are good reasons to opt for Heroku if necessary.
Mobile apps typically have a RESTful API service that fits perfectly with Heroku-Salesforce integrations.
If the application already exists, why do it again? Thanks to Heroku, the application can be loaded on a canvas through an iframe. Heroku guarantees a secure communication protocol.
Internet of Things devices are the order of the day and the information they collect is very useful. Heroku provides the possibility of having that data within Salesforce to exploit it.
But in this blog we are going to go further and we are going to think about bringing to Salesforce those atypical needs, but that could be needed sometime, and in which Apex falters, such as:
More and more, integrations based on message queues (MQTT, RabbitMQ…) are being promoted since it is a way of not losing information in times of collapse or saturation, since messages are stored until they can be processed. One possible idea would be to use Heroku to transform these messages into Salesforce Platform Events.
In industrial environments or integrations with old machinery, it is usual 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 exploited by a service.
There are also modern services that are structured around Sockets. If you need to perform this task from Apex, for the moment it is a limitation, since you could not leave in Apex, for example, a socket listening for connections. As for WebSockets, they can be used from the frontend, but what if we need to use them from the backend? from Apex it would be very difficult. Here Heroku also comes into play.
In this area Apex falls quite short. It is something that we forgive, Apex does not focus on images and video, and it is a field of computing in which to be competitive you have to specialize. For this, there are already a multitude of libraries, some open source such as OpenCV or FFMPEG, that work with artificial vision to detect in images or video, for example, movement, specific objects, distance, facial recognition, etc. With Heroku you are one step away from including these functionalities within Salesforce.
CORS issues are very typical as browsers currently block cross-origin requests if specific headers are not included. A possible solution would be to create a Proxy server on Heroku and use it to avoid these errors as it acts as an intermediary between the browser and the API server.
Sometimes it may require the need to use statistical, mathematical or scientific graph generation functions. Although you could think of solutions like Einstein Analytics, sometimes their power (and price) are exceeded. There are already open source libraries, such as NumPy or MatPlotLib, and they can be deep within Salesforce using Heroku.
And so far the tutorial in Spanish of how Heroku can help extend the functionalities of Salesforce. For more information, please visit the Heroku Dev Center. In it you will find all the most technical documentation about the configuration and use of Heroku. And of course, Trailhead always has as support small modules where you can discover more about Heroku or step by step guides to get to 'Hello World' in a few minutes.