Skip to main content

Webhook

Webhooks provide a powerful way to receive real-time notifications when a user participates in a task. By configuring a webhook for your campaign, you can receive detailed information about user interactions directly to your specified endpoint.

Setting Up a Webhook

To set up a webhook for your campaign:

  1. Go to your campaign setup page.
  2. Enter the URL endpoint in the webhook configuration section.
  3. Your endpoint must be capable of handling HTTP POST requests and processing the incoming JSON payload.

The request's body will get the following data which you can further use at your disposal

{
userId: '2d4fcba2-817b-4322-93b5-47a075796c90',
provider: 'TWITTER',
providerId: '1485502052562194432',
xp: 1,
points: 1,
data: 'null',
taskId: 'd5a459ba-43cc-42fa-bc19-3c87821dbd43',
eventId: 'eae7405a-11d2-4a23-ad40-ff50a4d73497',
tasktype: 'URL_VISIT',
apptype: 'URL',
participationStatus: 'VALID',
}

Details of the payload fields

1. Property details

PropertyDescriptionTypeDefault
userIdUnique UUID given to every new userstring-
providerIt will have one of the stated values from the table given belowstring-
providerIdIt can be unique ID from any social API / wallet address / email addressstring-
xpIt is a value given to that tasknumber-
pointsIt is a value earned by the user once he/she does that tasknumber-
dataIt will have value(s) as specified in the TaskType tableJSON / null-
taskIdUnique UUID given to every taskstring-
eventIdUnique UUID given to every campaignstring-
taskTypeIt will have one of the stated values from the table given belowstring-
appTypeIt will have one of the stated values from the table given belowstring-
participationStatusIt will have one of the stated values from the table given belowstring-

2. Providers

For a given data, this specifies which social platform they have used to perform this action.

ProviderProviderId
TWITTERGives the account's ID from Twitter API
DISCORDGives the account's ID from Discord API
MAGIC_LINKEmail address used by user's for passwordless login
EVM_BLOCKCHAINEVM Wallet address
DOTSAMA_BLOCKCHAINDotsama Wallet address

3. TaskType & AppType

Every action will following under one of the AppTypes states below and one of the TaskType depending on the subcategory

AppTypeTaskTypeData
DISCORDDISCORD_JOINnull
FORMFORM_ANSWER{ "answers" : [ "id" : string, "value": [ string ] ] }
QUIZQUIZ_PLAY{ "answers" : [ string ] }
EVMEVM_CONTRACT{ "formResponses": [{ "id": string, "value": string(wallet address)}] }
TELEGRAMTELEGRAM_JOINnull
TWITTERTWITTER_FOLLOWnull
TWITTERTWITTER_POST{ "url": string, "media": [string], "tweet": string }
TWITTERTWITTER_UGC{ "url": string, "media": [string], "tweet": string }
TWITTERTWITTER_LIKE_RETWEETnull
UPLOADUPLOAD_FILE{ "urls": [string] }
URLURL_VISIT, URL_SHAREnull
INSTAGRAMINSTAGRAM_VISIT, INSTAGRAM_VIEWnull
YOUTUBEYOUTUBE_VISITnull
WALLETWALLET_EVM, WALLET_DOTSAMA{ "address": string }
SUBGRAPHSUBGRAPH_RAWJSON based on the task
AIRBOOSTAIRBOOST_REFERRALnull
RESTREST_RAW, REST_EVM, REST_DOTSAMAJSON based on the task
EMAILEMAIL_ADDRESSnull
TERMSTERMS_TEXTnull
TERMSTERMS_DOTSAMA{ "address": string, "signature": string }
CHECKINCHECKIN_DAILYnull

4. Participation Status

Every action taken by a users belongs to one of the follow status

StatusDetails
VALIDThe action taken by the user is correct
INVALIDThe campaign manager found something incorrect so marked the user action INVALID from AirLyft Dashboard
IN_REVIEWThe user action required campaign manager to manually review the action & mark it VALID / INVALID from AirLyft dashboard

Webhook Signature

To sign our requests, we use a hash-based message authentication code, or HMAC.

Each project that is created will be provided with a secret.

When a request is sent to your webhook endpoint a signature will be created by hashing the body of the request that is being sent with the shared secret.

This signature is sent in the signature variable in the HTTP body so that the client can verify it was made with the same secret that it has access to.

Steps to get the secret

  1. Go to https://account.airlyft.one/settings/community/advance & click on "Generate Signature"

Community Advance Setting

  1. Copy the secret & use it on your end

Communtiy Advance Setting

How to verify the signature on your end

The signature value for this request was created by creating a SHA-256 hash of the above request body parameters except of the signature itself using the provided secret as a key.

In order for the client to verify the signature, it can create a hash signature using the same algorithm and see if the value matches.

Below is an example using Node.js.

const crypto = require('crypto');

const key = 'secret'; // from the secret copied from AirLyft dashboard
const body = '{"userId":"2d4fcba2-817b-4322-93b5-47a075796c90","provider":"TWITTER","providerId":"1485502052562194432","xp":1,"points":1,"data":"null","taskId":"d5a459ba-43cc-42fa-bc19-3c87821dbd43","eventId":"eae7405a-11d2-4a23-ad40-ff50a4d73497","tasktype":"URL_VISIT","apptype":"URL","participationStatus":"VALID"}';

const hash = crypto.createHmac('sha256', key).update(body);

const signature = hash.digest('hex');

For instant help
  1. Create a support ticket on our Discord: https://discord.gg/bx6ZCTwbYw
  2. Join this Telegram group: https://t.me/kyteone

The AirLyft Team is there to help you. AirLyft is a platform to run marketing events, campaigns, quests and automatically distribute NFTs or Tokens as rewards.