How to get a webhook response (from filepicker)


#1

I am uploading and converting files with filepicker and meteor and trying to print the response on my www.mysite/hook so I can use the returned converted file url.

This is the code that I have so far

Server/routes.js

Router.map(function() {

  this.route('hook', {
    path: '/hook',
    where: 'server',
    action: function() {

      // Watch the Meteor log to see this output
      console.log("Hook called.");
      console.log("Headers: ", this.request.headers);
      console.log("Data: ", this.request.body);

      this.response.writeHead(200, {'Content-Type': 'text/html'});
      this.response.write("You wrote: " + this.request.body.message);
      this.response.write("\n");

      // `this.response.end` *must* be called, or else the connection is left open.
      this.response.end('Success!\n');
    }   });

});

and on filepicker set the webhook url example.com/hook

this doesn’t work and I have not idea what to add change? it also won’t work if I test to send something to site.com/hook through my terminal exampe:

curl -H "Content-Type: application/json" -d '{"message":"foo"}' http://example.com/hook