Assign webhooks
Last updated
Was this helpful?
Last updated
Was this helpful?
claimr provides pre-defined webhooks that you can assign to send real-time data to your applications when specific events occur. This allows you to integrate claimr with other systems and automate workflows.
User activity hook: Triggered when a user acts within a campaign (e.g., completes a task, claims a reward).
User login hook: Triggered when a user logs in to claimr.
User reward hook: Triggered when a user claims a reward.
Referral hook: Triggered when a referral-related event occurs (e.g., a new user signs up via a referral link).
Navigate to the API Section: In your claimr dashboard, go to the "API" section.
Locate the webhook: Find the webhook you want to assign (e.g., "User activity hook").
Click "Assign": Click Assign button next to the webhook. This will open an Assign webhook modal window.
Fill in the Webhook Configuration: Within the modal window, you'll configure the webhook settings:
ID: A unique identifier for your webhook. It is automatically generated by claimr but can be edited.
URL: This is the URL of the external endpoint that will receive the webhook data. This must be a publicly accessible endpoint that can accept HTTP POST requests. You'll need to obtain this URL from the application you're integrating with.
Secret: A secret key used to verify the authenticity of the webhook requests. When you set a secret, claimr will use it to generate a signature that's included with each webhook request. Your receiving application should verify this signature to ensure the request came from claimr and hasn't been tampered with.
Campaigns: This section allows you to specify which campaigns this webhook applies to.
If you leave this section empty (no checkboxes selected), the webhook will be triggered for all your campaigns.
If you select one or more campaigns, the webhook will only be triggered for events within those specific campaigns.
Click "Assign": Once you've filled in the configuration, click Assign to save the settings.
By utilizing secret keys, claimr provides a robust mechanism to ensure that your webhook communications are secure and reliable.
Data Integrity: Ensures that the data received in webhook notifications has not been modified or corrupted during transmission.
Authentication: Verifies that the webhook message originated from claimr and not from a malicious actor.
Security: Adds an extra layer of security to your webhook integration, protecting your campaign data from unauthorized manipulation.
claimr provides a built-in testing tool to verify that your webhook integration is working correctly before you go live. This allows you to simulate a webhook event and see the data that would be sent to your endpoint.
Access the test environment: Navigate to the "API" section of your claimr admin panel, find the webhook you want to test (e.g., "User activity hook"). You should see a testing area associated with that webhook.
Input a test User ID: Enter a valid claimr User ID into the "User:" field.
Initiate the test: Click the "Test" button. This will trigger a simulated user_activity
event for the specified user.
Verify the response:
Response Body: claimr will display the exact JSON payload that would be sent to your webhook endpoint in the "Response body:" section. Carefully review this data to ensure it matches the expected format and contains all the necessary information.
Response Result: claimr will also show a summary of the test result:
Success: A boolean value (true
or false
) indicating whether claimr was able to send the test message. Note that this only confirms that claimr sent the message; it does not guarantee that your endpoint received it successfully.
Status: The HTTP status code returned by your endpoint (if it was reached). A status code of 200
indicates success on your endpoint's side.
Data: This will usually display a snippet of the response from your server. If your server is set up to return a confirmation message, you'll see it here. If your server returned an error, or if the request failed to reach your server, you might see an error message or HTML code here.
Check an example of a successful test. The "Response body:" section displays the JSON payload that was sent.
Here's a breakdown of the fields in the example payload:
id
: A unique identifier for this specific webhook message.
scope
: Indicates the webhook was triggered by a user activity event.
user
: The ID of the user who performed the action.
user_id
: The ID of the user.
wallet
: The user's connected wallet address.
email
: The user's email address.
campaign
: Information about the campaign.
id
: The unique ID of the campaign.
name
: The name of the campaign.
event
: Details about the specific event.
type
: The type of event (an action was completed).
data
: Additional data about the event.
account
: The associated account.
action
: Information about the completed action.
id
: The action's ID.
name
: The action's name.
type
: The action's type.
meta
: The additional metadata.
xp
: The number of points awarded.
total_xp
: The user's total points.
ref_xp
: Points earned from referrals.
ugc_xp
: Points earned from user-generated content.
xp_mul
: The points multiplier.
rank
: The user's rank.
team
: The user's team.
The "Response result:" section shows Success: true
and Status: 200
, indicating that the test message was sent successfully and your endpoint (presumably) responded with a success code.