Answered

How can we customize the button with Javascript code in Messenger?

  • 29 June 2023
  • 1 reply
  • 86 views

Hi, I’ve just completed the example of building an application in Messenger, and there are a couple of things I want to ask:

  1. Are there any techniques we can use to directly communicate with the parent site from a Messenger App if we are also running a script on the parent site.
  2. If that's not possible, can we relay a message to the parent script through a server using the visitor ID to identify the user.

For example:

  1. Get visitor id in the site script using Intercom('getVisitorId') .
  2. Establish a websocket connection with our server with the visitor id
  3. In the Messenger App, pass a message to the server with the visitor id.
  4. The server can then relay the message to the parent site using the visitor id.
icon

Best answer by Jacob Cox 2 July 2023, 18:21

View original

1 reply

Userlevel 4
Badge +5

Hi @Sơn Hồng !

I would be surprised if you’re able to implement a Websocket via a Canvas Kit App. I believe you’ll need to stick to HTTP requests. You should be able to make an API call to your parent server, though! Are you running into issues with it somewhere in that process?

I would recommend reading over our docs for building Canvas Kit Apps, especially the Build an app for your Messenger section since that seems to be the most appropriate. The details on request flows that are located there might prove helpful.

Reply