Virtual Agent API: Sending Attachments

Voon
Giga Contributor

Hi,

We are trying to use Virtual Agent API to have users attach images to a Live Agent Chat session.  We were able to to initiate a Live Agent Support session with the following post request via Postman

{
    "clientSessionId": "conversationId",
    "token": "token",
    "message": {
        "clientMessageId": "activityId",
        "text": "Live Agent Support.",
        "typed": true
    },
    "userId": "user.id",
    "emailId": "user email"
}

From Agent Workspace, we were able to accept the chat request and begin the conversation.

We next tried to send an image with the following post request via Postman

{
    "clientSessionId": "conversationId",
    "token": "token",
    "message": {
        "attachment": {
            "clientAttachmentId": "attachmentId",
            "contentType": "image/png",
            "fileName": "google.png",
            "url": "https://www.google.com.my/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
        },
        "clientMessageId": "activityId"
    },
    "userId": "user.id",
    "emailId": "user email"
}
 
The "Active Chat" window in Agent Workspace will then respond with the following replies
 
"We couldn't download your file using the specified URL.  Please check the URL and try uploading again."
 
We tried to look at the logs but there were no logs on downloading the said file.  Does anybody know why Virtual Agent API would give the above error?  Is it a download configuration option? 
 
From the Portal where we have Chat enabled, the Virtual Agent is able to allow users to attach image files without issues.
 
Referring to the following image, the image shows that the user was able to uploading a "lotus flower" image file from his desktop and the "google" image from the URL https://www.google.com.my/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png.  The google image URL is the same URL we are sending to Virtual Agent API via Postman.
 
1 ACCEPTED SOLUTION

Voon
Giga Contributor

This issue is now resolved, with the help from ServiceNow Support and their engineering team.

The reason why attachments and images could not be uploaded via the Virtual Agent API is because trusted media domains were not configured.

To configure trusted media domains, please see https://docs.servicenow.com/bundle/quebec-now-intelligence/page/administer/virtual-agent/task/ccif-secure-file-upload.html

The Provider Channel Identity form may not show the Trusted media domains field.  Please use "Configure -> Form Layout" to make it visible before proceeding to add trusted domains.

We are using the default "VA Bot to Bot Provider Application" in the "Provider Channel Identity" list.

To access the "Provider Channel Identity" list, browse to /sys_cs_provider_application_list.do

 

 

View solution in original post

2 REPLIES 2

Voon
Giga Contributor

This issue is now resolved, with the help from ServiceNow Support and their engineering team.

The reason why attachments and images could not be uploaded via the Virtual Agent API is because trusted media domains were not configured.

To configure trusted media domains, please see https://docs.servicenow.com/bundle/quebec-now-intelligence/page/administer/virtual-agent/task/ccif-secure-file-upload.html

The Provider Channel Identity form may not show the Trusted media domains field.  Please use "Configure -> Form Layout" to make it visible before proceeding to add trusted domains.

We are using the default "VA Bot to Bot Provider Application" in the "Provider Channel Identity" list.

To access the "Provider Channel Identity" list, browse to /sys_cs_provider_application_list.do

 

 

Arjun11
Tera Contributor

Hi @Voon ,

How do we send attachments/images in Virtual Agent API? If the attachment is uploaded in primary bot, where should those attachments be saved? and what are the parameters in api call?