GitXplorerGitXplorer
r

tweet

public
1 stars
0 forks
15 issues

Commits

List of commits on branch master.
Unverified
ae1c4ee0fc4782f76b51f5f9c1b96553ea0cbf09

Merge branch 'master' of github.com:colbyfayock/tweet

ccolbyfayock committed 5 years ago
Unverified
556b83e3fa0074643df5bf2bdf97622e0b14a9ce

packages

ccolbyfayock committed 5 years ago
Verified
ff899bed98ec7f46809fa2faec8bf751f9db3526

Update README.md

ccolbyfayock committed 5 years ago
Verified
d5b5c8e96d0ce582c770832f04373ad6752e9ae9

Update README.md

ccolbyfayock committed 5 years ago
Verified
c007bc6e8580c46a9422a409f8ac2081d3f3a089

Update README.md

ccolbyfayock committed 5 years ago
Verified
830f14786e6793d2281c28d667e7486c064f41ee

Update README.md

ccolbyfayock committed 5 years ago

README

The README file for this repository.

🐦 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:

https://[your-netlify-site].netlify.com/.netlify/functions/tweet

🚀 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: https://github.com/auth0/node-jsonwebtoken

Pass this as an Authorization header

Content

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

Env

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.

APP_SECRET="[secret]"

Run it Locally

To test this locally, run:

yarn serve

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