Property 'PureCloudRegionHosts' does not exist

Hi, Im having trouble to get PureCloudRegionHosts property. I'm importing 'purecloud-platform-client-v2' inside my TypeScript project this way:

import  platformClient = require("purecloud-platform-client-v2")
const client = platformClient.ApiClient.instance

Following the Integration Open example, I have this code:

client.setEnvironment(platformClient.PureCloudRegionHosts.us_east_1) // Genesys Cloud region

// Manually set auth token or use loginImplicitGrant(...) or loginClientCredentialsGrant(...)
client.setAccessToken("your_access_token");

But when I try access the PureCloud RegionHosts property, i got this error message:

Property 'PureCloudRegionHosts' does not exist on type 'typeof import("C:/Users/Guilherme/Desktop/2bebot/GenesysService/typescript_rest-express/node_modules/purecloud-platform-client-v2/index")

I don't believe that's a valid statement. It appears you're working in a CommonJS (node) environment, so try the example here: https://developer.genesys.cloud/devapps/sdk/javascript#commonjs

// Obtain a reference to the platformClient object
const platformClient = require('purecloud-platform-client-v2');

If you're working in an ES6+ environment and meant to use import instead of require, refer to this blog post and project for an example: https://developer.genesys.cloud/blueprints/react-app-with-genesys-cloud-sdk/.

im using CommonJS module...
I tried use two forms

import  platformClient = require("purecloud-platform-client-v2")

and

import  platformClient from "purecloud-platform-client-v2"

The same problem occurs

Can you try the format in the example above that's copied from the docs or the one in the blog?

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