RocketChat send image in WebHook - webhooks

I am writing my Webhook to receive events from Moira. Can someone tell me how to add the resulting binary image to the message. Probably only if you upload it to an external service and take a link from there? Or is it possible to rendering in script and put directry in RockerChat message.

Related

How would my node.js application access an uploaded image on react?

I am working on a react mobile application where the user can take an image with their camera and then my node application can do image processing on that uploaded picture, finally information is sent back to the react side from the node application. The problem I'm currently receiving is that I'm not really sure how to get my node application to access the taken photo.
Would the only way to do this would be to save the photo into some database and then have my node application access it there? Would it be possible to do this without saving the photo to a database?
Thanks for the help.
you could storage the taken photo using a database,but it depends of your requirements if you don't need to have an historical from your image processors (like receive a image X from user USERNAME and it was processed as image Y ).
If you just need to make the process the photo you can send it as base64 string encoded, so you can make a POST request and send that string in a JSON field from your React app to Node.js and when you receive that string you need to decode the message to generate an image, next you cold make your image processing and finally send that image as was received before

Is there a way in IBM Speech recognition service to send URL of the file instead of the File itself

Is there a way in IBM Speech recognition service
http://www.ibm.com/watson/developercloud/speech-to-text/api/v1/
to send URL of the file instead of the File itself.
It is important to me since the recording that I want to send for transcribing are not stored in the same place where the code is running. I am using IBM Java SDK.
You can't send a URL. You need to send the Audio file.
What you can do is register a callback so the service can send you event related to a recognition call.

ESRI GPDataFile as input Parameter to GP Toolbox

Im working with a PHP script that POSTs to a GPService Toolbox (written in python), the first parameter is supposed to be a GPDataFile. From the documentation, it looks like I can set the value of this parameter to a json formatted string literal, {"url", "http://localhost/export/1234567890.kml"}, and the arcpy.GetParameter(0) should handle this object correctly.
Unfortunately I am receiving an error, saying 'Please check your parameters', there are two other parameters on the toolbox but they are just strings and are working correctly. I am working in ArcGIS 10.0.
The overall goal of this interaction is to send a KML file from our SWF/ActionScript to the PHP, which saves the KML to our database and subsequently sends it to the GPService to translate it into a GDB and then to individual shapefile objects that are stored in the database for rendering back to the SWF/Actionscript.
Any help our thoughts on how to get the Toolbox to accept the JSON structure would be greatly appreciated, I would like to avoid having to send the KML contents as a string object to the Toolbox.
Answer can be what maniksundaram wrote in ESRI forum (https://community.esri.com/thread/107738):
ArcGIS server will not support direct GPDataFile upload. You have to upload the file using upload task and give the item id for the GP service.
Here is the high level idea to get it work for any GP service which needs file upload,
-Publish the Geoprocessing service with upload option
Refer : ArcGIS Help (10.2, 10.2.1, and 10.2.2)
Operations allowed: Uploads: This capability controls whether a client can upload a file to your GIS server that the tasks within the geoprocessing service would eventually use. The upload operation is mainly used by web clients that need a way to send a file to the server for processing. The upload operation returns a unique ID for the file after the upload completes, which the web application could pass to the geoprocessing service. You may need to modify the maximum file size and timeouts depending on how large an upload you want your server to accept. Check the local REST SDK documentation installed on your ArcGIS Server machine for information on using an uploaded file with a geoprocessing service. This option is off by default. Allowing uploads to your service could possibly pose a security risk. Only turn this on if you need it.
-Upload the file using the upload url that is generated in the geoprocessing service . It will give you the itemID of the uploaded file in response.
http://<servername>:6080/arcgis/rest/services/GP/ConvertKMLToLayer/GPServer/uploads/upload
Response Json:
{"success":true,"item":{"itemID":"ie84b9b8a-5007-4337-8b6f-2477c79cde58","itemName":"SStation.csv","description":null,"date":1409942441508,"committed":true}}
-Invoke the geoprocessing service with the item id as the GPDataFile input ,
For Ex: KMLInput value would be {"itemID":"ie84b9b8a-5007-4337-8b6f-2477c79cde58"}
-The result will be added to map service with job id if you have configured the view the GP results in a map service. Or you can read the response as it returns.

Can I capture JSON data already being sent with a userscript/Chrome extension?

I'm trying to write a userscript/Chrome extension to capture JSON data being sent while using a web service so that I can reformat it and display selected portion on page. Currently the JSON is sent as the application loads (as I've observed from watching traffic with Fiddler 2). Is my only option to request the JSON again or is capture possible? As I'm not providing a code example, a requested answer is even some guidance on what method / topic to research or if I'm barking up the wrong tree.
No easy way.
If it is for a specific site you might look into intercepting and overwriting part of a code which sends a request. For example if it is sent on a button click you can replace existing click handler with your own implementation.
You can also try to make a proxy for XMLHttpRequest. Not sure if this even possible, never seen a working example. You can look at some attempts here.
For all these tasks you probably would need to run your javascript code out of sandboxed content script to be able to access parent page variables, so you would need to inject <script> tag with your code right into the page from a content script:

Is there a way to detect cancelled download?

Let's say I have a Spring MVC web application and it allows users to download a file. An email is sent at the same time as the file is sent to the user.
Is there a way to detect cancelled download so I could send the email only if the download has been successful?
You need a download script that serves larger files in seperate blocks. When the last block has been served, you can assume (there is no way to know with HTTP) that the complete file was received by the client.
Have a look at questions 157318 and 194579 on how to achieve this in PHP. Since you always use HTTP (or HTTPS) to serve the files, the same principles apply to your question.

Resources