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

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.

Related

Transfer file among microservices

I have a chain of Microservices (Spring boot/cloud)
UI allows user to download file from file storage, but response returns back throw all microservices. I dont want to download file on each microservice and upload it to next one when response.(I dont want to store in memory, it will cause OutOfmemory error)
Is it possible to return some stream?
Thanks
I would pass back a file reference only (like a url) and only when you need it retrieve the actual file.
So if the Client UI requires an actual file from MicroService 1 I would pass the reference back to MicroService 1 and let that service get the file content and send it to the client.
If the client can resolve a URL/reference itself you could even do with just returning that to the client and then letting the client retrieve the file.
Either way you want to minimize the moving/loading of the file and basically do this at the last possible moment.

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.

CodeIgniter send multiple responses to client

Is there any way when the client sends a request to the CodeIgniter server that it can respond with multiple responses?
For example, this can be a file upload to show how the file is processed in the backend.
Can this be done with an ajax request or do I need sockets for this?
EDIT:
Example situation here
I send a data object to the CI backend to be saved. Let's say on the
backend the following functions has to run on this received data
Inspect data to be secure
search for any similar data
Save data
Create a page based on the data
add some default images to this new page
As you see, these functions may take more then 5 seconds to execute.
Do I need a response from the server every time a task from the list above is completed? Does that make sense?
Another example would be when task 1 is complete the server will send a response saying that task 1 has completed. So the user knows that something is going on.

Shopify webhook verification in parse

I am trying to get a shopify webhook to fill my customer class in parse.com, however something must go wrong. I don't know how to verify the parse response since Shopify sends this webhook out from it's ruby backend. I used requestbin to catch the webhook and I replicated a post request using postman to my parse url and everything works fine. Does anyone know how to debug requests like these? Is there a console in Parse where I can see all the incoming requests and the responses Parse.com sent back?
Try using Runscope for debugging webhooks. Full guide here: https://www.runscope.com/provider-guide/troubleshooting-webhooks - this is more than just a request bin. It's a full transparent proxy that will, like a bin, record the webhook notification, but will also pass it along to the intended destination (your webhook receiver) and record that response as well.

Google Checkout handling URL Callback for order completion?

I'm developing an application that fully implements google checkout and I'm trying to figure out how to access the data sent to the API Callback URL (Specified in Integration settings) when an order has been completed?
Is the data for the completed order being sent via POST data? XML? GET? How do I go about accessing the data sent back to my web application for a completed order?
Any documentation or pointers in the right direction would be greatly appreciated!
Google Checkout will send notification callbacks to your specified callback url as an HTTP POST.
The data is in XML format in the body of the POST.
Some useful links below:
How to configure the web service to respond to callbacks: http://support.google.com/checkout/sell/bin/answer.py?hl=en-GB&answer=70647
PHP library - look at basicapiresponsehandlerdemo.php responsehandlerdemo.php which shows how to parse and respond to callbacks:
http://code.google.com/p/google-checkout-php-sample-code/

Resources