If you’ve ever wondered, “How do I retrieve a file using the API – it’s just a URL with an encrypted ID!”, this example should hold the answer. It uses a bot to download a file sent to a 1:1 room (a conversation between the bot and a single user), using a webhook. If your bot is in a group room, it will only be able to retrieve files where the bot is explicitly mentioned, like @botname.
For additional help creating a webhook, we recommend checking out our webhook blog and our simple (but complete) bot demo.
Alternatively, if you’re using an access token retrieved using Oauth, you can retrieve the messages in a room with this function.
In the Webhooks Explained page, the section titled Handling Requests from Spark describes the format of webhook messages. When a file is sent to the 1:1 room with the bot, the webhook will send JSON to your server containing a files key, under the data element, in addition to the other attributes such as personEmail:
The files attribute is a list of URLs (one URL if only one file is sent in a single message, multiple URLs if more than one file is sent at the same time) that will be used to retrieve the actual files. The URL for the file will be the request URL in your REST GET, and you’d just need to then pass the bot’s authentication token in a Bearer authorization header to retrieve the details (because who can view the file is limited to who is in the room – again though, in a group room, a bot’s permission is limited to messages in which it is also mentioned).
Information and additional examples on retrieving messages is detailed here.
The “Content-Disposition” header in the GET response is used to determine the file’s name and file type to be saved. The file data is the entire body of the GET response. There is no base 64 or other special encoding of the file data, so it can be written directly to the destination. So if we were retrieving an image from our example above, we would run the GET on:
The below code is an app that receives the data from the webhook and - if the data contains a files key - attempts to download the files directly to the source folder from where it is run (so if the app is located in your /Documents/Files folder, it will download the file to /Documents/Files).
I need to run UC-One Desktop Client in call control mode.Found some instructions but don't understand how to apply them to Broadworkds sandbox solution.Which Login URL should I enter to run in call control mode?As I understood I should enter the ...
I would like to do a couple of tests from "BroadWorks Services – Meet-Me Conferencing" chapter of SIP Phone Interoperability Test Plan. Test plan says "As group administrator, browse to Meet-Me Conferencing → Meet-Me Conference Bridges".But unab...
Hello,I'm having a problem with making Jabber Guest SDK v11.2.0 work with Android 10. it's working fine with Android 9 (API 28)I attached a screenshot of the problem I'm gettingDoes this version of the SDK support Android 10 (API 29)? Thanks