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

feat(platform): Add Twitter integration #8754

Draft
wants to merge 20 commits into
base: dev
Choose a base branch
from

Conversation

Abhi1992002
Copy link
Contributor

@Abhi1992002 Abhi1992002 commented Nov 25, 2024

Create a Twitter integration with some small frontend changes.

Changes

  1. Add Twitter OAuth 2.0 with PKCE support for authentication.
  2. Add a way to multi-select from a list of enums by creating a multi-select on the frontend.
  3. Add blocks for Twitter integration.
  4. _types.py for repetitive enums and input types.
  5. _builders.py for creating parameters without repeating the same logic.
  6. _serializer.py to serialize the Tweepy enums into dictionaries so they can travel easily from Pyro5.
  7. _mappers.py to map the frontend values to the correct request values.

I have added a new multi-select feature because my list contains many items, and selecting all of them makes the block cluttered. This new block displays only the first two items and then show something like "2 more" . It works only for list of enums.

Blocks

Block Name What It Does Error Reason Manual Testing
TwitterBookmarkTweetBlock Bookmark a tweet on Twitter No error
TwitterGetBookmarkedTweetsBlock Get all your bookmarked tweets from Twitter No error
TwitterRemoveBookmarkTweetBlock Remove a bookmark for a tweet on Twitter No error
TwitterHideReplyBlock Hides a reply of one of your tweets No error
TwitterUnhideReplyBlock Unhides a reply to a tweet No error
TwitterLikeTweetBlock Likes a tweet No error
TwitterGetLikingUsersBlock Gets information about users who liked one of your tweets No error
TwitterGetLikedTweetsBlock Gets information about tweets liked by you No error
TwitterUnlikeTweetBlock Unlikes a tweet that was previously liked No error
TwitterPostTweetBlock Create a tweet on Twitter with the option to include one additional element such as media, quote, or deep link. No error
TwitterDeleteTweetBlock Deletes a tweet on Twitter using Twitter ID No error
TwitterSearchRecentTweetsBlock Searches all public Tweets in Twitter history No error
TwitterGetQuoteTweetsBlock Gets quote tweets for a specified tweet ID No error
TwitterRetweetBlock Retweets a tweet on Twitter No error
TwitterRemoveRetweetBlock Removes a retweet on Twitter No error
TwitterGetRetweetersBlock Gets information about who has retweeted a tweet No error
TwitterGetUserMentionsBlock Returns Tweets where a single user is mentioned, just put that user ID No error
TwitterGetHomeTimelineBlock Returns a collection of the most recent Tweets and Retweets posted by you and users you follow No error
TwitterGetUserTweetsBlock Returns Tweets composed by a single user, specified by the requested user ID No error
TwitterGetTweetBlock Returns information about a single Tweet specified by the requested ID No error
TwitterGetTweetsBlock Returns information about multiple Tweets specified by the requested IDs No error
TwitterUnblockUserBlock Unblock a specific user on Twitter No error
TwitterGetBlockedUsersBlock Get a list of users who are blocked by the authenticating user No error
TwitterBlockUserBlock Block a specific user on Twitter No error
TwitterUnfollowUserBlock Allows a user to unfollow another user specified by target user ID No error
TwitterFollowUserBlock Allows a user to follow another user specified by target user ID No error
TwitterGetFollowersBlock Retrieves a list of followers for a specified Twitter user ID Need Enterprise level access
TwitterGetFollowingBlock Retrieves a list of users that a specified Twitter user ID is following Need Enterprise level access
TwitterUnmuteUserBlock Allows a user to unmute another user specified by target user ID No error
TwitterGetMutedUsersBlock Returns a list of users who are muted by the authenticating user No error
TwitterMuteUserBlock Allows a user to mute another user specified by target user ID No error
TwitterGetUserBlock Gets information about a single Twitter user specified by ID or username No error
TwitterGetUsersBlock Gets information about multiple Twitter users specified by IDs or usernames No error
TwitterSearchSpacesBlock Returns live or scheduled Spaces matching specified search terms [for a week only] No error
TwitterGetSpacesBlock Gets information about multiple Twitter Spaces specified by Space IDs or creator user IDs No error
TwitterGetSpaceByIdBlock Gets information about a single Twitter Space specified by Space ID No error
TwitterGetSpaceBuyersBlock Gets list of users who purchased a ticket to the requested Space I do not have a monetized account for this
TwitterGetSpaceTweetsBlock Gets list of Tweets shared in the requested Space No error
TwitterUnfollowListBlock Unfollows a Twitter list for the authenticated user No error
TwitterFollowListBlock Follows a Twitter list for the authenticated user No error
TwitterListGetFollowersBlock Gets followers of a specified Twitter list Enterprise level access
TwitterGetFollowedListsBlock Gets lists followed by a specified Twitter user Enterprise level access
TwitterGetListBlock Gets information about a Twitter List specified by ID No error
TwitterGetOwnedListsBlock Gets all Lists owned by the specified user No error
TwitterRemoveListMemberBlock Removes a member from a Twitter List that the authenticated user owns No error
TwitterAddListMemberBlock Adds a member to a Twitter List that the authenticated user owns No error
TwitterGetListMembersBlock Gets the members of a specified Twitter List No error
TwitterGetListMembershipsBlock Gets all Lists that a specified user is a member of No error
TwitterGetListTweetsBlock Gets tweets from a specified Twitter list No error
TwitterDeleteListBlock Deletes a Twitter List owned by the authenticated user No error
TwitterUpdateListBlock Updates a Twitter List owned by the authenticated user No error
TwitterCreateListBlock Creates a Twitter List owned by the authenticated user No error
TwitterUnpinListBlock Enables the authenticated user to unpin a List. No error
TwitterPinListBlock Enables the authenticated user to pin a List. No error
TwitterGetPinnedListsBlock Returns the Lists pinned by the authenticated user. No error
TwitterGetDMEventsBlock Gets a list of Direct Message events for the authenticated user Need Enterprise level access
TwitterSendDirectMessageBlock Sends a direct message to a Twitter user Need Enterprise level access
TwitterCreateDMConversationBlock Creates a new group direct message Need Enterprise level access

