Long Polling / Salesforce "Chat"?


Could you give any input into how I would go about implementing a long polling type setup? In particular I’m interested in Salesforce Chat.

I guess it would need a loop, but I’m not sure what input I would submit to the loop to keep the chat going.


Seems like the best way is either a unary or per-trigger protocol thread. It would implement the listening loop. Their API documentation should tell how to build.

Interesting, okay! Thanks. I’ll get to work on it tomorrow.

The choice between a unary vs. per-trigger mainly depends on account information in the incoming data.

See the Jabber unary protocol thread. It is possible for the system to determine the automations to invoke based on the account email address supplied in the incoming message. That email address is what is used when connecting a Jabber account.

A per-trigger thread would be needed if the incoming data doesn’t contain any information needed to identify the connected app account.

Oh – I have to kind of laugh at myself here. I was just looking at the protocol thread for Jabber the other day, and then independently of that, our salesperson said he has a lot of leads for projects involving Salesforce Chat, but I didn’t make the connection. “Duh, Ben.”

I believe a unary protocol thread instead of a per-trigger protocol thread would be the choice for my “project,” as I think I will have that account data you describe.

I still need to figure out how to test whatever I would build. I haven’t found a “chat box” or “chat agent” in Salesforce, which I think would be one side of the communication. And then I would need the other side of the communcation someplace; I suspect I will simply be making API calls via Postman on the other side. A little awkward, but oh well, I guess. I wonder if I could use a chat client like Pidgin for this? Obviously that’s not an Apiant question, but do you care to weigh in on that?

One last question, and this one is Apiant related, almost – it’s about the Jabber protocol thread assembly (1984d8042a8042f680325f9ae0426abe). Is that assembly “in between” the two chatting people? By “in between” I mean, is that assembly intercepting and handling, I mean forwarding on, all traffic between the two people? Alternatively, I could see the assembly kind of being in parallel, that is, only receiving a copy of chats, for processing on its own, for whatever reason.

The reason I’m asking that is because it has bearing on whatever I’m going to do with Salesforce chat, as I’m probably going to mostly copy the Jabber Protocol Thread assembly.

Sorry, don’t know anything about salesforce chat or how to test that.

The Jabber integration does not sit between conversations. The APIANT system has its own Jabber account and is like a Jabber bot. It can send messages to other people, but the sender they will see will be the system’s account and not yours.

All right, I figured out the Salesforce Chat on my own – it was pretty easy actually. However, I’m now trying to decipher what Salesforce means by “long polling,” because their chat API doesn’t seem to be long polling exactly. I have to figure it out.

What exactly is the use case for the Jabber assembly? I’m trying to wrap my mind around that. It sounds to me like someone would just be talking to an “Apiant bot” but why would anyone want to do that?

There are infinite usages for it as with any other triggers and actions in the system, it all depends on what automations they build with it.