praise
praise copied to clipboard
As a user I want to praise anyone on Twitter
Main success scenario
- Write Tweet in the form
@givethpraise @user for doing something great
- TwitterBot picks up tweet from listening to all tweets mentioning
@givethpraise
- TwitterBot verifies that user has activated their account and are allowed to praise
- TwitterBot verifies that tweet has the correct format
- TwitterBot creates receiver UserAccounts if needed by calling the API
- TwitterBot looks up community host name in local cache and fetches list from API if not found
- TwitterBot posts praise to API
- Header
user-agent
to let theAPI
know which bot request came from - Header
host
to let theAPI
know which community the request came from - Header
x-api-key
gives the bot access to call theAPI
- This key is configured in
ENV
and is not community specific
- This key is configured in
-
sourceName
andsourceId
follows the format specified below
- Header
-
API
looks uphost
and verifies that community is in stateactive
-
API
makes changes to DB - TwitterBot shares praise message to praise bot feed (
@givethpraise
in this example) - TwitterBot tweets a reply to the praise tweet confirming it has been registered
- Twitter notifies user that the praise message has a reply
ℹ️ Look at praise handler in Discord bot code and make sure to include all steps done there
Extensions
- User has not activated their account
- Reply with message instructing user to activate account before praising.
- Praise has not correct format
- Reply with error message, instructions, link to docs
- Community not set up correctly
- Reply with error message, instructions, link to docs
Details
TwitterBot verifies that user has activated their account and are allowed to praise
- "Activated their account" means a
User
object is connected to theirUserAccount
object. - As Praise don't have a permissions system to determine who is allowed to praise we have to rely on Discord to determine if user is allowed to Praise.
- If community has specified Praise giver discord roles, then we need to fetch user information from Discord and check that user belongs to that role.
- See Discord bot code for example
For reference: Praise sourceId
and sourceName
for Discord
sourceId: platform + ":" + serverId + ":" + channelId
Example:
- platform: DISCORD
- serverId: 810180621930070088
- channelId: 810180622336262195
- sourceId: "DISCORD:810180621930070088:810180622336262195"
sourceName: platform + ":" + urlencode(serverName) + ":" + urlencode(channelName)
Example:
- platform: DISCORD
- serverName: Token Engineering Commons
- channelName: 🙏|praise
- sourceName: "DISCORD:Token%20Engineering%20Commons:%F0%9F%99%8F%EF%BD%9Cpraise"
Praise sourceId
and sourceName
for Twitter
sourceId: platform + ":" + userName + ":" + twitterId
Example:
- platform: TWITTER
- userName: givethpraise
- twitterId: 810180622336262195
- sourceId: "TWITTER:givethpraise:810180622336262195"
sourceName: platform + ":" + urlencode(displayName) // Third part omitted because.. it does not exist
Example:
- platform: TWITTER
- displayName: Giveth Praise Bot
- sourceName: "TWITTER:Giveth%20Praise%20Bot"
Wireframes
Links and docs
Full wireframes here: https://miro.com/app/board/uXjVMBzP9YQ=/?share_link_id=604231143882