How to add my own APIid and Masterkey on Moralis Webhook?

I just launched my self hosted server on AWS and this is how I start the server and Moralis.

However, when I tried to put the webhook in the Moralis Admin, it’s not receiving on my server.

When I tried it on Postman, my webhook works properly.


const server = new ParseServer({
.....
});


app.post('/webhook', async (req, res) => {
  const { body, headers } = req;

  try {
    Moralis.Streams.verifySignature({
      body,
      signature: headers["x-signature"],
    });

    return res.status(200).json();
  } catch (e) {
    console.log("Not Moralis");
    return res.status(400).json();
  }

});

const startServer = async () => {

  server.start().then(async () => {

    await Moralis.start({

      apiKey: 'MORALISKEY',

    });

  });

  app.listen(1337, function () {

    console.log('parse-server-example running on port 1337.');

  });

};

startServer();

what webhook url did you use? did you use ngrok as a proxy in case that you server url is not publicly available on the internet?
do you see any error for the webhook requests in the history?

you can check the history here:

I deployed my server.js on AWS so I used my aws-public-url:1337/webhook.

So it requires my own api_id and serverkey from my parse server

where is this required? that should be a simple webhook url that doesn’t require anything like app id or master key

When I tried to use postman, it requires me to put my X-Parse-Master-Key X-Parse-Application-Id in the headers in order for my webhook to receive information.

I like it that way as well so that I can filter the bad actors who would try to send some data on our webhook.

There is a signature in the webhook request that you can validate. It sounds like you used a cloud function if it requires extra info

Can the Moralis Stream send data to an HTTP webhook?

Maybe that’s the issue, http://aws-server.mydomain.com:1337/webhook

This is the public link for my webhook url

Streams API sends a HTTP POST request to that url, and it has to receive status code 200 as response.