How to get the nowBotID & is it configurable?

Anay Sarkar
Kilo Contributor

How to get the nowBotID ? which is sent with the request from Inbound Rest Endpoint
https://<instance-url>/api/sn_va_as_service/bot/integration

Is nowBotID configurable, Can we pass our own ID?, And how to access it at the Outbound Response ?


Inbound request Body:

  "requestId": "asd2423-sda23-qwe23-we25", 
  "action": "START_CONVERSATION", 
  "enterpriseId": "ServiceNow", 
  "nowBotId": "A85PWLERF"
  "clientSessionId": "", 
  "nowSessionId": "",
  "message":{ 
    "text": "SENDING FROM POSTMAN", 
    "typed": true, 
    "clientMessageId": "ABC-123" 
  }, 
  "userId": "beth.anglin", 
  "emailId": "beth.anglin@example.com", 
  "timestamp": 1588824102, 
  "timezone": "America/New_York" 
}

My Outbound Response at my endpoint:

{
  "requestId": "asd2423-sda23-qwe23-we25",
  "clientSessionId": "",
  "nowSessionId": "",
  "message": {
    "text": "SENDING FROM POSTMAN",
    "typed": true,
    "clientMessageId": "ABC-123"
  },
  "userId": "beth.anglin",
  "body": [
    {
      "uiType": "OutputText",
      "group": "DefaultText",
      "value": "I am sorry but I didn't understand your request.",
      "maskType": "NONE"
    },
    {
      "uiType": "OutputText",
      "group": "DefaultText",
      "value": "Please try giving me your request in a different way. I'm currently better at understanding short sentences.",
      "maskType": "NONE"
    }
  ],
  "score": 0
}
22 REPLIES 22

Muralidharan BS
Mega Sage
Mega Sage

Hi Anay,

NowBotID is nothing but to differentiate bots. Even if you don't use this, the API will work. You can just name your bot and send it as a value. 

Q: How to get the nowBotID in the JSON?

A: This is an ID required to distinguish between multiple ServiceNow bots if you have them. If you only have one ServiceNow bot, you can ignore this field.

 

More on this parameter here,

https://community.servicenow.com/community?id=community_article&sys_id=080e3903dbc4e4107d3e02d5ca96198c

 

Thanks

nagarjun2
Tera Contributor

Hi,

 

I have to configure multiple Provider applications/bots in servicenow. As of now i have configured a bot using OOTB objects and it is working perfectly fine. Now i want to configure few more custom bots in servicenow. Searched many pages but not enough info provided. Request someone to assist me with below queries:

 

1. How to configure multiple bots/Provided application with different static token each?

2. How to configure multiple outbound Rest messages, having respective outbound rest message for each bot.

3. Will this nowBotId helps me somehow?

 

Really appreciate the assistance. Thank you

 

Regards,

Nagarjun S

Step 1:  Make Sure you are using VA API 3.0.0 or the latest. 

Step 2: Create a new record in the sys_cs_provider_application table 

  • a) Open sys_cs_provider_application new record form.  
  •  b) Name = Any Name 
  • c) Provider = VA Bot to Bot Provider 
  • d) Inbound Id  = “Id unique to primary bot” 
  • e) Save 

 

Step 3: Create a new Rest Message (In Virtual Agent API scope) 

  1. Search for Rest Message in filter Navigator and and create a new record (sys_rest_message) 
  2. Give the same name as your sys_cs_provider_application record. (same name as in 2.b) 
  3. Endpoint = Primary bot endpoint 
  4. save 
  5. Open Rest Message Record created at 3.a 
  6. Under Http Method related list: Click on New. And provide the below details
  7. name = postMessage 
  8. HTTP Method = Post 
  9. Configure the EndPoint and save. 

Add the parameter appInboundId in your request body.

{ 
"requestId": "", 
"clientSessionId": "", 
"message": { 
"attachment": {}, 
"text": "", 
"typed":  
}, 
"contextVariables": {}, 
"appInboundId":"same as given in 2.d", 
"userId": “", 
"emailId": " 
} 

 

Note :

1) If appInboundId is not provided in the payload or the appInboundId is invalid, VA API will pick the default provider Application

Hi Rahul,

 

Thank you so much for the reply. It worked

 

I have one more question:

1. From where the subflow: Virtual Agent - Bot to Bot Sender is being called or triggered?

2. There are many flowdesigner flows available for virtual agent api, Where are these subflows being called, searched the system but not able to find.

 

Regards,

Nagarjun S