Currently we have a Node JS application, where a method is implemented, responsible for completing client chats with the use of the API, postConversationDisconnect, from the node purecloud-platform-client-v2 library.
We use the same method for multi-region chat, that means that when a request arrives, we currently set the environment and the respective token, prior to executing the method, the problem is that the environments, apparently, are crossing or overwriting, when Requests come from different regions,
example: we set JP environment, but at the time of performing
When executing chat deletion, we see that the url used for deletion is from another region, attached method used.
disconnectChat = async (conversationId, tenant, logger) => {
return new Promise( async (resolve, reject) =>{
try{
let client = platformClient.ApiClient.instance;
client.setEnvironment(tenant.region);
let auth = await client.loginClientCredentialsGrant(tenant.oauthRead.clientId, tenant.oauthRead.clientSecret);
client.setAccessToken(auth.accessToken);
let conversationsApi = new platformClient.ConversationsApi(client);
// Get conversation threading window timeline for each messaging type
await conversationsApi.postConversationDisconnect(conversationId)
.then(() => {
logDebug("[connector][Open Messaging Engine][disconnectChat] Successfully");
resolve();
})
.catch((error) => {
throwerror;
});
}catch(error){
logError("[connector][Open Messaging Engine][disconnectChat] Global : \n" + (typeof error == "object") ? JSON.stringify(error, null, 4) : error.toString(), null, { ...logger, event: "Pure Cloud Open Messaging Event" });
reject(error);
};
});
};