Web Chat: Unique JWT per conversation for back-end service

Hi Genesys Team,

I'd like to use NPM package purecloud-platform-client-v2 for a back-end NodeJS service. It will be supporting multiple conversations in parallel which leads me to my question about setting the JWT token.

When I call postWebchatGuestConversations, I get a unique JWT for the conversation which is good. To use the JWT for requests moving forward I use

ApiClient.instance.setAccessToken(jwt)

However because this is a singleton instance, the same JWT will be used for other calls to postWebchatGuestConversations which might be for different conversations happening in parallel.

I can get around this by calling the REST API directly without using the NPM package, but I wondered if anyone knows how to set the JWT for a specific request.

Thanks,
Dave

Hello,

Unfortunately, with the Javascript Platform API Client SDK (the purecloud-platform-client-v2 NPM package), setAccessToken is the only method to set the JWT.

Calling the REST API directly might be more appropriate in your case.
Or you could also create your own version of SDK - starting from the Javascript Guest Chat Client source. This SDK is just about the Guest Chat API (which was then added to the Platform API Client SDK as well).
There is the same constraint to set the JWT (setJwt instead of setAccessToken). But you could modify the existing code to allow the JWT to be provided as a method parameter.
The Guest Chat API (protocol I mean) is likely not going to change - I mean that the different API endpoints are probably not going to change over time.

Regards,

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