Skip to content
Netlify function to post a tweet to Twitter!
Branch: master
Clone or download
Latest commit ff899be Feb 15, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib fixing things Dec 8, 2018
src fixing things Dec 8, 2018
.gitignore initial add Dec 8, 2018
.nvmrc initial add Dec 8, 2018 Update Feb 15, 2020
netlify.toml initial add Dec 8, 2018
package.json package updates Feb 15, 2020
yarn.lock package updates Feb 15, 2020

🐦 Tweet with Twitter!

Lambda for simply sending a tweet upon post using Netlify's Functions capabilities.

⚡ Quick Start

Deploy to Netlify

  • Deploy to Netlify (use button above)
  • Add a unique key as your APP_SECRET under Settings > Build & Deploy > Environment
  • Once deployed, you're ready to get started!

Your function should now be avialable at:


🚀 Posting to Endpoint

Authorization Header

When posting to the endpoint, you'll need to generate a JWT given the same APP_SECRET as above. The contents of the JWT before signed should look like:

  twitter_consumer_key: [key],
  twitter_consumer_secret: [key],
  twitter_access_token_key: [key],
  twitter_access_token_secret: [key],

You can use libraries such as Auth0's JsonWebToken to generate within your app:

Pass this as an Authorization header


The body of the post should look like the following:

  "description": "[text of tweet]",
  "link": "[tweet link appended to status]",
  "image": "[tweet image (optional)]",

⚒️ Local Setup

Install Dependencies

To begin setup, with a newly cloned repo:

yarn install


Create a local .env file at the root of the project with the shared secret. This is used in coordination with JWT to create token containing your Twitter keys that gets posted to this function endpoint.


Run it Locally

To test this locally, run:

yarn serve

The function should now be available at localhost:9000/tweet

You can’t perform that action at this time.