Need to add more stuff

  1. A normal input to select date and time.
  2. Some more enterprise-level blocks, especially webhook triggers.

Supported triggers

Event Name Description
Posts (by user) User creates a new post.
Post deletes (by user) User deletes an existing post.
@mentions (of user) User is mentioned in a post.
Replies (to or from user) User replies to a post or receives a reply from another user.
Retweets (by user or of user) User retweets a post or someone retweets the user's post.
Quote Tweets (by user or of user) User quote tweets a post or someone quote tweets the user's post.
Retweets of Quoted Tweets (by user or of user) Retweets of quote tweets by the user or of the user.
Likes (by user or of user) User likes a post or someone likes the user's post.
Follows (by user or of user) User follows another user or another user follows the user.
Unfollows (by user) User unfollows another user.
Blocks (by user) User blocks another user.
Unblocks (by user) User unblocks a previously blocked user.
Mutes (by user) User mutes another user.
Unmutes (by user) User unmutes a previously muted user.
Direct Messages sent (by user) User sends direct messages to other users.
Direct Messages received (by user) User receives direct messages from other users.
Typing indicators (to user) Indicators showing when someone is typing a message to the user.
Read receipts (to user) Indicators showing when the user has read a message.
Subscription revokes (by user) User revokes a subscription to a service or content.

@Abhi1992002 Abhi1992002 requested a review from a team as a code owner November 25, 2024 16:44
@Abhi1992002 Abhi1992002 requested review from Torantulino and Bentlybro and removed request for a team November 25, 2024 16:44
Copy link
Contributor

