Skip to content

Commit

Permalink
fix twitter.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgarropy-atlassian committed Jul 21, 2023
1 parent 4858dc3 commit 2d15a4f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
17 changes: 7 additions & 10 deletions functions/utils/twitter.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
require("dotenv").config()
const Twitter = require("twitter")
const {TwitterApi} = require("twitter-api-v2")

const twitter = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
const twitter = new TwitterApi({
appKey: process.env.TWITTER_CONSUMER_KEY,
appSecret: process.env.TWITTER_CONSUMER_SECRET,
accessToken: process.env.TWITTER_ACCESS_TOKEN_KEY,
accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
})

const tweet = async content => {
const response = await twitter.post("statuses/update", {
status: content,
})

const response = await twitter.readWrite.v2.tweet(content)
return response
}

Expand Down
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"slugify": "^1.6.0",
"spotify-web-api-node": "^5.0.0",
"styled-components": "^5.3.1",
"twitter": "^1.7.1"
"twitter": "^1.7.1",
"twitter-api-v2": "^1.15.1"
},
"devDependencies": {
"@bradgarropy/eslint-config": "^1.1.0",
Expand Down

0 comments on commit 2d15a4f

Please sign in to comment.