Virtual Agent API is throwing an error

Kushal9
Mega Contributor

Hi, I am working on chatbot integration using Virtual Agent API but when I am trying to send the payload to the OOB endpoint i.e https://instancename.service-now.com/api/sn_va_as_service/bot/integration using Resi API Explorer, I am getting the below-mentioned errors. I tried investigating on my own by checking Script Include which is being called from Scripted Rest API but it seems like the line which is highlighted in the snapshot below is not getting called.

Any input would be highly appreciated 🙂

Errors:

find_real_file.png

 

 

Script Include:

find_real_file.png

 

 

Payload:

{
"requestId": "302bas2be70-sadsa-we32-3eq2-1231ra9",
"action": "START_CONVERSATION", 
"botToBot": true,
"clientSessionId": "",
"silentMessage": false,
"message":{
"text": "hola",
"typed": true
},
"userId":"kushal.tiwari",
"emailId":"kushal.t@enableps.com",
"timezone":"America/New_York"
}

 

1 ACCEPTED SOLUTION

Muralidharan BS
Mega Sage
Mega Sage

HI Kushal,

This error is seen because you have not added token, I had same error. You can use static or hash token. 

Try with a static token in this case, it should work. 

Go to 

- token_verification - create a token like below

find_real_file.png

- message_auth 

find_real_file.png

 

Finally check if the sys_cs_provider_application is linked to the message_auth above. Then amend the payload like below. 

{
"requestId": "302bas2be70-sadsa-we32-3eq2-1231ra9",
"action": "START_CONVERSATION", 
"token": "abcd",
"clientSessionId": "",
"message":{
"text": "",
"typed": true
},
"userId":"kushal.tiwari",
"emailId":"kushal.t@enableps.com",
"timezone":"America/New_York"
}

 

 

View solution in original post

4 REPLIES 4

Muralidharan BS
Mega Sage
Mega Sage

HI Kushal,

This error is seen because you have not added token, I had same error. You can use static or hash token. 

Try with a static token in this case, it should work. 

Go to 

- token_verification - create a token like below

find_real_file.png

- message_auth 

find_real_file.png

 

Finally check if the sys_cs_provider_application is linked to the message_auth above. Then amend the payload like below. 

{
"requestId": "302bas2be70-sadsa-we32-3eq2-1231ra9",
"action": "START_CONVERSATION", 
"token": "abcd",
"clientSessionId": "",
"message":{
"text": "",
"typed": true
},
"userId":"kushal.tiwari",
"emailId":"kushal.t@enableps.com",
"timezone":"America/New_York"
}

 

 

Hi Murali,

 

It seems to be working fine now. Thanks mate for the response.

Thanks

You've welcome mate!

KushalT
Tera Contributor

Hi Murali,

When I am trying to access the same endpoint with the same payload from Postman, I am getting 400 Bad request error and no log is getting printed either.

Thanks