Skip to content

Configure AvenPing outbound webhooks

Configure the HTTPS URL where AvenPing posts event JSON (new messages, leads) — the same data as Settings → Webhook Settings. These routes do not require phoneNumberId.

Base: /v2/webhooks

Auth + Premium/Enterprise + active plan required. See HTTP API v2 Overview — Access rules. These routes do not require phoneNumberId.

Also read: HTTP API v2 Overview

Prerequisites

  • An API token and Premium/Enterprise plan (Authentication)
  • An HTTPS (or HTTP) URL on your server that can receive POST JSON
  • Access to Settings → Webhook Settings in the app if you want to compare dashboard values

Step-by-step

  1. Generate a webhook code
    Call POST /v2/webhooks/generate-code with your token. The API saves a new 64-character hex code and does not change webhookUrl.

  2. Save URL and code together
    Call POST /v2/webhooks/config with JSON { "webhookUrl": "https://...", "webhookCode": "..." }. Both fields are required. Invalid URL or missing fields return 400 VALIDATION_ERROR.

  3. Confirm the saved config
    Call GET /v2/webhooks/config. The response includes webhookUrl, webhookCode, and reserved isVerified / lastVerified fields (same shape as the app settings API).

  4. Clear the webhook when you are done
    Call DELETE /v2/webhooks/config to stop outbound POSTs. This only configures your AvenPing outbound URL — it does not change Meta Cloud API webhooks.


Configure Webhook Programmatically

This endpoint lets you configure your own webhook URL where you can receive real-time updates from AvenPing — such as notifications for:

  • New incoming messages
  • Lead events (e.g., new WhatsApp lead)

By setting a webhook URL (and webhook code):

  • AvenPing will send HTTP POST requests containing event data directly to your server.
  • You can automate responses or trigger your own integrations based on these events.

Info:
This is primarily for your use: when you configure these details, AvenPing will send outbound JSON payloads to your provided URL whenever an important event (like a new message, or a new lead) happens in your account.

The format and types of events are the same as those in the dashboard’s Settings → Webhook Settings section.

How are webhook details managed?

  • Your webhook configuration is represented by two properties on your account:

    • webhookUrl
    • webhookCode
  • You can retrieve or update these settings via the API routes:

    • GET /v2/webhooks/config
    • POST /v2/webhooks/config

This matches the same operations available in the dashboard UI, so you can automate webhook setup directly from your own backend.

Note: This endpoint is only concerned with delivering updates from AvenPing to your server. It does not handle or modify any direct WhatsApp API or Meta webhook configuration—there’s no involvement with your WhatsApp Cloud API webhooks here.


GET /v2/webhooks/config

Returns the current outbound webhook URL and code (empty strings when unset).

Example:

bash
curl -sS "https://api.avenping.com/v2/webhooks/config" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response 200:

json
{
  "success": true,
  "data": {
    "webhookUrl": "https://example.com/webhooks/avenping",
    "webhookCode": "hex_secret_from_generate_or_dashboard",
    "isVerified": false,
    "lastVerified": null
  }
}

isVerified and lastVerified are reserved for future use; they match the shape returned by the app settings API.


POST /v2/webhooks/config

Saves both webhook URL and webhook code. Both are required (same rule as the dashboard).

Body (JSON):

FieldTypeRequiredDescription
webhookUrlstringYesMust be a valid http: or https: URL
webhookCodestringYesShared secret string (generate via endpoint below or UI)

Example:

bash
curl -sS -X POST "https://api.avenping.com/v2/webhooks/config" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"webhookUrl":"https://example.com/hooks/avenping","webhookCode":"YOUR_CODE"}'

Response 200: same data shape as GET /v2/webhooks/config, with updated values.

Errors: 400 VALIDATION_ERROR for missing fields or invalid URL.


DELETE /v2/webhooks/config

Clears webhookUrl and code for the authenticated user (stops outbound POSTs to your URL from AvenPing processing).

Example:

bash
curl -sS -X DELETE "https://api.avenping.com/v2/webhooks/config" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response 200:

json
{
  "success": true,
  "data": {
    "cleared": true
  }
}

POST /v2/webhooks/generate-code

Generates a new random webhook code (64 hex characters, same algorithm as Settings → Webhook Settings → Generate New in the app) and saves it on your user. It does not change webhookUrl. After this, call POST /v2/webhooks/config with your URL and the new code if you are configuring from scratch.

Example:

bash
curl -sS -X POST "https://api.avenping.com/v2/webhooks/generate-code" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Response 200:

json
{
  "success": true,
  "data": {
    "webhookCode": "new_hex_string"
  }
}

FAQ

Does this configure Meta Cloud API webhooks?

No. These routes only set your outbound URL and code on the AvenPing user. Incoming WhatsApp traffic still hits AvenPing; the app forwards event JSON to your URL when configured.

Is this the inbound Custom webhook event URL?

No. Custom webhook events are inbound (POST to a private Events link). These /v2/webhooks routes only configure outbound Settings → Webhook Settings. See How to trigger a WhatsApp event from a custom webhook.

Does generate-code change the webhook URL?

No. POST /v2/webhooks/generate-code saves a new 64-character hex code only. Call POST /v2/webhooks/config with both URL and code to finish setup.

What validation errors can I get?

POST /v2/webhooks/config returns 400 VALIDATION_ERROR when fields are missing or webhookUrl is not a valid http: or https: URL. Both webhookUrl and webhookCode are required (same rule as the dashboard).