Integrate PureCloud with devkit library in Angular

Hello! I need help to use the Callback API, we are using Angular 7.3 with Node JS and we are not able to communicate with the Callback API, here's what we have done so far:

  1. We implement the code of Node.js within a function that is activated with a button from the web using the Callback tutorial.

  2. We put it inside the function ejecutarCall() inside the component:

3.In this case you are not receiving Purecloud methods, to solve this we went to the Purecloud forums to find out if other users had encountered the same problem and we found this post with a possible solution:

in this post Anders_Vejen integrated PureCloud With Angular by installing a Webpack library by adding by npm and editing the Angular.json file with the following:

"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./custom-webpack.config.js",
"mergeStrategies": { "resolve.mainFields": "prepend" }

At this point we encounter with a building error because we use the devkit (@angular-devkit/build-angular:browser) library not webpack.

Is there a way to integrate PureCloud with devkit library in Angular?

Hope someone could help us to find the solution!

Thanks in advance

Based on your code, this shouldn't have anything to do with angular. If you're using client credentials, 100% of the SDK code has to reside in the node service (assuming you're using node w/express or something). You cannot use client credentials in a web app because is not possible for a browser to handle a client secret securely. Responses to client credentials grants intentionally do not send CORS headers to prevent it from working in a browser.

If you are intending to use the SDK client-side in your angular app, you will need to implement the implicit grant (use the SDK's helper for it) and authenticate as a PureCloud user. I'm not familiar with angular, so I can't instruct you on specifically how to make angular work. But what you need to do is tell angular how to find the ES6 source files so it can bundle them however it wants. This may be done via instructing angular to use the jsnext:main entry point in the package or directing it to the path in the package where it can find the source files (entry point is src/purecloud-platform-client-v2/index.js).

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