Legacy Dev Forum Posts

 View Only

Sign Up

Scripts - Get User Extension - Integration/ Data Action

  • 1.  Scripts - Get User Extension - Integration/ Data Action

    Posted 06-05-2025 19:09

    alialjohani | 2018-10-16 13:44:22 UTC | #1

    Hello Everyone,

    I am integrating Web CRM application with PureCloud. Each user in Web CRM has ID, and I need this ID in the script. Each user in PureCloud has an extension same as his Web CRM id.

    My question, how can I get/show this extension number inside script?

    One I was thinking of is to create action that calls /api/v2/users/me, so each user, when the script is opened for her/him, then her/his ID should be at least presented. Unfortunately, the action for /api/v2/users/me is not working with me:

    REST call for action execute failed. Message:Request to backend service failed. Response from web service: {"status":400,"code":"not.a.user","message":"This request requires a user context. Client credentials cannot be used for requests to this resource."} [30a5dfeb-c421-4f84-b16d-XXXXXXXXXXXX]

    { "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "1b597966-0c4f-43af-812e-990024ddbe25", "details": [], "errors": [ { "status": 400, "code": "BAD_REQUEST", "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"status\":400,\"code\":\"not.a.user\",\"message\":\"This request requires a user context. Client credentials cannot be used for requests to this resource.\"} [1b597966-0c4f-43af-812e-990024ddbe25]", "messageParams": {}, "details": [], "errors": [] } ] }

    Best Regards, Ali


    tim.smith | 2018-10-16 12:40:16 UTC | #2

    That error message is correct. You can't use APIs that require a user context with client credentials.

    There's a script variable that has the agent ID. Use that as an input to your data action to look up the user.


    alialjohani | 2018-10-16 13:40:58 UTC | #3

    Thank you, Tim.

    I used this API /api/v2/users/{userId} in which userId is Scripter.Agent ID, as Tim suggested.

    Best Regards, Ali


    system | 2018-11-16 13:41:03 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 3745