cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
229
Views
0
Helpful
3
Replies

Download Images uploaded to webex (to a Chatbot account) using APIs

santosha v
Level 1
Level 1

Hi,
How to download Images uploaded to webex (to a Chatbot account) using API call?
I am able to download other Files uploaded to Webex (Like txt,docx etc..) using the "Files" Element details I get while user uploads a file, However, When user uploads Image There is no such Element preset.

From the "Browser I am able to Find out It is making about 4 API calls to download an Image, However, I am unable to replicate the same Via Postman or code (Python).
image.png
Any Lead on how to download the same would be appropriated.

3 Replies 3

santosha v
Level 1
Level 1

Hi @sandiban ,

Thanks for the response,  I am able to download the Files (Including the Images) using the Above method (Ie. First get the message details, then get the File location from the message details)..

However, The issue is, If a user uploads Any non Image file.. We get the Message details like below.. (Through the pre established Websocket) , From which  we can directly get the file link.

santoshav_0-1716368927063.png

 


However, When an Image is uploaded, We do not get such details Insted, We will get message details like below in which There is no Message ID or the File path..
santoshav_1-1716369287853.png

 




, So We will have to Check the list of messages separately again to get the file name.

I would like to Get the Link for the Images (Or at least the Message Id information) from the websocket message from Webex (Just like Shown in Image 1 for other file types).

Thanks again for the Previous reply.

As accessing Webex API messaging events via websocket is only supported if using the official JavaScript SDKs, it's likely the Webex engineers will be precluded from being much help

As you seem to be using the unofficial/community webex_bot Python project to do the websocket stuff, you may need to inquire with the maintainer/contributors there (and be aware that things built using an unsupported SDK may break at any point without warning, and Webex will not be able to engage for troubleshooting/fixes.)

If using one of the JS SDKs is not possible, you might look at the Hookbuster project, which is based on the JS SDK and acts like a transparent websocket<->HTTP proxy in front of your app (which can be Python or anything else...)

sandiban
Cisco Employee
Cisco Employee

Hi @santosha v,
Could you kindly share which API you're using here?
I believe you're possibly trying to get the details of the message through list-message API - https://developer.webex.com/docs/api/v1/messages/list-messages

Correct me if I'm wrong!

So, when it's about an image download - in the API response, you should be able to find a response parameter called "files".
And the value of this "files" parameter should be like "https://webexapis.com/v1/contents/Y2lzY29zcGFyazovL3VzL0NPTlRFTlQvND..."

Now you can run this "files" parameter value which is nothing but a API URL again from POSTMAN or, through your Code and you should be able to view the image and even download it from there with the help of your code.
Now, please note - Webex message API only supports .jpeg, .jpg and .png type only and it also supports .gif as well. More you can read from here about supported message attachments format - https://developer.webex.com/docs/basics#message-attachments

Please check if your image is about any other format type, then it won't be supported though.

Regards!
Sandip