What Are Webhooks?

Webhooks are user-defined HTTP callbacks that are triggered by specific events. When one of those events is triggered, Embedly will send an HTTP POST request to the webhook URL you specify. This request contains details about the event, allowing your application to handle the event data in real-time.

Webhooks enable your application to respond to events as they happen, ensuring that your system stays up-to-date without the need for constant polling.

Common Use Cases for Webhooks

Payment Notifications

Get notified when a payment is successful or fails, and update your records accordingly.

Wallet Updates

Receive updates when a wallet is updated, or deleted.

Transaction Events

Monitor transactions in real-time, enabling immediate action or analysis.

Collection Events

Get notified when a wallet is credited, enabling you to provide service seamlessly.

Setting Up Webhooks on Embedly Dashboard

To start using webhooks, you need to configure them through the Embedly Dashboard. Follow the steps below to set up your webhooks:

1

Log in to the Embedly Dashboard

Begin by logging in to your Embedly dashboard.

2

Navigate to the Webhooks Section

Once logged in, navigate to the APIs & Integration page

3

Configre Your Webhook

  • Click on “Edit”: This will open a form where you can enter your webhook url.

  • Enter the Webhook URL: Provide the URL where you want to receive webhook notifications. Ensure that this URL is accessible from the public internet.

  • Save the Webhook: Save the webhook configuration.

Ensure that your server responds quickly to webhook requests. Webhooks that do not receive a 200 OK response may be retried multiple times by Embedly.

Here’s the guide rewritten using the Steps component to clearly outline the process for handling webhooks in your application:

Handling Webhooks in Your Application

When your application receives a webhook, it’s important to handle it efficiently and securely. Follow these steps to manage incoming webhooks:

1

Step 1: Parse the Incoming Request

Webhooks are sent as HTTP POST requests with a JSON payload.

2

Step 2: Verify the Webhook

If you have set a secret key, you should verify the signature included in the webhook request headers. This verification ensures that the request is authentic and actually from Embedly.

  POST /webhook-endpoint HTTP/1.1
  Host: yourapplication.com
  Content-Type: application/json
  X-Auth-Signature: sha256(secret)
3

Step 3: Respond to the Webhook

Always respond to the webhook request with a 200 OK status code once your application has processed the event. This response tells Embedly that the webhook was received and handled successfully.

  HTTP/1.1 200 OK

Ensure your webhook endpoint is secure. Consider implementing rate limiting and verifying the signature of incoming requests to prevent unauthorized access.