View Categories

Outbound Webhooks

The Outbound Webhooks feature in SCP allows you to notify a custom script or third-party platform in real-time when a specific user action occurs on your site. This is ideal for developers who want to send user data to a custom endpoint for logging, analysis, or external automation.

Automation Flow for Webhooks

This is the core structure that enables outbound webhooks in SCP. It defines what triggers the automation, what action SCP should take, and where the data should be sent.

StepDescription
TriggerEvent inside SCP that starts the automation
ActionWhat should happen when the event happens? That’s the action. You can configure SCP to send a request via webhook to your Automation Platform or Webhook handler script.
PlatformWebhook (Sends HTTP POST request to your script)

🧲 Step 1: Select the Trigger

This is the user action inside SCP that will initiate the webhook.

✅ Supported Trigger Events

  • User gets access to a course
  • User loses access to a course
  • User completes course
  • User completes lesson
  • User gets access to a product/membership
  • User loses access to a product/membership

⚙️ Step 2: Choose the Action

To trigger a call to your webhook script or automation platform, you must select one of the following actions:

  • Add to Email List / Automation
  • Remove from Email List / Automation

This tells SCP to fire the webhook and send user data to your endpoint.


🌐 Step 3: Select Webhook as the Platform

After selecting the action, choose Webhook from the platform dropdown.

Enter the full URL of your webhook handler (e.g., https://yoursite.com/webhooks/handler.php).

You can also enter a secret key that SCP will include in the payload. This can be any string you want. You can use this to make sure that the request is coming from a trusted source (SCP). You can use it to validate the request in your handler and block anything that doesn’t match. If you don’t want to do this validation, you can ignore the secret key value in your webhook handler.


Payload Structure

SCP sends a POST request to your webhook URL with a payload like this:

Array
(
    [action] => REGISTRATION
    [fields] => Array
    (
        [first_name] => John
        [email] => [email protected]
        [signupType] => FREELESSON / FREETOPAIDUPGRADE   // It sends for free lessons and when upgrading from free to paid.
        [billing_address_1] => 123 Main St
        [billing_city] => New York
        [billing_state] => NY
        [billing_postal_code] => 10001
        [billing_country] => US
        [product_name] => Ultimate Funnel Course
        [product_price] => 97.00
    )
    [secret_key] => your_defined_secret_key
)

☑️ Sample PHP Handler Script

Please note: We do NOT offer support for handler script related issues. This is only for developers who are familiar with coding and can write/manage a custom handler script.

Here is a sample php script. You can copy this to a php file and upload to your server. This script will generate a log named webhook-log.txt. It will be in the same folder as where you upload the handler script.

<?php
$logFile = __DIR__ . '/webhook-log.txt';
$data = $_POST;

if (isset($data['action']) && isset($data['fields'])) {
    $log = "Action: " . $data['action'] . "\n";
    foreach ($data['fields'] as $key => $value) {
        $log .= "$key: $value\n";
    }

    // Optional: Check secret key
    if ($data['secret_key'] !== 'your_defined_secret_key') {
        http_response_code(403);
        exit('Invalid secret');
    }

    file_put_contents($logFile, $log . "---\n", FILE_APPEND);
    http_response_code(200);
    echo "OK";
} else {
    http_response_code(400);
    echo "Invalid payload";
}
?>

☑️ Testing Tips for Developers

  • Trigger the webhook by simulating the selected action (e.g., user purchase)
  • Use tools like webhook.site or RequestBin to view real-time payloads
  • Log payloads to a file or database for debugging
  • Confirm your webhook script returns 200 OK quickly


Best Practices

  • Always use a secret key to validate webhook origin
  • Make sure the receiving script is secure and optimized

Scroll to Top