Set up PushTopics for Real-Time Updates
So far, you’ve learned about the different systems within NTO’s infrastructure and the business challenges they present. You also crafted a plan to implement your integration that automates and simplifies these challenges. Let’s get started building our flow. First, you need to trigger your integration as soon as an Opportunity is marked as Closed Won in Salesforce. To do this, use the Salesforce Streaming API that can trigger events to invoke your integration in near real time.
First, tell Salesforce what fields to send and your criteria for the trigger using an SOQL query. Once the query is built, you can set up a PushTopic that your integration can subscribe to. Here’s how to set it up.
- Navigate to workbench SOQL query builder. You can log in with your Salesforce credentials.
- For Object, select Opportunity.
- Under Fields, select Amount, CloseDate, Id, and Name.
- In the Filter results by dropdown, select StageName = then enter
Closed Wonas your criteria.
- Your query should look like this: SELECT Amount,CloseDate,Id,Name FROM Opportunity WHERE StageName = 'Closed Won'. Click the Query button to test it. You should get a list of all closed opportunities.
- Copy the query to your clipboard.
- From the top menu bar, click the queries dropdown and select Streaming PushTopics.
- For Push Topic, select Create New.
- For Name, enter
- Paste the SOQL query you built in the Query section.
- Click Save.
Now, every time the query criteria is met, Salesforce pushes an event into the ClosedOpps PushTopic.
This means everytime NTO wins new business, an event will be pushed onto our topic. Now you need to use this event to trigger your integration. NTO uses Anypoint Platform for their integration needs. In the next section, you create your first integration application within Anypoint Design Center.
We won’t check any of your setup. Click Verify Step to go to the next step in the project.