Skip to content

Commit

Permalink
feat: Switch to the v2 Twitter API (#207)
Browse files Browse the repository at this point in the history
* Untested switch to v2 API

* Update the first test to expect v2 API calls

* Update command line tests with media

* Update push front matter tests

* Update remaining push tests

* Prettier

* Quote tweets contain a t.co link in the response text

* Switch to maintained ncc package

* build with new Twitter + ncc libs

* Update documentation based on current Twitter flow

* Remove user/account ID from workflow

* Bump release workflow to v3
  • Loading branch information
MattIPv4 authored Oct 6, 2022
1 parent 66e7a86 commit f6851e3
Show file tree
Hide file tree
Showing 30 changed files with 30,636 additions and 57,212 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- run: >-
git push --force
https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
HEAD:refs/heads/v2
HEAD:refs/heads/v3
env:
GITHUB_TOKEN: ${{ secrets.GR2M_PAT_FOR_SEMANTIC_RELEASE }}
2 changes: 0 additions & 2 deletions .github/workflows/twitter-together.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@ jobs:
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }}
TWITTER_API_SECRET_KEY: ${{ secrets.TWITTER_API_SECRET_KEY }}
TWITTER_USER_ID: 1099774878213783553
TWITTER_ACCOUNT_ID: 18ce551qf6o
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ You can submit a tweet to this repository to see the magic happen. Please follow

## Twitter API compatibility

The Twitter Ads API we currently use is the `v8` version.
Twitter, Together uses the v2 Twitter API for most functionality.
It makes use of the v1 API for media uploads, as there is no v2 equivalent endpoint.

Essentials level Twitter access should grant access to all endpoints Twitter, Together uses.

## Setup

Unless you wish to contribute to this project, you don't need to fork this repository. Instead, you can make use of this GitHub Action from the comfort of your own repository (either a new one, or one you already have) by creating a GitHub Actions workflow following these steps:
Unless you wish to contribute to this project, you don't need to fork this repository.
Instead, you can make use of this GitHub Action from the comfort of your own repository (either a new one, or one you already have) by creating a GitHub Actions workflow following these steps:

1. [Create a twitter app](docs/01-create-twitter-app.md) with your shared twitter account and store the credentials as `TWITTER_API_KEY`, `TWITTER_API_SECRET_KEY`, `TWITTER_ACCESS_TOKEN` and `TWITTER_ACCESS_TOKEN_SECRET` in your repository’s secrets settings.
1. [Create a Twitter app](docs/01-create-twitter-app.md) with your shared Twitter account and store the credentials as `TWITTER_API_KEY`, `TWITTER_API_SECRET_KEY`, `TWITTER_ACCESS_TOKEN` and `TWITTER_ACCESS_TOKEN_SECRET` in your repository’s secrets settings.
2. [Create a `.github/workflows/twitter-together.yml` file](docs/02-create-twitter-together-workflow.md) with the content below. Make sure to replace `'main'` if you changed your repository's default branch.

```yml
Expand Down
Loading

0 comments on commit f6851e3

Please sign in to comment.