Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a user I want to praise anyone on Twitter #1075

Open
kristoferlund opened this issue Jun 14, 2023 · 9 comments
Open

As a user I want to praise anyone on Twitter #1075

kristoferlund opened this issue Jun 14, 2023 · 9 comments
Labels
enhancement New feature or request twitter-bot

Comments

@kristoferlund
Copy link
Member

kristoferlund commented Jun 14, 2023

image.png

Main success scenario

  1. Write Tweet in the form @givethpraise @user for doing something great
  2. TwitterBot picks up tweet from listening to all tweets mentioning @givethpraise
  3. TwitterBot verifies that user has activated their account and are allowed to praise
  4. TwitterBot verifies that tweet has the correct format
  5. TwitterBot creates receiver UserAccounts if needed by calling the API
  6. TwitterBot looks up community host name in local cache and fetches list from API if not found
  7. TwitterBot posts praise to API
    1. Header user-agentto let the API know which bot request came from
    2. Header host to let the API know which community the request came from
    3. Header x-api-key gives the bot access to call the API
      1. This key is configured in ENV and is not community specific
    4. sourceName and sourceId follows the format specified below
  8. API looks up host and verifies that community is in state active
  9. API makes changes to DB
  10. TwitterBot shares praise message to praise bot feed (@givethpraise in this example)
  11. TwitterBot tweets a reply to the praise tweet confirming it has been registered
  12. 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

  1. User has not activated their account
  2. Reply with message instructing user to activate account before praising.
  3. Praise has not correct format
    1. Reply with error message, instructions, link to docs
  4. Community not set up correctly
    1. 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 their UserAccount 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

Twitter Praise Bot - Example Twitter praise flow.jpg

Links and docs

Full wireframes here: https://miro.com/app/board/uXjVMBzP9YQ=/?share_link_id=604231143882

@kristoferlund kristoferlund added enhancement New feature or request twitter-bot labels Jun 14, 2023
@cmaxwe11
Copy link

Just to confirm, only registered users should be able to give praise. Currently, is that permission handled in the community DB or the Discord bot?

@RamRamez
Copy link
Collaborator

RamRamez commented Jul 3, 2023

@kristoferlund

"5. Discord Bot posts praise to API"
I don't understand. do you mean Twitter bot?

"10. Twitter notifies user that the praise message has a reply"
This step will be done automatically by Twitter, am I right?

@RamRamez
Copy link
Collaborator

RamRamez commented Jul 3, 2023

@kristoferlund In the Discord bot we have an account activation step that the user needs to activate and sign the message with their wallet before trying to praise.
Do we have this step for the Twitter bot? if so, is the process exactly like the Discord bot?

@kristoferlund
Copy link
Member Author

@RamRamez

  1. Yes, my bad, Twitter bot of course.
  2. Yes

The activation step will be slightly different for the Twitter bot. And it is not 100% decided yet how it will work. Item 3 in the usecase should be "Twitter bot verifies that user has activated their account and are allowed to praise"

My thought was that you could begin with the praise command without the activation step. Allow anyone to praise to begin with. And then we will add activation when I am back.

@kristoferlund
Copy link
Member Author

@RamRamez, see suggested sourceId and sourceName definitions above. Ok?

@RamRamez
Copy link
Collaborator

@RamRamez, see suggested sourceId and sourceName definitions above. Ok?

Great!

@RamRamez
Copy link
Collaborator

RamRamez commented Aug 3, 2023

@kristoferlund
I have problems posting reply tweets for "Praise Given" and all types of errors. Twitter doesn't allow to post duplicate content.
The tweet ID is unique and I can include it in the tweet body, but I'm not sure if it's the best idea.

image

@kristoferlund
Copy link
Member Author

I have problems posting reply tweets for "Praise Given" and all types of errors. Twitter doesn't allow to post duplicate content.

It seems all replies need to contain some unique information. Take a look at https://threadreaderapp.com/.

Mentioning the user and linking to praise dashboard perhaps is enough.

@user, Your praise have been sent! 🙏

Read it here: https://praise.tecommons.org/praise/64cabcea49fdcebef2b9b0ba
image

@RamRamez
Copy link
Collaborator

RamRamez commented Aug 4, 2023

@kristoferlund Yes, that's a good idea. We can do this for successful praises. What about error messages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request twitter-bot
Projects
None yet
Development

No branches or pull requests

3 participants