"vaInputs.user" returning invalid sys_id

Raghav Aggarwal
Giga Contributor

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",

}

```

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Since you mentioned you are using API then which user is used for API authentication?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar 

We are using the OAuth token of the currently logged-in user.

Richard Kiss1
Kilo Guru

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

Hi @Richard Kiss 

I tried sending the "emailId" field in the request body but it is still showing the same behavior.