"vaInputs.user" returning invalid sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 11:27 PM
I am trying to access the "Check IT Ticket Status" topic using the Virtual Agent API but I keep getting the response that "You have no active incidents or request items". When I test the same on the Virtual agent designer it works fine, the problem is only when I use it through the API.
When I was exploring this I noticed that "Check IT Ticket Status" runs a script at the beginning of the conversation which uses the "vaInputs.user" record variable to fetch all the incidents of that user. While using this topic with the API "vaInputs.user" is returning a random value instead of the current user's "sys_id".
Am I missing out on something in the request body? Or a configuration on the instance?
My request body looks like this -
```
{
"requestId":"some id",
"message":{
"attachment":null,
"text": "Check IT Ticket Status",
"typed":true
},
"userId": "sys_id of the user",
}
```
- Labels:
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 12:44 AM
Hi,
Since you mentioned you are using API then which user is used for API authentication?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 03:50 AM
Hi
We are using the OAuth token of the currently logged-in user.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 12:55 AM
Hi Raghav,
According to the docs, the userID is auto linked to their ServiceNow profile if their email address is specified in the request. The bot API docs page says, that you can include an emailId property to the request body.
"Required when enabling account linking, otherwise all users are considered guest users. Email address of the chat client end-user; the person the bot is interacting with."
I hope it helps.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 02:32 AM
Hi
I tried sending the "emailId" field in the request body but it is still showing the same behavior.