How to fetch role id from product events or any specific epi is available to fetch user role in serverless app?

Hi ,
I am trying to fetch role of updater using onContactUpdate where i cannot find any role in the payload.
And ven i dont find any api to fetch user specific role
eg: i have user email id or id of a user then how to find a role?

Hello @Deiviya_Sivacoumar,
For any serverless event we get the actor key inside the payload of the event. You can extract the user_role from the same, You can refer the payload of onTicketCreate for freshdesk for example here. Please refer the payload structure.

Hope this helps :slight_smile:

@Kunal_Singh Thank you but in freshsale product events(onContactUpdate) i don’t find actor key and no user_role.

Use the “updater” object in payload

immagine

From this object you can retrieve the user id and then retrieve the user to verify its role from this endpoint:

/api/settings/users/[id]

curl --location 'https://domain.myfreshworks.com/crm/sales/api/settings/users/[id]' \
--header 'Authorization: Token token=***'

Response:

{
    "user": {
        "id": 31001010277,
        "display_name": "Rick Sanchez",
        "email": "rick.sanchez@test.it",
        "is_active": true,
        "work_number": null,
        "mobile_number": null,
        "confirmed": true,
        "privileges": "480151747303027623479882627158501324324576175965129291758053931624493568750178661518003289408307490878519343883826626561432312114547644419584",
        "job_title": null,
        "language": "en",
        "last_login_at": "2023-09-01T10:52:36Z",
        "time_zone": "UTC",
        "avatar": null,
        "signature": null,
        "email_tracking": false,
        "access_scope": "global",
        "abilities": [ ... ],
        "auto_create_entity": 2,
        "email_association": true,
        "reply_to": "domain.freshworksmail.io",
        "from": "rick.sanchez@test.it",
        "email_deal_association": true,
        "freshchat_restore_id": null,
        "is_forgotten": false,
        "uuid": "617673117184222517",
        "email_mailbox_ids": [],
        "reports_to_id": null,
        "created_at": "2023-08-23T07:49:40Z",
        "role_id": "31000641142",
        "user_access_type": "FULL_TIME_AGENT",
        "meta": {}
    },
    "meta": {
        "last_login_feature_timestamp": null
    }
}

Hope this helps!

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