Overview
TallyBot is an automated bot that tracks governance proposals across multiple neurons and sends real-time voting tally updates to OpenChat groups and channels. It monitors how specific neurons vote on proposals and broadcasts the status to subscribed communities.Key Features
- Subscription-based notifications: Subscribe channels/groups to specific tally IDs
- Real-time vote tracking: Monitor neuron votes on governance proposals
- Smart message management: Edits existing messages until consensus is reached
- Thread support: Posts updates as replies to original proposal messages
- NNS integration: Special handling for NNS Proposal Group messages
How It Works
TallyBot receives tally updates from external services through thetallyUpdate endpoint and broadcasts them to subscribed OpenChat destinations. It maintains a mapping between proposal IDs and message indexes to efficiently update existing messages rather than creating new ones.
TallyBot requires authorization through the
allowedNotifiers list to accept tally updates. Only custodians can add notifiers.Architecture
TallyFeed Type
The bot receives updates in theTallyFeed format:
Ballot Format
Each ballot contains voting information:Subscriber Types
TallyBot supports two subscription types:Getting Started
API Reference
tallyUpdate
Receives tally updates from authorized notifiers and broadcasts to subscribers.Array of tally feeds containing ballot information
allowedNotifiers list
Returns: Result<(), Text>
addSubscriber
Subscribes a channel or group to receive updates for a specific tally ID.The tally ID to subscribe to
Channel or Group subscription details
Result<(), Text>
deleteSubscription
Removes a subscription for a tally ID.The tally ID to unsubscribe from
Channel or Group to unsubscribe
Result<(), Text>
getSubscribers
Retrieves all subscriptions for a specific tally ID or all subscriptions.Optional tally ID to filter. If null, returns all subscriptions.
[(TallyId, [Sub])]
toggleNNSGroup
Enables or disables posting updates to the NNS Proposal Group. Authorization: Custodians only Returns:Result<Bool, Text> - New state (true if enabled)
Message Formatting
TallyBot formats ballot updates with visual indicators:Vote Status Icons
- 🟢 Yes - Voted in favor
- 🔴 No - Voted against
- 🟡 Abstained - Abstained from voting
- ⚪️ Pending - Vote not yet cast
Smart Update Logic
TallyBot optimizes message management:- First Update: Creates a new message with the ballot status
- Subsequent Updates: Edits the existing message instead of creating duplicates
- Consensus Reached: Deletes the message ID mapping when all votes are cast
- Thread Support: Posts updates as replies to original proposal messages in NNS Group
NNS Proposal Group Integration
For the NNS Proposal Group (labxu-baaaa-aaaaf-anb4q-cai), TallyBot:
- Matches proposals with existing message indexes
- Posts tally updates as threaded replies to original proposal messages
- Maintains a lookup table mapping proposal IDs to message indexes
- Tracks dependencies to efficiently manage message lifecycle
Testing
Test Message Sending
Verify the bot can send messages:Test Ballot Formatting
Preview how ballots will be formatted:Best Practices
Subscription Management
- Subscribe only to relevant tally IDs to reduce noise
- Use descriptive tally aliases for better readability
- Regularly review and clean up unused subscriptions
Notifier Security
- Only add trusted principals to the notifiers list
- Use dedicated service principals for tally services
- Monitor logs for unauthorized access attempts
Performance
- The bot edits messages instead of creating new ones to reduce spam
- Message IDs are automatically cleaned up after consensus
- NNS Group integration uses efficient batch lookups
Troubleshooting
tallyUpdate returns 'Not authorized'
tallyUpdate returns 'Not authorized'
Subscriptions not working
Subscriptions not working
- Verify the bot has joined the group/community/channel
- Check subscription exists:
dfx canister call OCBot getSubscribers '(null)' --network ic - Ensure the tally ID matches exactly
- Verify the bot has permission to post messages
Messages not appearing in NNS Group
Messages not appearing in NNS Group
- Enable NNS Group posting:
dfx canister call OCBot toggleNNSGroup '()' --network ic - Verify the governance canister is NNS:
rrkah-fqaaa-aaaaa-aaaaq-cai - Check the bot is subscribed to the NNS Group
- Ensure proposal exists in the NNS Group message history
addSubscriber returns 'Existing sub'
addSubscriber returns 'Existing sub'
The subscription already exists. To update it, first delete the existing subscription:
Related Resources
ProposalBot
Monitor NNS proposals and broadcast updates
Bot Service
Core bot functionality and OpenChat integration
Getting Started
Set up your first OpenChat bot
API Reference
Complete API documentation