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

Angela - Twitter Poster #1156

Open
wants to merge 14 commits into
base: development
Choose a base branch
from
Open

Conversation

angelalalacheng
Copy link
Contributor

Description

This PR adds API endpoints for posting content on Twitter, enabling image extraction and posting capabilities (note: scheduling is not included in this PR). Currently, there are no related frontend PRs, as frontend development for these features is still in progress. Once the frontend is ready, these APIs will be integrated to complete the functionality.

Main changes explained:

  • Created socialMediaController.js:
    • Extract text and image URLs or base64 content from content.
    • Post tweets with optional media content to Twitter using createTweet.
    • Handle token retrieval for Twitter OAuth authentication.
  • Created socialMediaRouter.js: Defines routes to handle Twitter API interactions, including posting images and obtaining access tokens.
  • Updated routes.js: Integrated the new socialMediaRouter within the main app router configuration to expose the new API endpoints.

How to test:

  1. check into current branch
  2. do npm install and npm run dev to run this PR locally
  3. Access the endpoints:
  • /api/getTwitterAccessToken - Test Twitter token retrieval.
  • /api/createTweet - Test Twitter posting functionality with sample data.

Screenshots or videos of changes (Just temporary UI):

https://www.loom.com/share/e41dadeae7334dc9a20a1adff8b4b3fc?sid=ef77017e-d178-44b7-ba45-9d2105576708

Note:

  1. Twitter Developer Account Setup
  • Apply for a Developer Account: Go to the Twitter Developer Platform.
  • Once approved, navigate to the Developer Portal.
  • Create a new project and then an app within that project.
  • Under “User authentication settings,” set the App permissions to “Read and Write.”
  • Set the Callback URI to http://localhost:3000 or your application’s URL.
  1. Set them as environment variables in your application (.env file):

Twitter:

  • REACT_APP_TWITTER_CLIENT_ID
  • REACT_APP_TWITTER_CLIENT_SECRET
  • REACT_APP_TWITTER_APP_KEY
  • REACT_APP_TWITTER_APP_SECRET
  • REACT_APP_TWITTER_ACCESS_TOKEN
  • REACT_APP_TWITTER_ACCESS_SECRET

@angelalalacheng angelalalacheng added Do Not Review Do not review or look at code without full context DO NOT MERGE Don't merge PR labels Nov 18, 2024
@one-community one-community added the Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it. label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE Don't merge PR Do Not Review Do not review or look at code without full context Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants