Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Microsoft bot integration with ServiceNow Virtual Agent using Virtual Agent API

surajmusmade18
Tera Contributor

Hello,

 

I want to integrate the Microsoft bot with ServiceNow Virtual agent in which I will consume ServiceNow VA as a secondary bot. Using Virtual Agent API I am able to send Inbound requests to ServiceNow VA and also got responses from ServiceNow VA to configured outbound third-party endpoint.

 

I've been using the following API to send requests to ServiceNow VA.

scripted-rest-api-endpoint.png

 

Currently, the responses getting from ServiceNow Virtual Agent on an outbound third-party endpoint but how can we get these responses in my MS Bot?

Also, is it possible to get a response from ServiceNow VA using its BOT integration API without configuring an outbound third-party endpoint in the rest message?

 

Thanks in advance!

 

22 REPLIES 22

@PreranaPolekar It is possible to invoke any topic with a topic name if the user has access to the topic.
Try these steps: 
Make sure there is no active conversation for the user. And send the below request.

{
    "action": "START_CONVERSATION",
    "clientSessionId": "",
    "clientVariables": {},
    "contextVariables": {},
    "message": {
        "text": "Topic Name",
        "typed": true
    },
    "requestId": "",
    "silentMessage": false,
    "timestamp":"",
    "timezone": "GMT",
    "userId": "UserId"
}

 

Apologies @Rahul Kumar3 for the late response ,  I tried what you mentioned regarding starting a specific topic. Following is how my topic looks when I test it on VA portal 

PreranaPolekar_0-1673936781942.png

Following is my request payload same as you mentioned : 

 
{   
     "action": "START_CONVERSATION",
    "clientSessionId": "322bas2be70-sadsa-we32-3eq2-1231ra11",
    "clientVariables": {},
    "contextVariables": {},
    "message": {
        "text": "ServiceNow_Bot_Integration",
        "typed": true
    },
    "requestId": "",
    "silentMessage": false,
    "timestamp":"",
    "timezone": "GMT",
    "userId": "prerana.polekar"
}

 I got the following response from the VA api which didn't match with the content from bot , am I missing something?

 

Response from VA API for the same topic 

{
    "status": 200,
    "content": {
        "requestId": "",
        "clientSessionId": "322bas2be70-sadsa-we32-3eq2-1231ra11",
        "message": {
            "text": "ServiceNow_Bot_Integration",
            "typed": true
        },
        "userId": "prerana.polekar",
        "clientVariables": {},
        "body": [
            {
                "uiType": "ActionMsg",
                "actionType": "StartConversation",
                "conversationId": "925123f71b98a110edeeea48624bcb4f"
            },
            {
                "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"
            },
            {
                "uiType": "TopicPickerControl",
                "group": "DefaultPicker",
                "nluTextEnabled": true,
                "promptMsg": "Hi there, please enter your request or make a selection of what I can help with. You can type help any time when you need help.",
                "label": "Show me everything",
                "options": [
                    {
                        "label": "Live Agent Support",
                        "value": "4f3274687344330025d032e954f6a733",
                        "promoted": false,
                        "enabled": true
                    },
                    {
                        "label": "ServiceNow_Bot_Integration",
                        "value": "fc935dbe1baf9950edeeea48624bcb13",
                        "promoted": false,
                        "enabled": true
                    }
                ]
            }
        ],
        "score": 0
    }
}

@PreranaPolekar : Can you please verify the blow configuration?
1) Does your topic name contains "_"? You should pass the exact name. 
2) Try adding public role to your topic (from conversation builder). If this resolved the issue then you might not have configured message_auth.
3) After configuring message_auth record for VA Bot to bot provider application, you need to pass the token and emailId in the request. (Doc)

 

Hi @Rahul Kumar3  ,

 

I have the same issue where I am unable to initiate a topic using the "StartConversation" action with the below configurations.

  • I passed exact same name as my topic.
  • I have added a public role to my topic.

But I am able to call the topic using utterances that are trained in the NLU model.