Adding a GET endpoint for a callback WebHook

I have a 3rd party provider that will trigger an action (That I will then go on to execute some cloud code) and they wish to have a webhook to call, they can make a simple GET request (Including a few parameters) to trigger the action on my side, to a URL i provide them,

I didn’t really want to setup an entire separate service to listen for this webhook, and would somehow like to add it to my existing parse-server.

I have seen on old forums that it used to be possible to do this by adding an express route somewhere but I cant see where that is easily possible.

Currently, I have tried adding a GET request to the mountRoutes section in the functionsRouter;

  this.route('GET', '/whatever', FunctionsRouter.handleMySpecificRequest);

but at this point, a call would still require an API key adding, which I’m unable to have the caller provide. They can simply call a get request. Is there any easy way to disable the need for an API key or any specific header for this request? It would be ideal as handleMySpecificRequest can still be in Cloud Code JS file.

Any ideas of how I might add a simple GET endpoint and a function, or how to disable the need for an API key for this endpoint? Or any other ideas of how to handle it?

Thanks!

There are two options:

Using Webhooks (recommended):

Just follow this instructions (http://docs.parseplatform.org/cloudcode/guide/#cloud-code-webhooks) and let me know if you need any help.

Creating a new express.js route:

I am supposing that you are mounting your Parse Server in an Express.js app. So it would be something like this:

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();

var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/dev', // Connection string for your MongoDB database
  cloud: '/home/myApp/cloud/main.js', // Absolute path to your Cloud Code
  appId: 'myAppId',
  masterKey: 'myMasterKey', // Keep this key secret!
  fileKey: 'optionalFileKey',
  serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
});

app.get('/whatever', async (req, res) => {
  // Do whatever you need to do here
});

// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

app.listen(1337, function() {
  console.log('parse-server-example running on port 1337.');
});