Co to jest webhook?
Dzięki Webhooks możesz wysyłać informacje oparte na zdarzeniach do niestandardowego adresu URL. Gdy wystąpi zdarzenie, np. QR_CODE_SCANNED, dany adres URL zostanie wywołany (webhooked).
Jak utworzyć webhook?
Po zalogowaniu się jako administrator na platformie White Label, edytuj użytkownika i przejdź do sekcji Webhooks. Tam możesz ustawić docelowy adres URL dla każdego zdarzenia.
Jakie zdarzenia wyzwalają webhook?
Istnieje wiele różnych zdarzeń na platformie, w których można uruchomić webhook.
Event | Triggered |
---|
QR_CODE_CREATED | when a QR Code has been generated |
QR_CODE_SCANNED | when a QR Code has been scanned |
VOUCHER_CREATED | when a Voucher has been created |
VOUCHER_UPDATED | when a Voucher has been updated |
VOUCHER_REDEEMED | when a Voucher has been redeemed |
VOUCHER_EXPIRED | when a Voucher has been expired |
LEAD_CREATED | when a Lead has been created |
CALL_2_ACTION_BUTTON_CLICKED | when a Call-2-Action Button was clicked |
JOB_FINISHED | when a bulk designer QR Code process is finished |
Jakie parametry wysyła webhook?
Adres URL webhooka jest wywoływany w zależności od zdarzenia z określonymi parametrami, które są opakowane w żądanie POST.
Standardowe parametry
Następujące parametry są zawsze wysyłane wraz z webhookiem.
Parameter | Description |
---|
event | The name of the event e.g. QR_CODE_SCANNED |
timestamp | The time when the event occurred |
user | The user who created the QR Code |
code | The short URL from the QR Code |
secrettoken | The secret API key from the user API. You can use this key to verify a webhook request is from your account. |
Kod QR został zeskanowany
Parametry te są dodatkowo wysyłane, jeśli zeskanowany został kod QR.
Parameter | Description |
---|
redirects | The number of times a QR Code was scanned |
visitors | The number of unique visitors who scanned the QR Code |
device | The device that scanned the QR Code |
os | The operating system that scanned the QR Code |
country | The country where the QR Code was scanned |
lng/lat | An optional location information with a lng/lat pair if a user sends along his GPS data. |
Kod QR został zaktualizowany
Parametry te są dodatkowo wysyłane, jeśli docelowy adres URL kodu QR zostanie zaktualizowany.
Parameter | Description |
---|
url | New target URL of the updated QR Code |
uniqevisitors
| Unique visitors
|
redirect
| Number of redirects
|
title
| Title of the QR Code
|
description
| Description field of the QR Code
|
Type
| URL, BUSINESS_CARD, PRODUCT, OPENIMMO, COUPON, PLAIN, LEAD, SOCIAL,TRACING
|
Subtype
| URL, FACEBOOK_PAGE, FACEBOOK_LIKE, INSTAGRAM, SKYPE, APPSTORE, YOUTUBE, TWITTER, LINKEDIN, SMS, EMAIL, TEXT, VCARD, WLAN, GEO, PAYPAL, PINTEREST, EVENT, PHONE, SEPA, MULTI, BITCOIN, VOUCHER, WHATSAPP, PDF, MULTI_LANGUAGE, MP3, MULTI_GEO, MULTI_GEO_CLOSEST, UNLIMITED, UNIQUEIP, UNIQUEID, ONE, GS1
|
Creation date | QR Code creation date |
Kupon został zaktualizowany
Parametry te są dodatkowo wysyłane, gdy voucher został zaktualizowany.
Parameter | Description |
---|
title | The title of the voucher |
description | The description of the voucher |
| The type of voucher |
type | The type of voucher |
| UNIQUEIP - Voucher can be redeemed once per IP |
| UNIQUEID - Voucher can be redeemed once |
productname | An optional product name for the voucher |
website | An optional web page to which the voucher links |
couponnumber | An optional voucher number that will be displayed on the voucher |
validfrom | An optional date from when the voucher is valid |
validto | An optional date from when the voucher expires |
Voucher został zrealizowany
Parameter | Description | |
---|
status | Status of redemption: | |
| SUCCESS | Voucher was redeemed |
| VOUCHER_ALREADY_REDEEMED | Voucher was already redeemed before |
| VOUCHER_EXPIRED | Voucher has expired |
| QUOTA_EXCEEDED | The limit of redemptions was exceeded |
type | The voucher type: | |
| UNIQUEIP | Voucher can be redeemed once per IP |
| UNIQUEID | Voucher can be redeemed once |
eancode | | If the voucher is redeemed and an EAN barcode is set, the EAN code will be transmitted in the webhook. |
uniqueid | | If the QR Code is a one-time redeemable voucher, the unique ID of the voucher is returned. This is one of the unique IDs when you create bulk QR Codes for a uniquely redeemable voucher. |
Nowy lead
Parameter | Description |
---|
email | The email address of the new lead |
name | The name of the new lead |
Przycisk C2A został kliknięty
Parametr ten jest również wysyłany po kliknięciu przycisku Call-2-Action
Parameter | Description |
---|
c2a | The URL of the Call-2-Action button Lorem |
Praca została zakończona
Parametr ten jest dodatkowo wysyłany, gdy zadanie dostarczające projektantowi kody QR do pobrania zakończy obliczenia.
Parameter | Description |
---|
download | A link to download the job result that is valid for 30 days |
Dzienniki webhooków
Możesz sprawdzić logi w ustawieniach użytkownika, aby zobaczyć, które webhooki, kiedy zostały uruchomione i czy wystąpił jakiś błąd.
Debugowanie
Jeśli chcesz wyświetlić informacje wysłane do serwera za pomocą webhooka, użyj następującego skryptu PHP, aby wyświetlić wszystkie parametry:
<?php
// Test WebHook and show parameters
error_log("Fired WebHook");
// Post Parameter
foreach ($_POST as $param_name => $param_val) {
error_log("$param_name: $param_val");
}
// Get Parameter
foreach ($_GET as $param_name => $param_val) {
error_log("$param_name: $param_val");
}
// if JSON submitted
$json = json_decode(file_get_contents('php://input'));
Testuj webhook online
Dzięki bezpłatnej usłudze webhook.site możesz natychmiast przetestować webhook online.
Kopiowanie konfiguracji webhook do innego profilu użytkownika
API Administratora umożliwia kopiowanie konfiguracji webhooków z jednego profilu użytkownika do drugiego.