Subscriptions
Managing Stratus Subscription
Overview
Subscriptions empower developers to receive real-time updates triggered by smart contract events or internal loyalty actions. These notifications can either be sent to a webhook endpoint or used to automatically invoke functions.
Event Types
Blockchain Events
Blockchain events notify you whenever a smart contract emits an event or a function is called. These events track on-chain state with minimal latency (typically one block), making them ideal for real-time applications.
Start by adding the desired smart contract to your admin panel.
Choose "EVENT" from the subscription options. All available events for the contract will be populated automatically.
Blockchain Function Events
The process mirrors blockchain events with a slight variation:
Ensure the contract is registered in your admin panel.
Choose "FUNCTION" after adding the contract. All smart contract functions will be listed automatically.
Snag Events
Snag events allow subscriptions to internal platform actions. These events relate to loyalty account activities and may have a slight delay (up to 30 seconds) after the action is recorded.
Event Types Reference
LoyaltyTransactionEntry
{
"id": "uuid-123e4567-e89b-12d3-a456-426614174000",
"loyaltyAccountId": "uuid-account-001",
"loyaltyTransactionId": "uuid-transaction-001",
"loyaltyCurrencyId": "uuid-currency-001",
"amount": "100.00",
"direction": "credit",
"metadata": {},
"loyaltyAccountStartAmount": "500.00",
"loyaltyAccountEndAmount": "600.00",
"loyaltyAccountLockVersion": 1,
"hideInUi": false,
"idempotencyKey": "unique-key-001",
"idempotencyKeyExpiresAt": "2025-03-05T00:00:00Z",
"dismissedInUi": false,
"organizationId": "uuid-org-001",
"websiteId": "uuid-website-001",
"createdAt": "2025-03-04T12:00:00Z",
"updatedAt": "2025-03-04T12:00:00Z",
"loyaltyAccount": {
"user": {
"id": "uuid-user-001",
"walletAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
},
"loyaltyTransaction": {
"loyaltyRule": {
"id": "uuid-rule-001"
}
}
}UserMetadata
{
"id": "uuid-234e4567-e89b-12d3-a456-426614174001",
"userId": "uuid-user-001",
"isBlocked": false,
"websiteId": "uuid-website-001",
"organizationId": "uuid-org-001",
"emailAddress": "user@example.com",
"twitterUser": "userTwitter",
"twitterUserId": "twitter-001",
"twitterUserFollowersCount": 150,
"twitterVerifiedAt": "2025-03-04T10:00:00Z",
"discordUser": "userDiscord",
"discordUserId": "discord-001",
"discordVerifiedAt": "2025-03-04T10:05:00Z",
"instagramUser": "userInstagram",
"instagramUserId": "insta-001",
"instagramVerifiedAt": "2025-03-04T10:10:00Z",
"logoUrl": "https://example.com/logo.png",
"displayName": "User Display Name",
"location": "New York, USA",
"bio": "Sample bio text.",
"portfolioUrl": "https://example.com/portfolio",
"createdAt": "2025-03-04T09:00:00Z",
"updatedAt": "2025-03-04T11:00:00Z",
"user": {
"walletAddress": "0x1234567890abcdef1234567890abcdef1234568"
},
"meta": {}
}LoyaltyRuleStatus
{
"id": "uuid-456e4567-e89b-12d3-a456-426614174003",
"websiteId": "uuid-website-001",
"organizationId": "uuid-org-001",
"userId": "uuid-user-001",
"loyaltyRuleId": "uuid-rule-001",
"progress": 100,
"fulfilledAt": "2025-08-01T15:58:15.753Z",
"createdAt": "2025-08-01T15:58:15.741Z",
"updatedAt": "2025-08-01T15:58:15.754Z",
"loyaltyRule": {
"id": "uuid-rule-001",
"name": "Sample Loyalty Rule Name"
},
"user": {
"id": "uuid-user-001",
"walletAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
}