This PR targets the master branch but does not come from dev or a hotfix/* branch.

Automatically setting the base branch to dev.

@github-actions github-actions bot changed the base branch from master to dev November 25, 2024 16:44
@github-actions github-actions bot added size/xl platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end platform/blocks and removed size/xl labels Nov 25, 2024
Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 5ceca51
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/675b5df93d3ea000087c0f4f

@Abhi1992002 Abhi1992002 changed the title add twitter credentials with some frontend changes feat(platform) : add twitter credentials with some frontend changes Nov 25, 2024
@aarushik93 aarushik93 self-requested a review November 25, 2024 17:08
@aarushik93
Copy link
Contributor

wooo thanks for this. Testing & reviewing!

one thing to fix the CI, please run what it's asking for

poetry lock --no-update

@Abhi1992002
Copy link
Contributor Author

Sorry, I haven't fixed some block tests after making changes. I will make the tests work by tomorrow.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Nov 25, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@Abhi1992002 Abhi1992002 marked this pull request as draft November 27, 2024 14:10
@Abhi1992002 Abhi1992002 marked this pull request as ready for review November 29, 2024 02:57
@Abhi1992002
Copy link
Contributor Author

@aarushik93 @Bentlybro @Torantulino

The main issue in this file is with the node-input-component file.
I have added a multi-select input for a list of enums, and @Pwuts has also made a change to that.
Could you please review my changes in the select file to see if any adjustments are needed? If there are, I will make the changes.

Summary:

  • I have added an extra option in the input is_multi_select and enum.
  • If the input type is an array, is multi-selected, and has an enum, I am rendering the multi-select.

@Pwuts Pwuts self-requested a review December 2, 2024 12:21
@Pwuts Pwuts changed the title feat(platform) : add twitter credentials with some frontend changes feat(platform): Add Twitter integration Dec 2, 2024
- Updated `store.py` to improve state token management by adding PKCE support and simplifying code challenge generation.
- Modified environment variable names in `.env.example` for consistency.
- Removed unnecessary `is_multi_select` attributes from various Twitter-related input schemas to streamline the code.
- Cleaned up exception handling in Twitter list management and tweet management blocks by removing redundant error logging.
- Removed debug print statements from various components to clean up the codebase.
- Fixed a minor error message in the Twitter OAuth handler for clarity.
@Abhi1992002 Abhi1992002 force-pushed the feature/twitter-integration branch from e0712a3 to 07ef229 Compare December 8, 2024 05:11
Copy link
Contributor

github-actions bot commented Dec 8, 2024

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Dec 8, 2024
@Abhi1992002 Abhi1992002 marked this pull request as draft December 8, 2024 05:19
@Abhi1992002
Copy link
Contributor Author

Abhi1992002 commented Dec 8, 2024

TODO:

  • Add depend_on and oneof field support
  • Add Support to new credential system
  • handle Optional values in a better way on frontend
  • All fields are required right now, Need to make some Optional

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Dec 9, 2024
Copy link
Contributor

github-actions bot commented Dec 9, 2024

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Dec 12, 2024
Copy link
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@@ -58,6 +58,11 @@ GITHUB_CLIENT_SECRET=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# Twitter/X OAuth App server credentials - https://developer.x.com/en/products/x-api
TWITTER_CLIENT_ID=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be more clearr with what these are and where to get them. Do I need to setup User Authentication Settings?

@ntindle
Copy link
Member

ntindle commented Dec 12, 2024

image
These two filters need much better descriptions and are also required for some reason even though the text of the expansions is off

Other wise, I can get and post tweets. I don't have a paid API account so can't do much past that cc @Torantulino

@ntindle
Copy link
Member

ntindle commented Dec 12, 2024

fixed and pushed merge conflict issue

  • Credential fixes
  • Linting fixes
  • Poetry fixes (stuff was updated that probably shouldn't have been)

Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts platform/backend AutoGPT Platform - Back end platform/blocks platform/frontend AutoGPT Platform - Front end size/xl
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants