How to get files data in base64 from slack channel.? - slack

Hello how to get files data in base64 from slack channel.
When user add the files to slack channel the response contains the URL of the files. But its possible to get content in base64 ..?

Related

SLACK - read the last image in a channel - get it's URL and send it to an API via a Slack APP

I want to upload a file to a channel, and then type /mycommand which would then read the slack url of the image that was uploaded into the channel and then send that as a argument to /mycommand [url]
I have managed to get my APP working so that I can invoke /mycommand [url] but I need help to figure out how to automate the reading of the last uploaded file vs. having to add the argument url to /mycommand.
Thanks in advance.
To get the URL of the latest shared file you can call the API method conversations.history for the current channel. It will return the list of all message incl. uploaded filed. From that you can filter out file uploads and sort by date to get the URL.
Note that slash commands have a 3 seconds time limit, so you probably want to implement the processing of the channel history asynchronously.

ParseServer: Who to create a temporary file in Cloud Code and send it to browser

I want to generate a file (PDF, txt, csv, ...) in a parse cloud code function and send it directly as download to the browser without saving it on the server.
Is there a possibility to modify the cloud code response (headers, body)?
Or is there an other way to achieve this?

How to ensure that fineuploader sends a streaming upload request instead of MPE request?

I do not see any options to remove parameters or disable sending parameters when uploading using fineuploader. I can only override existing parameters or add new ones. Is there a way to do an upload using PUT without sending any parameters? Since I have signed PUT URI, I don't need to send the parameters. I tried using paramsInBody = false but that adds the content type "octet-stream" to the request. Amazon S3 returns unauthorized because of the incorrect content type.
Note: I am not using fineuploaderS3 since I need to upload to different endpoints.
Edit: Additional information
If the upload is not multi-part, fine uploader is adding the following header
xhr.setRequestHeader("Content-Type", "application/octet-stream");
This causes an authentication error with amazon S3.
I would like not to send default parameters like qquuid, qqparentsize, qqfile and qqfilename in the body since only file data is expected in the body. Setting paramsInBody to false sends them in query string. This works because the URL parameters are ignored by S3 but I would prefer to have an option to not send them at all.
By default, Fine Uploader sends all files as part of a multipart encoded request. To instruct the library to simply send the file as the entire request body, you must set the request.forceMultipart option to false.
Note: It is not possible to prevent uploads sent from IE9 and older to be non-multipart encoded. The only way to upload a file in IE9 and older is via a multipart encoded request.

Configuration setting for decode base64 string to image Mail server

In our application we are reading mail body which client have replied to our mail address and saved it to our database table.
When some clients reply on our email address mail body contains base64 string with header Content-Transfer-Encoding: base64.
Can I know if there is any configuration setting on mail server that it will convert the base64 string into image.
This problem occurs only with some clients not all. I am guessing that these clients have base64 image in their signature.
Any help will be much appreciated.
Please check below image for what response we get in our application.
It isn't the server that needs to convert anything. base64 encoded images are already images.
It is your client, whatever you are using to view the emails that needs to interpret the embedded base64 encoding and display it as an image to you.

Is this the right way to check the hash of uploaded file in web api?

I don't find any example about how to upload file and the file hash in one request. So I think I should break it to two requests. But I don't know if it is right to do like below.
Client send the file hash to the server.
Server go to "wait for file" state, if not received file stream in 30 seconds, then back to "wait for hash" state
Client send file stream to server.
Server receive file stream and check the hash.
Send the hash as a HTTP header.

Resources