Web messaging Using Headless Mode SDK Javascript

Hi, I am trying to integrate the Web messaging with Headless Mode Enabled, I would like to have the steps to be followed in this process.

I have Created the deployment configuration with Headless mode enabled, now do i need authentication access token?

Should i create the Whole Chat window and tie all the events with Web messaging API Commands and events?

Does still the Native UI comes up if we call messenger.open in headless mode?

I want to have a clear picture of this Headless mode. Can someone help me with the steps and access required for accessing the APIs Make REST API Calls?

@Angelo_Cicchitto , Can I have some help on this? please.

Hi @kameysh,

If I understand correctly, you want to use Messenger Headless mode SDK with Authentication enabled? Assuming yes, here is how you would do it:

  1. After you created the deployment configuration, next step is to get the sinppet for deployment in your webpage (see details here). This purpose of this snippet is to initialize Messenger based on the configuration you choosed.

  2. When using Web Messenger in headless mode, it will not have its own UI. So yes, you will need to build your own UI for your Chat application, then use MessagingService plugin commands to make API requests and subscribe to events to make your Chat UI react accordingly. This plugin will be available for usage in Headless mode. There are lots of commands and events available to build your Chat application, please refer here to Messenger Headless mode SDK and MessagingService plugin. Native Messenger UI will not come up even when you use UI commands like Messenger.open, in Headless mode all UI plugin commands will be rejected.

  3. To integrate with your authentication, yes you will have to write your own AuthProvider plugin as documented here. The purpose of this plugin is to provide us your auth token, so you will have to resolve these commands with them. This script should be placed right below the deployment script. Messenger will call these commands as needed like while initializing, when token expires, etc. So, please ensure your AuthProvider commands resolves with valid tokens.

About how you will work with headless mode, I can give a simple example:

Say you want to start conversation - on click of start chat button in your Chat UI, you would call MessengingService.startConversation command by passing any required data, this would make the API request to setup WebSocket connection. To know if it has successfully setup connection, you can either use the success callback function that gets called or listen to MessagingService.started event. If any errors, then the error callback function of this command will get called, there is also generic MessagingService.error event published, this applies to all other errors as well. Once you have setup the connection, then you can use the MessagingService.sendMessage command to send a message. There are many commands and events available, I suggest you please go through our entire documentation to understand what all can be done.

Hope I answered what you are looking for to get started. Let me know if any other questions.

About AuthProvider plugin, here is a blue print working code for reference while writing your plugin - Messenger with Authentication.

2 Likes

Hi @Ranjith_Manikante_Sa, this is amazing response. I get this flow now. My doubt here is, what is they difference between having with Auth and non Auth? I'm going to implement this in my website, should I need Auth? Why cannot I use it without auth?

Please clarify on this so I could have a clear cut expectations set.

@kameysh, glad you are able to follow this now.

About Auth, if your website is using Oauth authentication (user login) and you want to integrate with that, then Messenger can support it. Point #6.i in Configure Messenger - Genesys Cloud Resource Center. In this way, Messenger would show up only after user has logged in to your website. For this you need to enable auth in Messenger configuration and write AuthProvider plugin. But, you don't necessarily need to do that, only if you want to integrate.

If you don't enable authentication in Messenger configuration, then you can still integrate and run Messenger normally in your website.

Yes @Ranjith_Manikante_Sa. Thank you for explaining it well about integrating with Auth And Non Auth. This helps a lot.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.