API Reference

If a URL is not specified in the project, no events will be sent.

The URL must begin with the scheme: http or https.

The server response time for data submission must not exceed 3 seconds; otherwise, the connection will be terminated.

The data will be sent in JSON format.

The webhook will always include two elements:

type: responsible for the type of event being sent and can be one of the following: user_property, event, subscription.

data: contains a data array that is unique to each type of webhook.

Example

{
  "type": "user_property",
  data: {
    ...
  }
}

Use https://webhook.site/ for debugging.

Here’s a detailed description of the "user_property" request type:


type: "user_property"

This event is sent every time a property is added or modified and includes the following fields in the data:

(string) project_domain: Contains the domain of the project associated with the property being transmitted.

(string) user_id: A unique identifier for the user for whom the property is set.

(string) property: The name of the property, such as email, lang, etc.

(string) value: The value of the property. If there are multiple values, they are separated by "||".

Example:

{
  "type": "user_property",
  "data": {
    "project_domain": "app.web2wave.com",
    "user_id": "f555ab28-a2b8-447d-9fe9-3c17e6ac70f4",
    "property": "2_question",
    "value": "Of course, yes"
  }
}

type: "event"

Here’s a detailed description of the event that is sent every time an event is added and the fields included in the data:

(string) created_at: The date and time of the event in ISO 8601 format.

(string) user_id: A unique GUID for the user.

(string) project_domain: The domain of the project.

(string) quiz_name: The name of the quiz.

(string) event_name: The name of the event.

(string) event_value: The value of the event.

(array|null) event_properties: A list of event properties.

(string) url: The page where the event occurred.

(string) initial_url: The initial page URL where the user started.

(string) user_agent: The user's user agent string.

(string) user_time: The user's time when the event occurred.

(string) user_locale: The user's language/locale.

(string) app_version: The version of the app.

(string) quiz_version: The version of the quiz.


{
  "type": "event",
  "data": {
    "created_at": "2024-06-12T19:19:18.000000Z",
    "user_id": "f555ab28-a2b8-447d-9fe9-3c17e6ac70f4",
    "project_domain": "app.web2wave.com",
    "quiz_id": "5",
    "event_name": "Answer radio 2_question",
    "event_value": "Of course, yes",
    "event_properties": "{\"value\":\"Of course, yes\"}",
    "url": "https://app.web2wave.com/#2_question",
    "initial_url": "https://app.web2wave.com/?utm_soruce=googgle&utm_campaign=my_campaign",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
    "user_time": "9:19:18 PM",
    "user_locale": "en",
    "app_version": "1.0",
    "quiz_version": null,
    "ab_test": null,
    "additional_data": null
  }
}

type: "subscription"


"data" field structure

This structure provides comprehensive details about the subscription, including creation, payment information, user details, and additional properties if enabled. Fields include the following:

  • (string)created_at : The date and time the subscription was created, in ISO 8601 format (e.g., 2024-10-09 14:05:11).

  • (string)updated_at : The date and time the subscription was last updated, in ISO 8601 format (e.g., 2024-10-09 14:05:11).

  • (string)payment_system : An integer representing the payment system used (e.g., 0).

    • The associated label is in payment_system_label (e.g., "Stripe").
  • (int)real_payment : Indicates whether the payment is in Production mode. 1 for yes, 0 for no.

  • (string)pay_system_id : The unique identifier for the payment in the payment system (e.g., "sub_1Q80ViCsRq5tBi2bvRlKAnIG").

  • (string)project_domain : The domain of the project associated with the subscription (e.g., "quiz.XXXX.ai").

  • (string)quiz_name : The name of the quiz associated with the subscription (e.g., "ADHD Adult - Paywall 2").

  • (string)paywall_name : The name of the paywall used (e.g., "ADHD Adult Paywall 2 - GBP").

  • (string)price_id : The ID of the tariff price (e.g., "price_1Q7OS9CsRq5tBi2byY4Bhz3J").

  • (float)amount : The total amount of final subscription price, in cents (e.g., "2999.00").

  • (float)amount_real : The total amount of final subscription price, in real currency (e.g., 29.99).

  • (string)currency : The currency of the payment (e.g., "gbp").

  • (string|null)canceled_at : The date and time the subscription was canceled, in ISO 8601 format, or null if not canceled.

  • (string)customer : The customer ID in the payment system (e.g., "cus_R00WzLF0qD7IF8").

  • (string)status : The current status of the subscription in the payment system (e.g., "active").

    case ACTIVE = 'active';
    case INCOMPLETE = 'incomplete';
    case INCOMPLETE_EXPIRED = 'incomplete_expired';
    case TRIALING = 'trialing';
    case PAST_DUE = 'past_due';
    case CANCELED = 'canceled';
    case UNPAIND = 'unpaid';
    case PAUSED = 'paused';
  • (string|null)next_charge_date : The date and time of the next scheduled payment, in ISO 8601 format (e.g., "2024-11-09 14:05:06"). Can be null for one-time purchases, non-subscriptions.

  • (string)last_charge_date : The date and time of the most recent payment, in ISO 8601 format (e.g., "2024-10-09 14:05:06"). Can be null for subscriptions without payments.

  • (int)charges_count : The total number of charges made for the subscription (e.g., 1). Can be 0

  • (int)total_revenue : The total revenue generated from the subscription (e.g., 1799). Can be 0

  • (string)user_id : A unique identifier for the user associated with the subscription (e.g., "c1409762-d624-4a47-a330-2a21d108b681").

  • (string)user_email : The user’s email address (e.g., "[email protected]").

  • (string|null)manage_link : A link for managing the subscription via the payment provider (e.g., "https://billing.stripe.com/p/login/XXXXX"). Will be null for non-Stripe payments and if the Customer portal is not set up in settings.

  • (int)total_revenue_usd : The total revenue (in cents) generated from the subscription (e.g., 1799). Can be 0

  • (string)event_type: This is a field that contains the name of the event from the payment system after which this webhook event was sent (e.g., "charge.succeeded", "customer.subscription.updated")

Price Information

  • (object)price : Details about the pricing plan, including:
    • (int)id : Internal ID of the price.
    • (int)plan_id : The ID of the subscription plan.
    • (string)external_id : The price ID in the external payment system.
    • (string)currency : The currency of the price.
    • (float)amount : The base price amount.
    • (string)period : Subscription period (e.g., "month").
    • (int|null)period_interval : The interval for the subscription period (e.g., 1 for monthly). Can be null for one-time purchases.
    • (float|null)trial_period_price : Price during the trial period, if applicable.
    • (int|null)discount_duration_in_billing_periods : Duration of the discount in billing periods.
    • (float)amount_real : The real price after any discounts (e.g., 29.99).
    • (float|null)discount_percent : The percentage discount applied.
    • (float|null)amount_real_with_discount : The amount after applying the discount.
    • (string)price_option_text : A description of the pricing options (e.g., "17.99 gbp / 1 month => 29.99 gbp / 1 month").
    • (object)plan : Information about the plan associated with the price.

"invoices" is a list of objects with subscription invoices (deprecated).

"invoices_new" is a list of objects with subscription invoices.

  • (int)id: The unique ID of each invoice in our system.
  • (string)created_at: The date when the invoice was added to our system.
  • (int)subscription_id: The ID of the subscription in our system to which this invoice belongs.
  • ** (bool) is_refund**: Indicates whether this invoice is a refund.
  • (string)date: The date when the invoice was created on the payment system's side.
  • (int)amount: The payment or refund amount.
  • (int)amount_usd: The payment or refund amount in cents.
  • (bool)is_send_facebook: Indicates whether this invoice was sent to Facebook.
  • (bool)is_send_tiktok: Indicates whether this invoice was sent to TikTok.
  • (string)status: The status of the invoice, which can be one of the following
    • in process - The payment is being processed.
    • Paid - The payment has been completed.
    • Unpaid - The payment failed (completed with an error).
    • Refund - The payment has been refunded.
    • Unknown - The status is unknown (unprocessed). This status appears if the system could not correctly determine the payment status on the payment provider's side.

Additional Fields (if enabled in the project):

