Subscribe To Salesforce Platform Events With Python

How to subscribe to Salesforce Platform Events using Python

Techletters
Tech Force

--

Subscribe to Salesforce Platform Events using Python. Picture by Rush4 from Pixabay.

In this story, we are going to implement and publish a Platform Event in Salesforce and subscribe to it from outside Salesforce using Python. To follow along with this story you can create a Salesforce Developer Account for free here.

We will cover two parts. The authentication to Salesforce from Python and the creation of Platform Events in Salesforce and their consumption from Python.

Authentication to Salesforce from Python

Before we start with the Platform Events, we need to set up two preconditions in Salesforce for the authentication from the outside world — a Connected App & a User.

  • (1) Connected App in Salesforce

To create a Connected App, navigate to Setup > App Manager > New Connected App. You need to specify a name, your email and ensure to Enable OAuth Settings. Additionally, select the required OAuth Scopes.

Create a Connected App in Salesforce.

Save the Connected App and note down your Consumer Key & Secret.

--

--