This recipe explains how to submit and verify loyalty rule completion via the Snag API.
Note: The API-based verification process described in this recipe is only required for the following rule types:Let’s set up a rule to follow a specific Twitter account. The twitter handle or twitter user ID can be configured in the admin dashboard. We can then use the loyalty rule completion endpoint to submit a request to verify the rule completion. We can use the loyalty rule status endpoint to check the status of the rule completion request. When verification is complete, our system then creates a loyalty transaction to reward the user. The rule completion endpoint will return an error if re-called and the rule is already completed for the user. Here is an example implementation in javascript on how you can use the following three endpoints to submit and verify loyalty rule completion:
- Code Entry
- Complete Profile
- Connect Discord
- Connect Email
- Connect Epic
- Connect Steam
- Connect Telegram
- Connect Twitter
- Connect Wallet
- Daily Check-In
- Discord Member
- Discord Messages
- External Rule
- Follow X Account
- Link Click
- Poll
- Quiz
- Telegram Join
- Telegram Messages
- Text Input
- TokenHold (only for multiplier reward type) - this step is not required for Cadence based rules (e.g., Token Hold, Sold On … etc), as these rules run automatically on the specified start time and on set cadence (daily, weekly, monthly).
- X New Tweet
- X Post Reaction
- X Text in Bio
- X Text in Comment
- X Text in Username
- Youtube Comment
- Youtube Subscriber
- Steam Wishlist
POST /api/loyalty/rules/{id}/complete
POST /api/loyalty/rules/status
GET /api/loyalty/transaction_entries