{"id":7689,"date":"2026-03-04T23:56:51","date_gmt":"2026-03-04T23:56:51","guid":{"rendered":"https:\/\/sweepwidget.com\/docs\/webhooks"},"modified":"2026-11-19T10:27:53","modified_gmt":"2026-11-19T10:27:53","slug":"webhooks","status":"publish","type":"post","link":"https:\/\/sweepwidget.com\/docs\/webhooks","title":{"rendered":"Webhooks Integration Guide"},"content":{"rendered":"<p>Receive real-time HTTP POST notifications when people enter your giveaway, complete tasks, or finish all entries.<\/p>\n<p><strong>Plan required: Enterprise.<\/strong><\/p>\n<h3 id=\"overview\">Overview<\/h3>\n<p>SweepWidget provides two ways to receive real-time event data from your giveaways:<\/p>\n<ul>\n<li>Server-side webhooks \u2013 HTTP POST requests from our server to yours. They work on embedded widgets and hosted landing pages. Best for backend workflows like CRM syncing, email triggers and database updates.<\/li>\n<li>Client-side JavaScript callbacks \u2013 browser events fired on the page where the widget is loaded. Best for frontend actions like firing tracking pixels, showing custom UI, or triggering analytics events.<\/li>\n<\/ul>\n<p>Both use the same three event names and similar data. The differences are listed under Events.<\/p>\n<p>On this page:<\/p>\n<ul>\n<li>Setup<\/li>\n<li>Events<\/li>\n<li>Payload Format<\/li>\n<li>Request Headers<\/li>\n<li>Signature Verification<\/li>\n<li>JavaScript Callbacks<\/li>\n<li>Signing Secret<\/li>\n<li>Troubleshooting<\/li>\n<\/ul>\n<h3 id=\"setup\">Setup<\/h3>\n<h4 id=\"server-side-webhooks\">Server-side webhooks<\/h4>\n<ol type=\"1\">\n<li>In the left menu, click <strong>API Integrations<\/strong>. In the <strong>E-commerce &amp; Automation<\/strong> section, click <strong>Webhooks<\/strong>.<\/li>\n<li>Enter your endpoint URL in <strong>Webhook URL<\/strong> (it must start with https:\/\/) and click <strong>Save<\/strong>.<\/li>\n<li>Copy the <strong>Secret Key<\/strong> under <strong>Signing Secret<\/strong> to verify webhook signatures on your server.<\/li>\n<\/ol>\n<p>Click <strong>Send Test<\/strong> to send a test request and confirm your endpoint receives it. The test request has the event name <strong>test<\/strong>.<\/p>\n<p>Note: webhooks are set per brand. They fire for every giveaway in the brand where you saved them. If you manage several brands, set up webhooks in each brand.<\/p>\n<h4 id=\"javascript-callbacks\">JavaScript callbacks<\/h4>\n<p>No dashboard configuration needed. Add an event listener to the page where your SweepWidget is embedded. See JavaScript Callbacks below.<\/p>\n<h3 id=\"events\">Events<\/h3>\n<p>All events fire automatically. There is no per-event toggle.<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>Event<\/th>\n<th>Fires when<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>entry_submitted<\/td>\n<td>An entrant successfully submits the entry form (email, name, etc.). It fires again if a returning entrant submits the form again<\/td>\n<\/tr>\n<tr>\n<td>task_completed<\/td>\n<td>An entrant completes a bonus entry task (follow, visit, share, etc.)<\/td>\n<\/tr>\n<tr>\n<td>all_entries_completed<\/td>\n<td>An entrant has completed every available task<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>Differences between webhooks and JS callbacks:<\/p>\n<ul>\n<li>Webhook <strong>all_entries_completed<\/strong> is sent only right after an entrant completes their last bonus task. If your giveaway has no bonus entry methods, it is never sent.<\/li>\n<li>JS <strong>all_entries_completed<\/strong> also fires when an entrant who already finished everything opens the giveaway again, so it can fire more than once for the same person.<\/li>\n<\/ul>\n<h3 id=\"payload-format\">Payload Format<\/h3>\n<p>Webhooks wrap the data in an event + data + timestamp envelope. JS callbacks provide the data directly in e.detail, and add a timestamp field to it.<\/p>\n<h4 id=\"entry_submitted\">entry_submitted<\/h4>\n<pre><code>{\n  &quot;event&quot;: &quot;entry_submitted&quot;,\n  &quot;data&quot;: {\n    &quot;competition_id&quot;: &quot;12345&quot;,\n    &quot;competition_url&quot;: &quot;my-giveaway&quot;,\n    &quot;user&quot;: {\n      &quot;email&quot;: &quot;user@example.com&quot;,\n      &quot;name&quot;: &quot;Jane Smith&quot;,\n      &quot;phone&quot;: &quot;+1234567890&quot;,\n      &quot;birthday&quot;: &quot;1990-01-15&quot;\n    },\n    &quot;custom_fields&quot;: [\n      {\n        &quot;entry_id&quot;: &quot;101&quot;,\n        &quot;field_type&quot;: &quot;text_input&quot;,\n        &quot;label&quot;: &quot;Company Name&quot;,\n        &quot;value&quot;: &quot;Acme Corp&quot;\n      }\n    ],\n    &quot;entries&quot;: 5,\n    &quot;referral_url&quot;: &quot;https:\/\/sweepwidget.com\/c\/my-giveaway-abc123&quot;\n  },\n  &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot;\n}<\/code><\/pre>\n<h4 id=\"task_completed\">task_completed<\/h4>\n<pre><code>{\n  &quot;event&quot;: &quot;task_completed&quot;,\n  &quot;data&quot;: {\n    &quot;competition_id&quot;: &quot;12345&quot;,\n    &quot;competition_url&quot;: &quot;my-giveaway&quot;,\n    &quot;user&quot;: {\n      &quot;email&quot;: &quot;user@example.com&quot;,\n      &quot;name&quot;: &quot;Jane Smith&quot;\n    },\n    &quot;task&quot;: {\n      &quot;entry_id&quot;: &quot;67&quot;,\n      &quot;entry_method&quot;: &quot;visit_a_page&quot;,\n      &quot;entry_group_id&quot;: &quot;3&quot;\n    },\n    &quot;entries&quot;: 10,\n    &quot;remaining_tasks&quot;: 2\n  },\n  &quot;timestamp&quot;: &quot;2026-03-04T12:01:00+00:00&quot;\n}<\/code><\/pre>\n<p>entry_method is SweepWidget&#8217;s internal name for the entry method (for example visit_a_page).<\/p>\n<h4 id=\"all_entries_completed\">all_entries_completed<\/h4>\n<pre><code>{\n  &quot;event&quot;: &quot;all_entries_completed&quot;,\n  &quot;data&quot;: {\n    &quot;competition_id&quot;: &quot;12345&quot;,\n    &quot;competition_url&quot;: &quot;my-giveaway&quot;,\n    &quot;user&quot;: {\n      &quot;email&quot;: &quot;user@example.com&quot;,\n      &quot;name&quot;: &quot;Jane Smith&quot;\n    },\n    &quot;entries&quot;: 25\n  },\n  &quot;timestamp&quot;: &quot;2026-03-04T12:02:00+00:00&quot;\n}<\/code><\/pre>\n<h4 id=\"test-send-test-button\">test (Send Test button)<\/h4>\n<pre><code>{\n  &quot;event&quot;: &quot;test&quot;,\n  &quot;data&quot;: {\n    &quot;message&quot;: &quot;Webhook configured successfully.&quot;,\n    &quot;website_id&quot;: &quot;123&quot;\n  },\n  &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot;\n}<\/code><\/pre>\n<h3 id=\"request-headers\">Request Headers<\/h3>\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>Header<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Content-Type<\/td>\n<td>application\/json<\/td>\n<\/tr>\n<tr>\n<td>X-SweepWidget-Signature<\/td>\n<td>HMAC-SHA256 signature of the payload body, prefixed with sha256=<\/td>\n<\/tr>\n<tr>\n<td>X-SweepWidget-Event<\/td>\n<td>The event name (e.g. entry_submitted, or test)<\/td>\n<\/tr>\n<tr>\n<td>User-Agent<\/td>\n<td>SweepWidget-Webhook\/1.0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3 id=\"signature-verification\">Signature Verification<\/h3>\n<p>Always verify the X-SweepWidget-Signature header to confirm the request came from SweepWidget. Compute an HMAC-SHA256 hash of the raw request body using your signing secret and compare it to the signature in the header.<\/p>\n<h4 id=\"php\">PHP<\/h4>\n<pre><code>$payload = file_get_contents(&#39;php:\/\/input&#39;);\n$signature = $_SERVER[&#39;HTTP_X_SWEEPWIDGET_SIGNATURE&#39;] ?? &#39;&#39;;\n$secret = &#39;whsec_your_signing_secret&#39;;\n \n$expected = &#39;sha256=&#39; . hash_hmac(&#39;sha256&#39;, $payload, $secret);\n \nif (!hash_equals($expected, $signature)) {\n  http_response_code(401);\n  exit(&#39;Invalid signature&#39;);\n}\n \n$event = json_decode($payload, true);\n\/\/ Process the event...<\/code><\/pre>\n<h4 id=\"nodejs\">Node.js<\/h4>\n<pre><code>const crypto = require(&#39;crypto&#39;);\n \napp.post(&#39;\/webhook&#39;, express.raw({ type: &#39;application\/json&#39; }), (req, res) =&gt; {\n  const signature = req.headers[&#39;x-sweepwidget-signature&#39;] || &#39;&#39;;\n  const secret = &#39;whsec_your_signing_secret&#39;;\n \n  const expected = &#39;sha256=&#39; + crypto\n    .createHmac(&#39;sha256&#39;, secret)\n    .update(req.body)\n    .digest(&#39;hex&#39;);\n \n  if (signature !== expected) {\n    return res.status(401).send(&#39;Invalid signature&#39;);\n  }\n \n  const event = JSON.parse(req.body);\n  \/\/ Process the event...\n  res.sendStatus(200);\n});<\/code><\/pre>\n<h3 id=\"javascript-callbacks-1\">JavaScript Callbacks<\/h3>\n<p>SweepWidget fires browser events when someone enters your giveaway, completes a task, or finishes all entries. On embedded widgets the embed script relays them from the iframe to your page. On hosted landing pages they fire on the page&#8217;s window.<\/p>\n<p>No dashboard configuration is required. Add a listener to the page where your widget is embedded.<\/p>\n<h4 id=\"method-1-individual-event-listeners\">Method 1: Individual event listeners<\/h4>\n<p>Listen for specific events by name. The event data is in e.detail.<\/p>\n<pre><code>window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) {\n  console.log(e.detail.user.email);     \/\/ &quot;user@example.com&quot;\n  console.log(e.detail.user.name);      \/\/ &quot;Jane Smith&quot;\n  console.log(e.detail.entries);        \/\/ 5\n  console.log(e.detail.custom_fields);  \/\/ [{entry_id, field_type, label, value}]\n  console.log(e.detail.referral_url);   \/\/ &quot;https:\/\/sweepwidget.com\/c\/...&quot;\n});\n \nwindow.addEventListener(&#39;sweepwidget.task_completed&#39;, function(e) {\n  console.log(e.detail.task.entry_method);  \/\/ &quot;visit_a_page&quot;\n  console.log(e.detail.remaining_tasks);    \/\/ 2\n});\n \nwindow.addEventListener(&#39;sweepwidget.all_entries_completed&#39;, function(e) {\n  console.log(e.detail.entries);  \/\/ 25\n});<\/code><\/pre>\n<h4 id=\"method-2-catch-all-event-listener-embedded-widgets-only\">Method 2: Catch-all event listener (embedded widgets only)<\/h4>\n<p>On a page with an embedded widget, you can listen for all SweepWidget events with one listener. The event name and data are in e.detail.event and e.detail.data. This catch-all event is not fired on hosted landing pages; use Method 1 or 3 there.<\/p>\n<pre><code>window.addEventListener(&#39;sweepwidget&#39;, function(e) {\n  console.log(&#39;Event:&#39;, e.detail.event);  \/\/ &quot;sweepwidget.entry_submitted&quot;\n  console.log(&#39;Data:&#39;, e.detail.data);    \/\/ {competition_id, user, entries, ...}\n});<\/code><\/pre>\n<h4 id=\"method-3-global-callback-function\">Method 3: Global callback function<\/h4>\n<p>Define a global function that is called for every event. This works even if you add it before the SweepWidget script loads.<\/p>\n<pre><code>window.SweepWidgetCallback = function(eventName, eventData) {\n  \/\/ eventName: &quot;sweepwidget.entry_submitted&quot;\n  \/\/ eventData: {competition_id, user, entries, custom_fields, ...}\n  console.log(eventName, eventData);\n};<\/code><\/pre>\n<h4 id=\"extra-event-instant-win\">Extra event: instant win<\/h4>\n<p><strong>sweepwidget.instant_win<\/strong> fires when instant-win results are shown to an entrant. e.detail contains competition_id and results. This event fires on all plans.<\/p>\n<h4 id=\"example-fire-a-metafacebook-pixel-event-on-entry\">Example: Fire a Meta\/Facebook pixel event on entry<\/h4>\n<pre><code>window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) {\n  fbq(&#39;track&#39;, &#39;Lead&#39;, {\n    content_name: e.detail.competition_url,\n    value: e.detail.entries,\n    currency: &#39;USD&#39;\n  });\n});<\/code><\/pre>\n<h4 id=\"example-google-analytics-event-on-entry\">Example: Google Analytics event on entry<\/h4>\n<pre><code>window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) {\n  gtag(&#39;event&#39;, &#39;giveaway_entry&#39;, {\n    competition_id: e.detail.competition_id\n  });\n});<\/code><\/pre>\n<p>Embedded widgets: events are sent from the iframe to the parent page with postMessage. The SweepWidget embed script relays them as events on the parent window, so your listeners work without extra setup.<\/p>\n<h3 id=\"signing-secret\">Signing Secret<\/h3>\n<p>A signing secret is created automatically the first time you open the Webhooks page on an Enterprise plan. To replace it, click <strong>Regenerate<\/strong> next to <strong>Secret Key<\/strong> and confirm.<\/p>\n<p>Important: regenerating the secret immediately invalidates the old one. Update your server with the new secret right away to avoid rejected webhooks.<\/p>\n<h3 id=\"troubleshooting\">Troubleshooting<\/h3>\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>Issue<\/th>\n<th>Solution<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Not receiving webhooks<\/td>\n<td>Confirm your URL starts with https:\/\/ and your endpoint returns a 2xx status code. Click <strong>Send Test<\/strong> to check. Check that you saved the webhook in the same brand as the giveaway.<\/td>\n<\/tr>\n<tr>\n<td>No all_entries_completed webhook<\/td>\n<td>It is sent only after an entrant completes their last bonus task. Giveaways without bonus entry methods never send it.<\/td>\n<\/tr>\n<tr>\n<td>Signature mismatch<\/td>\n<td>Hash the raw request body (not a parsed\/re-serialized version). Check that your secret matches the one shown in settings.<\/td>\n<\/tr>\n<tr>\n<td>Timeouts<\/td>\n<td>SweepWidget waits up to 5 seconds to connect and 10 seconds in total. Failed deliveries are not retried. Return a 200 immediately and process the data asynchronously.<\/td>\n<\/tr>\n<tr>\n<td>JS callbacks not firing (embedded)<\/td>\n<td>Use the SweepWidget script embed code, not a raw iframe. The embed script relays the events. Add your event listeners before the embed script loads.<\/td>\n<\/tr>\n<tr>\n<td>JS callbacks not firing (hosted)<\/td>\n<td>On hosted landing pages, events fire on the page&#8217;s window; the catch-all &#8220;sweepwidget&#8221; event does not. Verify your account is on an Enterprise plan.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Receive real-time HTTP POST notifications when people enter your giveaway, complete tasks, or finish all entries. Plan required: Enterprise. Overview SweepWidget provides two ways to receive real-time event data from your giveaways: Server-side webhooks \u2013 HTTP POST requests from our server to yours. They work on embedded widgets and hosted landing pages. Best for backend workflows like CRM syncing, email triggers and database updates. Client-side JavaScript callbacks \u2013 browser events fired on the page where the widget is loaded. Best for frontend actions like firing tracking pixels, showing custom UI, or triggering analytics events. Both use the same three event names and similar data. The differences are listed under Events. On this page: Setup Events Payload Format Request Headers Signature Verification JavaScript Callbacks Signing Secret Troubleshooting Setup Server-side webhooks In the left menu, click API Integrations. In the E-commerce &amp; Automation section, click Webhooks. Enter your endpoint URL in Webhook URL (it must start with https:\/\/) and click Save. Copy the Secret Key under Signing Secret to verify webhook signatures on your server. Click Send Test to send a test request and confirm your endpoint receives it. The test request has the event name test. Note: webhooks are set per brand. They fire for every giveaway in the brand where you saved them. If you manage several brands, set up webhooks in each brand. JavaScript callbacks No dashboard configuration needed. Add an event listener to the page where your SweepWidget is embedded. See JavaScript Callbacks below. Events All events fire automatically. There is no per-event toggle. Event Fires when entry_submitted An entrant successfully submits the entry form (email, name, etc.). It fires again if a returning entrant submits the form again task_completed An entrant completes a bonus entry task (follow, visit, share, etc.) all_entries_completed An entrant has completed every available task Differences between webhooks and JS callbacks: Webhook all_entries_completed is sent only right after an entrant completes their last bonus task. If your giveaway has no bonus entry methods, it is never sent. JS all_entries_completed also fires when an entrant who already finished everything opens the giveaway again, so it can fire more than once for the same person. Payload Format Webhooks wrap the data in an event + data + timestamp envelope. JS callbacks provide the data directly in e.detail, and add a timestamp field to it. entry_submitted { &quot;event&quot;: &quot;entry_submitted&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;phone&quot;: &quot;+1234567890&quot;, &quot;birthday&quot;: &quot;1990-01-15&quot; }, &quot;custom_fields&quot;: [ { &quot;entry_id&quot;: &quot;101&quot;, &quot;field_type&quot;: &quot;text_input&quot;, &quot;label&quot;: &quot;Company Name&quot;, &quot;value&quot;: &quot;Acme Corp&quot; } ], &quot;entries&quot;: 5, &quot;referral_url&quot;: &quot;https:\/\/sweepwidget.com\/c\/my-giveaway-abc123&quot; }, &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot; } task_completed { &quot;event&quot;: &quot;task_completed&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot; }, &quot;task&quot;: { &quot;entry_id&quot;: &quot;67&quot;, &quot;entry_method&quot;: &quot;visit_a_page&quot;, &quot;entry_group_id&quot;: &quot;3&quot; }, &quot;entries&quot;: 10, &quot;remaining_tasks&quot;: 2 }, &quot;timestamp&quot;: &quot;2026-03-04T12:01:00+00:00&quot; } entry_method is SweepWidget&#8217;s internal name for the entry method (for example visit_a_page). all_entries_completed { &quot;event&quot;: &quot;all_entries_completed&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot; }, &quot;entries&quot;: 25 }, &quot;timestamp&quot;: &quot;2026-03-04T12:02:00+00:00&quot; } test (Send Test button) { &quot;event&quot;: &quot;test&quot;, &quot;data&quot;: { &quot;message&quot;: &quot;Webhook configured successfully.&quot;, &quot;website_id&quot;: &quot;123&quot; }, &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot; } Request Headers Header Description Content-Type application\/json X-SweepWidget-Signature HMAC-SHA256 signature of the payload body, prefixed with sha256= X-SweepWidget-Event The event name (e.g. entry_submitted, or test) User-Agent SweepWidget-Webhook\/1.0 Signature Verification Always verify the X-SweepWidget-Signature header to confirm the request came from SweepWidget. Compute an HMAC-SHA256 hash of the raw request body using your signing secret and compare it to the signature in the header. PHP $payload = file_get_contents(&#39;php:\/\/input&#39;); $signature = $_SERVER[&#39;HTTP_X_SWEEPWIDGET_SIGNATURE&#39;] ?? &#39;&#39;; $secret = &#39;whsec_your_signing_secret&#39;; $expected = &#39;sha256=&#39; . hash_hmac(&#39;sha256&#39;, $payload, $secret); if (!hash_equals($expected, $signature)) { http_response_code(401); exit(&#39;Invalid signature&#39;); } $event = json_decode($payload, true); \/\/ Process the event&#8230; Node.js const crypto = require(&#39;crypto&#39;); app.post(&#39;\/webhook&#39;, express.raw({ type: &#39;application\/json&#39; }), (req, res) =&gt; { const signature = req.headers[&#39;x-sweepwidget-signature&#39;] || &#39;&#39;; const secret = &#39;whsec_your_signing_secret&#39;; const expected = &#39;sha256=&#39; + crypto .createHmac(&#39;sha256&#39;, secret) .update(req.body) .digest(&#39;hex&#39;); if (signature !== expected) { return res.status(401).send(&#39;Invalid signature&#39;); } const event = JSON.parse(req.body); \/\/ Process the event&#8230; res.sendStatus(200); }); JavaScript Callbacks SweepWidget fires browser events when someone enters your giveaway, completes a task, or finishes all entries. On embedded widgets the embed script relays them from the iframe to your page. On hosted landing pages they fire on the page&#8217;s window. No dashboard configuration is required. Add a listener to the page where your widget is embedded. Method 1: Individual event listeners Listen for specific events by name. The event data is in e.detail. window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) { console.log(e.detail.user.email); \/\/ &quot;user@example.com&quot; console.log(e.detail.user.name); \/\/ &quot;Jane Smith&quot; console.log(e.detail.entries); \/\/ 5 console.log(e.detail.custom_fields); \/\/ [{entry_id, field_type, label, value}] console.log(e.detail.referral_url); \/\/ &quot;https:\/\/sweepwidget.com\/c\/&#8230;&quot; }); window.addEventListener(&#39;sweepwidget.task_completed&#39;, function(e) { console.log(e.detail.task.entry_method); \/\/ &quot;visit_a_page&quot; console.log(e.detail.remaining_tasks); \/\/ 2 }); window.addEventListener(&#39;sweepwidget.all_entries_completed&#39;, function(e) { console.log(e.detail.entries); \/\/ 25 }); Method 2: Catch-all event listener (embedded widgets only) On a page with an embedded widget, you can listen for all SweepWidget events with one listener. The event name and data are in e.detail.event and e.detail.data. This catch-all event is not fired on hosted landing pages; use Method 1 or 3 there. window.addEventListener(&#39;sweepwidget&#39;, function(e) { console.log(&#39;Event:&#39;, e.detail.event); \/\/ &quot;sweepwidget.entry_submitted&quot; console.log(&#39;Data:&#39;, e.detail.data); \/\/ {competition_id, user, entries, &#8230;} }); Method 3: Global callback function Define a global function that is called for every event. This works even if you add it before the SweepWidget script loads. window.SweepWidgetCallback = function(eventName, eventData) { \/\/ eventName: &quot;sweepwidget.entry_submitted&quot; \/\/ eventData: {competition_id, user, entries, custom_fields, &#8230;} console.log(eventName, eventData); }; Extra event: instant win sweepwidget.instant_win fires when instant-win results are shown to an entrant. e.detail contains competition_id and results. This event fires on all plans. Example: Fire a Meta\/Facebook pixel event on entry window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) { fbq(&#39;track&#39;, &#39;Lead&#39;, { content_name: e.detail.competition_url, value: e.detail.entries, currency: &#39;USD&#39; }); }); Example: Google Analytics event on entry window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) { gtag(&#39;event&#39;, &#39;giveaway_entry&#39;, { competition_id: e.detail.competition_id }); }); Embedded widgets: events are sent from the iframe to the parent page with postMessage. The SweepWidget embed script relays them as events on the parent window, so your listeners work without extra setup. Signing Secret A signing<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"class_list":["post-7689","post","type-post","status-publish","format-standard","hentry","category-integrations"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Webhooks Integration Guide - SweepWidget Help Docs<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sweepwidget.com\/docs\/webhooks\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Webhooks Integration Guide - SweepWidget Help Docs\" \/>\n<meta property=\"og:description\" content=\"Receive real-time HTTP POST notifications when people enter your giveaway, complete tasks, or finish all entries. Plan required: Enterprise. Overview SweepWidget provides two ways to receive real-time event data from your giveaways: Server-side webhooks \u2013 HTTP POST requests from our server to yours. They work on embedded widgets and hosted landing pages. Best for backend workflows like CRM syncing, email triggers and database updates. Client-side JavaScript callbacks \u2013 browser events fired on the page where the widget is loaded. Best for frontend actions like firing tracking pixels, showing custom UI, or triggering analytics events. Both use the same three event names and similar data. The differences are listed under Events. On this page: Setup Events Payload Format Request Headers Signature Verification JavaScript Callbacks Signing Secret Troubleshooting Setup Server-side webhooks In the left menu, click API Integrations. In the E-commerce &amp; Automation section, click Webhooks. Enter your endpoint URL in Webhook URL (it must start with https:\/\/) and click Save. Copy the Secret Key under Signing Secret to verify webhook signatures on your server. Click Send Test to send a test request and confirm your endpoint receives it. The test request has the event name test. Note: webhooks are set per brand. They fire for every giveaway in the brand where you saved them. If you manage several brands, set up webhooks in each brand. JavaScript callbacks No dashboard configuration needed. Add an event listener to the page where your SweepWidget is embedded. See JavaScript Callbacks below. Events All events fire automatically. There is no per-event toggle. Event Fires when entry_submitted An entrant successfully submits the entry form (email, name, etc.). It fires again if a returning entrant submits the form again task_completed An entrant completes a bonus entry task (follow, visit, share, etc.) all_entries_completed An entrant has completed every available task Differences between webhooks and JS callbacks: Webhook all_entries_completed is sent only right after an entrant completes their last bonus task. If your giveaway has no bonus entry methods, it is never sent. JS all_entries_completed also fires when an entrant who already finished everything opens the giveaway again, so it can fire more than once for the same person. Payload Format Webhooks wrap the data in an event + data + timestamp envelope. JS callbacks provide the data directly in e.detail, and add a timestamp field to it. entry_submitted { &quot;event&quot;: &quot;entry_submitted&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;phone&quot;: &quot;+1234567890&quot;, &quot;birthday&quot;: &quot;1990-01-15&quot; }, &quot;custom_fields&quot;: [ { &quot;entry_id&quot;: &quot;101&quot;, &quot;field_type&quot;: &quot;text_input&quot;, &quot;label&quot;: &quot;Company Name&quot;, &quot;value&quot;: &quot;Acme Corp&quot; } ], &quot;entries&quot;: 5, &quot;referral_url&quot;: &quot;https:\/\/sweepwidget.com\/c\/my-giveaway-abc123&quot; }, &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot; } task_completed { &quot;event&quot;: &quot;task_completed&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot; }, &quot;task&quot;: { &quot;entry_id&quot;: &quot;67&quot;, &quot;entry_method&quot;: &quot;visit_a_page&quot;, &quot;entry_group_id&quot;: &quot;3&quot; }, &quot;entries&quot;: 10, &quot;remaining_tasks&quot;: 2 }, &quot;timestamp&quot;: &quot;2026-03-04T12:01:00+00:00&quot; } entry_method is SweepWidget&#8217;s internal name for the entry method (for example visit_a_page). all_entries_completed { &quot;event&quot;: &quot;all_entries_completed&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot; }, &quot;entries&quot;: 25 }, &quot;timestamp&quot;: &quot;2026-03-04T12:02:00+00:00&quot; } test (Send Test button) { &quot;event&quot;: &quot;test&quot;, &quot;data&quot;: { &quot;message&quot;: &quot;Webhook configured successfully.&quot;, &quot;website_id&quot;: &quot;123&quot; }, &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot; } Request Headers Header Description Content-Type application\/json X-SweepWidget-Signature HMAC-SHA256 signature of the payload body, prefixed with sha256= X-SweepWidget-Event The event name (e.g. entry_submitted, or test) User-Agent SweepWidget-Webhook\/1.0 Signature Verification Always verify the X-SweepWidget-Signature header to confirm the request came from SweepWidget. Compute an HMAC-SHA256 hash of the raw request body using your signing secret and compare it to the signature in the header. PHP $payload = file_get_contents(&#039;php:\/\/input&#039;); $signature = $_SERVER[&#039;HTTP_X_SWEEPWIDGET_SIGNATURE&#039;] ?? &#039;&#039;; $secret = &#039;whsec_your_signing_secret&#039;; $expected = &#039;sha256=&#039; . hash_hmac(&#039;sha256&#039;, $payload, $secret); if (!hash_equals($expected, $signature)) { http_response_code(401); exit(&#039;Invalid signature&#039;); } $event = json_decode($payload, true); \/\/ Process the event... Node.js const crypto = require(&#039;crypto&#039;); app.post(&#039;\/webhook&#039;, express.raw({ type: &#039;application\/json&#039; }), (req, res) =&gt; { const signature = req.headers[&#039;x-sweepwidget-signature&#039;] || &#039;&#039;; const secret = &#039;whsec_your_signing_secret&#039;; const expected = &#039;sha256=&#039; + crypto .createHmac(&#039;sha256&#039;, secret) .update(req.body) .digest(&#039;hex&#039;); if (signature !== expected) { return res.status(401).send(&#039;Invalid signature&#039;); } const event = JSON.parse(req.body); \/\/ Process the event... res.sendStatus(200); }); JavaScript Callbacks SweepWidget fires browser events when someone enters your giveaway, completes a task, or finishes all entries. On embedded widgets the embed script relays them from the iframe to your page. On hosted landing pages they fire on the page&#8217;s window. No dashboard configuration is required. Add a listener to the page where your widget is embedded. Method 1: Individual event listeners Listen for specific events by name. The event data is in e.detail. window.addEventListener(&#039;sweepwidget.entry_submitted&#039;, function(e) { console.log(e.detail.user.email); \/\/ &quot;user@example.com&quot; console.log(e.detail.user.name); \/\/ &quot;Jane Smith&quot; console.log(e.detail.entries); \/\/ 5 console.log(e.detail.custom_fields); \/\/ [{entry_id, field_type, label, value}] console.log(e.detail.referral_url); \/\/ &quot;https:\/\/sweepwidget.com\/c\/...&quot; }); window.addEventListener(&#039;sweepwidget.task_completed&#039;, function(e) { console.log(e.detail.task.entry_method); \/\/ &quot;visit_a_page&quot; console.log(e.detail.remaining_tasks); \/\/ 2 }); window.addEventListener(&#039;sweepwidget.all_entries_completed&#039;, function(e) { console.log(e.detail.entries); \/\/ 25 }); Method 2: Catch-all event listener (embedded widgets only) On a page with an embedded widget, you can listen for all SweepWidget events with one listener. The event name and data are in e.detail.event and e.detail.data. This catch-all event is not fired on hosted landing pages; use Method 1 or 3 there. window.addEventListener(&#039;sweepwidget&#039;, function(e) { console.log(&#039;Event:&#039;, e.detail.event); \/\/ &quot;sweepwidget.entry_submitted&quot; console.log(&#039;Data:&#039;, e.detail.data); \/\/ {competition_id, user, entries, ...} }); Method 3: Global callback function Define a global function that is called for every event. This works even if you add it before the SweepWidget script loads. window.SweepWidgetCallback = function(eventName, eventData) { \/\/ eventName: &quot;sweepwidget.entry_submitted&quot; \/\/ eventData: {competition_id, user, entries, custom_fields, ...} console.log(eventName, eventData); }; Extra event: instant win sweepwidget.instant_win fires when instant-win results are shown to an entrant. e.detail contains competition_id and results. This event fires on all plans. Example: Fire a Meta\/Facebook pixel event on entry window.addEventListener(&#039;sweepwidget.entry_submitted&#039;, function(e) { fbq(&#039;track&#039;, &#039;Lead&#039;, { content_name: e.detail.competition_url, value: e.detail.entries, currency: &#039;USD&#039; }); }); Example: Google Analytics event on entry window.addEventListener(&#039;sweepwidget.entry_submitted&#039;, function(e) { gtag(&#039;event&#039;, &#039;giveaway_entry&#039;, { competition_id: e.detail.competition_id }); }); Embedded widgets: events are sent from the iframe to the parent page with postMessage. The SweepWidget embed script relays them as events on the parent window, so your listeners work without extra setup. Signing Secret A signing\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sweepwidget.com\/docs\/webhooks\" \/>\n<meta property=\"og:site_name\" content=\"SweepWidget Help Docs\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-04T23:56:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-19T10:27:53+00:00\" \/>\n<meta name=\"author\" content=\"SweepWidget\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"SweepWidget\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks\"},\"author\":{\"name\":\"SweepWidget\",\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/#\\\/schema\\\/person\\\/4cca2bc9c600116750eca1bfff6648e0\"},\"headline\":\"Webhooks Integration Guide\",\"datePublished\":\"2026-03-04T23:56:51+00:00\",\"dateModified\":\"2026-11-19T10:27:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks\"},\"wordCount\":945,\"articleSection\":[\"Integrations\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks\",\"url\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks\",\"name\":\"Webhooks Integration Guide - SweepWidget Help Docs\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/#website\"},\"datePublished\":\"2026-03-04T23:56:51+00:00\",\"dateModified\":\"2026-11-19T10:27:53+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/#\\\/schema\\\/person\\\/4cca2bc9c600116750eca1bfff6648e0\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/webhooks#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Webhooks Integration Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/\",\"name\":\"SweepWidget Help Docs\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/#\\\/schema\\\/person\\\/4cca2bc9c600116750eca1bfff6648e0\",\"name\":\"SweepWidget\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91c2f57672b440838a4205ff021607b3d77efd9ac80a80984ce065da067e51e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91c2f57672b440838a4205ff021607b3d77efd9ac80a80984ce065da067e51e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d91c2f57672b440838a4205ff021607b3d77efd9ac80a80984ce065da067e51e?s=96&d=mm&r=g\",\"caption\":\"SweepWidget\"},\"sameAs\":[\"https:\\\/\\\/sweepwidget.com\\\/docs\"],\"url\":\"https:\\\/\\\/sweepwidget.com\\\/docs\\\/author\\\/sweepwidget\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Webhooks Integration Guide - SweepWidget Help Docs","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sweepwidget.com\/docs\/webhooks","og_locale":"en_US","og_type":"article","og_title":"Webhooks Integration Guide - SweepWidget Help Docs","og_description":"Receive real-time HTTP POST notifications when people enter your giveaway, complete tasks, or finish all entries. Plan required: Enterprise. Overview SweepWidget provides two ways to receive real-time event data from your giveaways: Server-side webhooks \u2013 HTTP POST requests from our server to yours. They work on embedded widgets and hosted landing pages. Best for backend workflows like CRM syncing, email triggers and database updates. Client-side JavaScript callbacks \u2013 browser events fired on the page where the widget is loaded. Best for frontend actions like firing tracking pixels, showing custom UI, or triggering analytics events. Both use the same three event names and similar data. The differences are listed under Events. On this page: Setup Events Payload Format Request Headers Signature Verification JavaScript Callbacks Signing Secret Troubleshooting Setup Server-side webhooks In the left menu, click API Integrations. In the E-commerce &amp; Automation section, click Webhooks. Enter your endpoint URL in Webhook URL (it must start with https:\/\/) and click Save. Copy the Secret Key under Signing Secret to verify webhook signatures on your server. Click Send Test to send a test request and confirm your endpoint receives it. The test request has the event name test. Note: webhooks are set per brand. They fire for every giveaway in the brand where you saved them. If you manage several brands, set up webhooks in each brand. JavaScript callbacks No dashboard configuration needed. Add an event listener to the page where your SweepWidget is embedded. See JavaScript Callbacks below. Events All events fire automatically. There is no per-event toggle. Event Fires when entry_submitted An entrant successfully submits the entry form (email, name, etc.). It fires again if a returning entrant submits the form again task_completed An entrant completes a bonus entry task (follow, visit, share, etc.) all_entries_completed An entrant has completed every available task Differences between webhooks and JS callbacks: Webhook all_entries_completed is sent only right after an entrant completes their last bonus task. If your giveaway has no bonus entry methods, it is never sent. JS all_entries_completed also fires when an entrant who already finished everything opens the giveaway again, so it can fire more than once for the same person. Payload Format Webhooks wrap the data in an event + data + timestamp envelope. JS callbacks provide the data directly in e.detail, and add a timestamp field to it. entry_submitted { &quot;event&quot;: &quot;entry_submitted&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;phone&quot;: &quot;+1234567890&quot;, &quot;birthday&quot;: &quot;1990-01-15&quot; }, &quot;custom_fields&quot;: [ { &quot;entry_id&quot;: &quot;101&quot;, &quot;field_type&quot;: &quot;text_input&quot;, &quot;label&quot;: &quot;Company Name&quot;, &quot;value&quot;: &quot;Acme Corp&quot; } ], &quot;entries&quot;: 5, &quot;referral_url&quot;: &quot;https:\/\/sweepwidget.com\/c\/my-giveaway-abc123&quot; }, &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot; } task_completed { &quot;event&quot;: &quot;task_completed&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot; }, &quot;task&quot;: { &quot;entry_id&quot;: &quot;67&quot;, &quot;entry_method&quot;: &quot;visit_a_page&quot;, &quot;entry_group_id&quot;: &quot;3&quot; }, &quot;entries&quot;: 10, &quot;remaining_tasks&quot;: 2 }, &quot;timestamp&quot;: &quot;2026-03-04T12:01:00+00:00&quot; } entry_method is SweepWidget&#8217;s internal name for the entry method (for example visit_a_page). all_entries_completed { &quot;event&quot;: &quot;all_entries_completed&quot;, &quot;data&quot;: { &quot;competition_id&quot;: &quot;12345&quot;, &quot;competition_url&quot;: &quot;my-giveaway&quot;, &quot;user&quot;: { &quot;email&quot;: &quot;user@example.com&quot;, &quot;name&quot;: &quot;Jane Smith&quot; }, &quot;entries&quot;: 25 }, &quot;timestamp&quot;: &quot;2026-03-04T12:02:00+00:00&quot; } test (Send Test button) { &quot;event&quot;: &quot;test&quot;, &quot;data&quot;: { &quot;message&quot;: &quot;Webhook configured successfully.&quot;, &quot;website_id&quot;: &quot;123&quot; }, &quot;timestamp&quot;: &quot;2026-03-04T12:00:00+00:00&quot; } Request Headers Header Description Content-Type application\/json X-SweepWidget-Signature HMAC-SHA256 signature of the payload body, prefixed with sha256= X-SweepWidget-Event The event name (e.g. entry_submitted, or test) User-Agent SweepWidget-Webhook\/1.0 Signature Verification Always verify the X-SweepWidget-Signature header to confirm the request came from SweepWidget. Compute an HMAC-SHA256 hash of the raw request body using your signing secret and compare it to the signature in the header. PHP $payload = file_get_contents(&#39;php:\/\/input&#39;); $signature = $_SERVER[&#39;HTTP_X_SWEEPWIDGET_SIGNATURE&#39;] ?? &#39;&#39;; $secret = &#39;whsec_your_signing_secret&#39;; $expected = &#39;sha256=&#39; . hash_hmac(&#39;sha256&#39;, $payload, $secret); if (!hash_equals($expected, $signature)) { http_response_code(401); exit(&#39;Invalid signature&#39;); } $event = json_decode($payload, true); \/\/ Process the event... Node.js const crypto = require(&#39;crypto&#39;); app.post(&#39;\/webhook&#39;, express.raw({ type: &#39;application\/json&#39; }), (req, res) =&gt; { const signature = req.headers[&#39;x-sweepwidget-signature&#39;] || &#39;&#39;; const secret = &#39;whsec_your_signing_secret&#39;; const expected = &#39;sha256=&#39; + crypto .createHmac(&#39;sha256&#39;, secret) .update(req.body) .digest(&#39;hex&#39;); if (signature !== expected) { return res.status(401).send(&#39;Invalid signature&#39;); } const event = JSON.parse(req.body); \/\/ Process the event... res.sendStatus(200); }); JavaScript Callbacks SweepWidget fires browser events when someone enters your giveaway, completes a task, or finishes all entries. On embedded widgets the embed script relays them from the iframe to your page. On hosted landing pages they fire on the page&#8217;s window. No dashboard configuration is required. Add a listener to the page where your widget is embedded. Method 1: Individual event listeners Listen for specific events by name. The event data is in e.detail. window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) { console.log(e.detail.user.email); \/\/ &quot;user@example.com&quot; console.log(e.detail.user.name); \/\/ &quot;Jane Smith&quot; console.log(e.detail.entries); \/\/ 5 console.log(e.detail.custom_fields); \/\/ [{entry_id, field_type, label, value}] console.log(e.detail.referral_url); \/\/ &quot;https:\/\/sweepwidget.com\/c\/...&quot; }); window.addEventListener(&#39;sweepwidget.task_completed&#39;, function(e) { console.log(e.detail.task.entry_method); \/\/ &quot;visit_a_page&quot; console.log(e.detail.remaining_tasks); \/\/ 2 }); window.addEventListener(&#39;sweepwidget.all_entries_completed&#39;, function(e) { console.log(e.detail.entries); \/\/ 25 }); Method 2: Catch-all event listener (embedded widgets only) On a page with an embedded widget, you can listen for all SweepWidget events with one listener. The event name and data are in e.detail.event and e.detail.data. This catch-all event is not fired on hosted landing pages; use Method 1 or 3 there. window.addEventListener(&#39;sweepwidget&#39;, function(e) { console.log(&#39;Event:&#39;, e.detail.event); \/\/ &quot;sweepwidget.entry_submitted&quot; console.log(&#39;Data:&#39;, e.detail.data); \/\/ {competition_id, user, entries, ...} }); Method 3: Global callback function Define a global function that is called for every event. This works even if you add it before the SweepWidget script loads. window.SweepWidgetCallback = function(eventName, eventData) { \/\/ eventName: &quot;sweepwidget.entry_submitted&quot; \/\/ eventData: {competition_id, user, entries, custom_fields, ...} console.log(eventName, eventData); }; Extra event: instant win sweepwidget.instant_win fires when instant-win results are shown to an entrant. e.detail contains competition_id and results. This event fires on all plans. Example: Fire a Meta\/Facebook pixel event on entry window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) { fbq(&#39;track&#39;, &#39;Lead&#39;, { content_name: e.detail.competition_url, value: e.detail.entries, currency: &#39;USD&#39; }); }); Example: Google Analytics event on entry window.addEventListener(&#39;sweepwidget.entry_submitted&#39;, function(e) { gtag(&#39;event&#39;, &#39;giveaway_entry&#39;, { competition_id: e.detail.competition_id }); }); Embedded widgets: events are sent from the iframe to the parent page with postMessage. The SweepWidget embed script relays them as events on the parent window, so your listeners work without extra setup. Signing Secret A signing","og_url":"https:\/\/sweepwidget.com\/docs\/webhooks","og_site_name":"SweepWidget Help Docs","article_published_time":"2026-03-04T23:56:51+00:00","article_modified_time":"2026-11-19T10:27:53+00:00","author":"SweepWidget","twitter_card":"summary_large_image","twitter_misc":{"Written by":"SweepWidget","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sweepwidget.com\/docs\/webhooks#article","isPartOf":{"@id":"https:\/\/sweepwidget.com\/docs\/webhooks"},"author":{"name":"SweepWidget","@id":"https:\/\/sweepwidget.com\/docs\/#\/schema\/person\/4cca2bc9c600116750eca1bfff6648e0"},"headline":"Webhooks Integration Guide","datePublished":"2026-03-04T23:56:51+00:00","dateModified":"2026-11-19T10:27:53+00:00","mainEntityOfPage":{"@id":"https:\/\/sweepwidget.com\/docs\/webhooks"},"wordCount":945,"articleSection":["Integrations"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/sweepwidget.com\/docs\/webhooks","url":"https:\/\/sweepwidget.com\/docs\/webhooks","name":"Webhooks Integration Guide - SweepWidget Help Docs","isPartOf":{"@id":"https:\/\/sweepwidget.com\/docs\/#website"},"datePublished":"2026-03-04T23:56:51+00:00","dateModified":"2026-11-19T10:27:53+00:00","author":{"@id":"https:\/\/sweepwidget.com\/docs\/#\/schema\/person\/4cca2bc9c600116750eca1bfff6648e0"},"breadcrumb":{"@id":"https:\/\/sweepwidget.com\/docs\/webhooks#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sweepwidget.com\/docs\/webhooks"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sweepwidget.com\/docs\/webhooks#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sweepwidget.com\/docs\/"},{"@type":"ListItem","position":2,"name":"Webhooks Integration Guide"}]},{"@type":"WebSite","@id":"https:\/\/sweepwidget.com\/docs\/#website","url":"https:\/\/sweepwidget.com\/docs\/","name":"SweepWidget Help Docs","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sweepwidget.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sweepwidget.com\/docs\/#\/schema\/person\/4cca2bc9c600116750eca1bfff6648e0","name":"SweepWidget","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d91c2f57672b440838a4205ff021607b3d77efd9ac80a80984ce065da067e51e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d91c2f57672b440838a4205ff021607b3d77efd9ac80a80984ce065da067e51e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d91c2f57672b440838a4205ff021607b3d77efd9ac80a80984ce065da067e51e?s=96&d=mm&r=g","caption":"SweepWidget"},"sameAs":["https:\/\/sweepwidget.com\/docs"],"url":"https:\/\/sweepwidget.com\/docs\/author\/sweepwidget"}]}},"_links":{"self":[{"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/posts\/7689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/comments?post=7689"}],"version-history":[{"count":5,"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/posts\/7689\/revisions"}],"predecessor-version":[{"id":7779,"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/posts\/7689\/revisions\/7779"}],"wp:attachment":[{"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/media?parent=7689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/categories?post=7689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sweepwidget.com\/docs\/wp-json\/wp\/v2\/tags?post=7689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}