Appearance
Event Integrations
Event integrations are workflows setup to automatically track events to a Stack point system. Events integrations available in the Stack dashboard can also be managed via the API.
Note: integrations are currently only available for EVM chains.
Create integration
By creating an integration, events will be automatically tracked to the point system.
Example: NFT integration
This will assign users 5 points for every user per Pudgy Penguin held.
typescript
await stack.createEventIntegration({
type: EventIntegrationType.NFT_HOLDER,
args: {
nftContractAddress: "0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
chainId: 1,
points: 5,
}
});
// {
// uuid: '6f7b6676-b044-47f1-8d96-52bbdbb265b2',
// eventType: 'nft_transfer_1_0xBd3531dA5CF5857e7CfAA92426877b022e612cf8',
// pointValue: 5,
// status: 'ACTIVE',
// createdAt: '2024-08-23T15:17:28.266Z',
// updatedAt: '2024-08-23T18:03:38.901Z'
// }
Example: Farcaster followers integration
This will give users 5 points for every user that follows farcaster user id: 4109.
typescript
await stack.createEventIntegration({
type: EventIntegrationType.FARCASTER_FOLLOWERS,
args: {
fid: 4109,
points: 5,
}
});
// {
// uuid: '08caa191-70cf-433d-b65a-7d08bbf85cd6',
// eventType: 'farcaster_account_4109_followed_by',
// pointValue: 5,
// status: 'ACTIVE',
// createdAt: '2024-08-23T15:33:40.023Z',
// updatedAt: '2024-08-23T18:03:40.420Z'
// }
Get integrations
typescript
const response = await stack.getEventIntegrations(
{ type: EventIntegrationType.NFT_HOLDER }
);
// [{
// uuid: '6f7b6676-b044-47f1-8d96-52bbdbb265b2',
// eventType: 'nft_transfer_1_0xBd3531dA5CF5857e7CfAA92426877b022e612cf8',
// pointValue: 5,
// status: 'ACTIVE',
// createdAt: '2024-08-23T15:17:28.266Z',
// updatedAt: '2024-08-23T18:03:38.901Z'
// }]
Delete integration
Deleting an integration will also delete the events tracked by the integration.
Example NFT integration
Note: a point system can only have at most 1 NFT_HOLDER integration for a nft contract.
typescript
await stack.deleteEventIntegration({
type: EventIntegrationType.NFT_HOLDER,
args: {
nftContractAddress: "0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
chainId: 1,
}
});
Example Farcaster Followers integration
Note: a point system can only have at most 1 FARCASTER_FOLLOWERS integration for a given fid.
typescript
await stack.deleteEventIntegration({
type: EventIntegrationType.FARCASTER_FOLLOWERS,
args: {
fid: 4109,
}
});