How to retweet using the Twitter API and Netlify serverless function
Posted on December 19, 2021
Here the snippet:
const client = require('./common/twitterClient')
exports.handler = async (event, context) => {
const body = JSON.parse(event.body)
const id = body.id
const res = await client.post('statuses/retweet', { id })
return {
statusCode: 200,
body: JSON.stringify(res)
}
}