Vexor

vexor.webhook()

Webhook Handling

Handle all webhooks from all platforms with a single method. No need to specify the platform and handle webhook secrets tokenization, decryption or signature verification; Vexor does it all and returns a standardized response.

The vexor.webhook() method requires the Vexor instance to be initialized with a secret key for security reasons.

Methodvexor.webhook(req)

vexor.webhook()

Define a webhook handler in your app, indicate the path in the platform's webhook settings and use this method to handle the webhook. It will return a standardized response for all platforms.

Parameters

Returns

Returns a Promise that resolves to a VexorWebhookResponse object.

import { vexor } from '@lib/vexor'; // Adjust the import path as necessary
export default async function handler(req, res) {
try {
 
const webhookResponse = await vexor.webhook(req);
 
res.status(200).json(webhookResponse);
} catch (error) {
res.status(400).json({ error: error.message });
}
}

Usage Examples

Here are some examples of how to use the vexor.webhook() method:

Usage

  1. usage:
import { vexor } from '@lib/vexor'; // Adjust the import path as necessary
 
export default async function handler(req, res) {
 
  try {
 
  const webhookResponse = await vexor.webhook(req);
  res.status(200).json(webhookResponse);
 
  } catch (error) {
  
  res.status(400).json({ error: error.message });
  
  }
}

On this page