Enabling Real-time communication in Salesforce CRM

salesforce crm Blog

Applications need to communicate with each other for data to flow bi-directionally. The traditional APIs (Application Program Interface) that are generally in use work with a request and response action. This is a drawback as the data is not updated as and when a change is made.  So, live update of data has always been a challenge. Real-time communication, when it arrived, was exclusive to some niche industries such as power plants, automobile industries, chemical industries, etc.  Finally, with the growth of internet and technology, real-time communication has come out of its cocoon.

Real-time APIs

The advancement in real-time APIs has not only solved the problem of live data updates, but has also ensured that the technology is available, accessible, and affordable to everyone. Now, the new data gets pushed right away without waiting for a request from the users. This facilitates instant communication and data updates. This technological improvement has not only made the lives of users easier but also made businesses work with their clients more effectively.  If you are using Salesforce and wonder if you can experience real-time API, the answer is a resounding “yes.”

What is with Streaming API?

Streaming API from salesforce is a simple way to define events and send push notifications to users in real-time. With Streaming APIs, the need for refreshing your Salesforce screen to keep an eye on the data changes is eliminated. You can be sure of getting notified in real-time whenever a change happens.

How does this Streaming API work?       

This is a background process. The client connects to the server and requests for certain information from the server. The server holds the request and waits until the information is available from Salesforce. Once the information is available, the server sends the response to the client immediately. In this case, a PushTopic is created with the query.

Each PushTopic record will correspond to a PushTopic channel. This channel defines which record creates, updates, deletes or undeletes events will generate the notifications. The client subscribes to the PushTopic channel. So whenever the defined criterion is met for an object, a notification will be sent to the client.

Creating a PushTopic:

Here is a sample PushTopic created to get notified when there is a change in Salesforce account (whenever an object is newly created or an existing object gets modified)

PushTopic pushTopic = new PushTopic();

pushTopic.Name = ‘AccountUpdates’;

pushTopic.NotifyForOperationUpdate = true;

pushTopic.NotifyForOperationCreate = true;

pushTopic.NotifyForOperationDelete = false;

pushTopic.NotifyForOperationUndelete = false;

pushTopic.Query = ‘SELECT Id, Name FROM Account’;

pushTopic.ApiVersion = 23.0;

insert pushTopic;

Mandatory fields: ApiVersion, Name and Query

 

Receive Notifications in Visualforce page:

There are several steps that can be taken to improve Visualforce performance. For the above PushTopic, in order to receive notification in the visualforce page, we will have to subscribe to the PushTopic from the visualforce page. So whenever an event occurs, the notification will be seen on the visualforce page.

 Output for the above activity:

 

Installation Steps:

  1. Create a PushTopic
  2. Download the CometD compressed archive (.tgz) file (online source)
  3. Extract the compressed file.
  4. Attach the below mentioned static resources in Salesforce.

             json2.js, jquery-1.5.1.js, jquery.cometd.js, cometd.js

  1. Start with the Visualforce page.

 Limitations of Streaming API:

 There are few things to keep in mind while creating the streaming APIs

  1. The maximum length of the query used should be 1300 characters.
  2. Reconnection gap after a successful connection is 40 seconds
  3. Maximum number of subscribers per topic/all topic will be
    1. Performance and Unlimited Editions – 2000
    2. Enterprise Edition – 1000
  4. All other editions – 20
  5. The maximum length of push topic name is 25 characters.
  6. Maximum number of topics for an organization

Recent Post

Salesforce Tableau Integration

What Salesforce Tableau Integration Means for Customers?

Salesforce Tableau Integration - Salesforce is known for its acquisitions, always with a strategy to deliver comprehensive CRM features and world-class experiences to its stakeholders. However, its recent purchase of

Salesforce Einstein Chatbot

Salesforce Einstein Chatbots – (Almost) Everything You Need to Know!

Salesforce Einstein Chatbots - With the rise of the internet and online chat, the way people prefer to communicate with businesses has changed. The new consumer mandate is speed -

Salesforce gamification

Salesforce Gamification – Read this before you implement it!

Salesforce Gamification - If you are reading this blog, it’s most likely that you’ve heard about gamification and how it spreads like a wildfire among thought leaders and developers, how

Salesforce State of the Connected Customer Report

Key Takeaways from the Salesforce State of the Connected Customer Report 2019

Salesforce State of the Connected Customer Report 2019 - Customer expectations has hit an all-time high! With over 25 years since the popularization of the Internet and 12 years after

Salesforce Blockchain

Demystifying Salesforce Blockchain

Salesforce is always a company that is looking ahead to the next big in technology, whether it is mobile, social, IoT or Artificial Intelligence. The world’s leading CRM Company recently

Salesforce Marketing Cloud Benefits

3 Key Marketing Challenges and how you can overcome them with Salesforce Marketing Cloud Benefits

Salesforce Marketing Cloud Benefits - In the digital age, customers are invariably inundated with marketing messages everywhere. Digital Marketing experts estimate that most Americans are exposed to about 4,000 to

Salesforce DX Benefits

Build Collaboratively, Deliver Continuously and Innovate Faster with Salesforce DX Benefits

Salesforce DX Benefits - Salesforce Developer Experience (DX) is a brand new way to develop and manage apps on the Lightning Platform across the entire life cycle. It combines the

Salesforce Distributed Marketing

Salesforce Distributed Marketing – Enabling the last mile connect!

Salesforce Distributed Marketing - When you utter the name of a brand and people are able to instantly recognize, it’s not just because they know the specific name or they

Salesforce Summer '19 Release features

Top 10 Features in Salesforce Summer ’19 Release

Salesforce releases over a whopping 150 new features three times a year during its seasonal releases: Spring, Summer, and Winter. And one of the most awaited Salesforce Summer ’19 Release

Salesforce Development Partner

Top Considerations in Choosing the Right Salesforce Development Partner

Salesforce is the world’s leading and one of the most powerful CRM platforms that can redefine your digital journey, foster stronger brand loyalty and engagement, enhance Customer Experiences (CX) and

Leave a Reply

Your email address will not be published. Required fields are marked *