If the "Include User Properties to ‘Subscription updated’" parameter is enabled, the event data will also include:

  • (array)properties : An array containing user properties associated with the subscription. Each property includes:
    • (string)project_domain : Domain related to the property.
    • (string)user_id : User ID associated with the property.
    • (string)property : The property name (e.g., "answer_1").
    • (string)value : The property value (e.g., "male").
{
  "type": "subscription",
  "data": {
    "event_type": "charge.succeed",
     "id": 3064,
     "user_id": "c1409762-d624-4a47-a330-2a21d108b681",
     "user_email": "[email protected]",
     "created_at": "2024-10-09 14:05:11",
     "updated_at": "2024-10-09 14:05:11",
     "payment_system": 0,
     "payment_system_label": "Stripe",
     "real_payment": 1,
     "pay_system_id": "sub_1Q80ViCsRq5tBi2bvRlKAnIG",
     "project_domain": "quiz.XXX.ai",
     "quiz_id": "130",
     "quiz_name": "XXXX Adult - Paywall 2",
     "paywall_id": "170",
     "paywall_name": "XXX Adult Paywall 2 - GBP",
     "price_id": "price_1Q7OS9CsRq5tBi2byY4Bhz3J",
     "amount": "2999.00",
     "amount_real": 29.99,
     "currency": "gbp",
     "canceled_at": null,
     "customer": "cus_R00WzLF0qD7IF8",
     "status": "active",
     "next_charge_date": "2024-11-09 14:05:06",
     "last_charge_date": "2024-10-09 14:05:06",
     "charges_count": 1,
     "total_revenue": 1799,
     "manage_link": "https://billing.stripe.com/p/login/XXXXX",
      "user_visit": {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "ip": "192.168.1.100",
        "url": "https://quiz.example.com/learn-language",
        "user_id": "user123-4567-8901-2345-678901234567",
        "created_at": "2024-03-15T10:30:00Z",
        "project_id": "123",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        "visit_number": 1,
        "user_language": "en",
        "user_platform": "Windows",
        "user_zip_code": "90210",
        "is_first_visit": 1,
        "user_city_name": "Example City",
        "user_state_code": "EX",
        "first_visit_date": "2024-03-15T10:30:00Z",
        "user_country_code": "US",
        "previous_visit_date": "1970-01-01T00:00:00Z",
        "utm_source": "example_source",
        "utm_medium": "organic",
        "utm_campaign": "example_campaign_2024",
        "utm_content": "content123",
        "utm_term": "term123",
        "utm_ad_id": "ad123",
        "utm_adset": "Example Ad Set 2024",
        "utm_adname": "Example Ad Name",
        "utm_adset_id": "adset123",
        "utm_id": "campaign123",
        "fbclid": "fb1234567890abcdef"
      },
     "price": {
       "id": 708,
       "plan_id": 17,
       "external_id": "price_1Q7OS9CsRq5tBi2byY4Bhz3J",
       "external_code": "",
       "currency": "gbp",
       "amount": "2999",
       "period": "month",
       "period_interval": 1,
       "trial_period_price": "1799",
       "discount_duration_in_billing_periods": "1",
       "trial_free_period_length_in_days": null,
       "phases": {
         "trial": 0,
         "data": []
       },
       "amount_real": 29.99,
       "discount_percent": 40.01333777925976,
       "amount_real_with_discount": 12,
       "price_option_text": "17.99 gbp / 1 month => 29.99 gbp / 1 month",
       "plan": {
         "id": 17,
         "project_id": 5,
         "payment_system": "stripe",
         "external_id": "prod_PsKBa7ceF91lMm",
         "name": "XX Subscription",
         "description": "",
         "livemode": 1
      }
    },
  "properties": [
    {
      "project_domain": "quiz.yourdomain.com",
      "user_id": "e5b9e7fb-0995-45a3-9727-86a2ed8ff85f",
      "property": "answer_1",
      "value": "male"
    },
    {
      "project_domain": "quiz.yourdomain.com",
      "user_id": "e5b9e7fb-0995-45a3-9727-86a2ed8ff85f",
      "property": "email",
      "value": "[email protected]"
    }
  ]
}