Need help with Webhook/endpoint

I’m trying to setup webhooks for Microsoft Graph and may have run into a limitation with Bubble. I’m trying to see if anyone has any ideas/workarounds.

Microsoft has a two step process.

Step 1: Send a call to create the process. This involves Microsoft sending a validationToken back to the endpoint that I specify in the call, which I have to respond back with within 10 seconds (using the “return data from API” step).

Microsoft sends this validation token as a parameter on the endpoint URL. It looks like this:

Here’s the workflow for Step 1.

Step 2: Once I successfully respond with the validationToken, Microsoft sends another response to the same endpoint with a complex JSON object. Since I set a manual definition in Step 1 to grab the validationToken in the Querystring, I need another endpoint, with the same name, setup using the “detect data type”.

The problem I’m having is how to get the first endpoint to fire only when the validationToken is not empty and the second to fire the only when it IS empty. Unfortunately Step 2 does not have validationToken key since I did “Detect Data” instead on “Manual Definition”.


Hi @Kfawcett.

This has worked for me before…

Take your raw json results from the auto detect, paste it into a text editor, and add the missing elements from the manual definition results? Then use postman to hit the bubble end point in its detect data state, which will then detect all the fields you need.

Maybe that will help you?

@mebeingken I thought about that, but I’m not sure how it would help since the “validationToken” is passed in the URL and not in the body. I don’t think there is a way to say “this key will be in the query string” when using the Detect Data option.

Ahh yes, sorry missed that. Perhaps get the validationToken from an action within the endpoint, instead of from the endpoint properties itself? If that isn’t readily available, maybe the new server side script from @mishav Toolbox?

If you can run to writing a tiny bit of Javascript, you could set up a as the endpoint.

And then conditionally call two different Bubble APIs depending on what comes in.


I think a solution like @NigelG’s is the most straightforward.

The API workflow steps and the server script don’t seem to have access to the endpoint’s request url or query parameters.

Thanks @NigelG. I went with for now. Hopefully Bubble could enhance the system so this isn’t needed in the future. For anyone interested, this is the code I came up with to route between two endpoints.

* @param context {WebtaskContext}
* This task routes a request between two different URLs. If the request has a query paramter then it goes to endPoint1, else it goes to endPoint2
var express    = require('express');
var Webtask    = require('webtask-tools');
var bodyParser = require('body-parser');
var proxy = require('express-http-proxy');
var app = express();

app.use("/", proxy('', {
proxyReqPathResolver: function (req) {
  var parts = req.url.split('?');
  console.log("parts " + parts);
  var queryString = parts[1];
  var updatedPath = parts[0].replace('/', '/version-test/api/1.1/wf/');
  var endPoint1 = '/msgraphvalidation?';
  var endPoint2 = '/msgraphsubscription';
  return updatedPath + (queryString ? endPoint1 + queryString : endPoint2);

module.exports = Webtask.fromExpress(app);

Thank you for posting the code. Unfortunately, webtask has been shut down recently. Have you found another workaround, or how have you adapted?