Question

Freshchat API Integration: Help Client Subscribe to Conversation (P2P)

  • 26 July 2021
  • 0 replies
  • 124 views

My situation is this: I am a developer attempting Freshchat API integration with our web application.

I cannot use the default Freshchat widget as the iframe it creates doesn't play well with our url router.

Starting the conversation seems like it would be easy enough:

 

  1. Secret keys are stored on server (not public)

  2. Wrap Freshchat API calls on the server side

  3. Client asks for a new conversation (make or lookup userId)

  4. Client starts new conversation

  5. Agent on Freshchat receives the message

 

 

The Wrinkle

My agent can reply in Freshchat to the message, but how can I send that data back to my client?

My Stack will not allow me to send my client an unprompted message—we work on RESTful API calls. I cannot register webhooks because there would not be a feasible way to ensure any data goes to the correct server my client is connected to, nor a reliable way to update my client from the server with that data.

My Question

Are there any P2P examples where my client can interface Freshchat with the conversation directly? I cannot use an iframe to display the Freshchat widget, but could I create a connection (perhaps an open socket) between Freshchat and my client to exchange messages directly?

Any code samples or advice would be helpful.

Concerns

I do NOT want any secure keys running on my client (API Tokens, Agent keys, etc.)

Any example code forming such a connection from client to Freshchat on P2P would need to keep those protected keys from becoming public to the client.


0 replies

Join the Community or User Group to Participate in this Discussion

Reply