{"id":16095649,"url":"https://github.com/rigwild/tweet-generator-microservice","last_synced_at":"2025-08-12T02:40:27.557Z","repository":{"id":115713403,"uuid":"203256074","full_name":"rigwild/tweet-generator-microservice","owner":"rigwild","description":"Generate fake tweets images as a Lambda microservice 🤷‍♂️","archived":false,"fork":false,"pushed_at":"2022-11-26T16:15:47.000Z","size":186,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T13:11:14.304Z","etag":null,"topics":["generator","lambda-functions","microservice","now-sh","tweet","twitter","typescript"],"latest_commit_sha":null,"homepage":"https://tweet-generator.now.sh/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rigwild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-19T21:59:30.000Z","updated_at":"2025-03-14T13:09:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9e38630-6b0d-4bc6-bc2c-1772512e8b71","html_url":"https://github.com/rigwild/tweet-generator-microservice","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"a6d554c879b350b177257ba53dde13b14cc7b43f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rigwild/tweet-generator-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Ftweet-generator-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Ftweet-generator-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Ftweet-generator-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Ftweet-generator-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rigwild","download_url":"https://codeload.github.com/rigwild/tweet-generator-microservice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Ftweet-generator-microservice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269991259,"owners_count":24509004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","lambda-functions","microservice","now-sh","tweet","twitter","typescript"],"created_at":"2024-10-09T17:07:26.857Z","updated_at":"2025-08-12T02:40:27.478Z","avatar_url":"https://github.com/rigwild.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tweet-generator-microservice\nGenerate fake tweets images as a [Now](https://zeit.co/now) microservice.\n\nSupports [Twemoji](https://twemoji.twitter.com/) and tweet quotes.\n\n## How it works\nAn express server renders the tweet using an EJS template. A puppeteer instance is fired and screenshots the page. The image is then returned by the endpoint.\n\n## Usage\nAppend the [URI queries](#uri-queries) to [https://tweet-generator.now.sh/tweet](https://tweet-generator.now.sh/tweet) to generate a tweet webpage.\n\nAppend the [URI queries](#uri-queries) to [https://tweet-generator.now.sh/screenshot](https://tweet-generator.now.sh/screenshot) to generate a tweet image .\n\n### URI queries\n| Name | Description |\n| ---- | ----------- |\n| `style` | Tweet template to use (see [Tweet templates](#tweet-templates)) |\n| `tweetData` | Stringified JSON object containing tweet's data (see [Tweet data object](#tweet-data-object)) |\n\n### Tweet templates\n| Name | Description |\n| ---- | ----------- |\n| `classic` | Normal tweet (default if not specified) |\n| `no-stats` | Normal tweet without statistics |\n\n### Tweet data object\nA JSON stringified object containing the tweet's properties.\n\nIf you have UTF-16 (like recent emojis) content, JSON stringify, URI encode and convert to Base64. See [Implementation example](#implementation-example).\n\n| Name | type | Required | Default |\n| ---- | ---- | :------: | ------- |\n| pseudo | `string` | ✅ |  |\n| handle | `string` | ✅ |  |\n| content | `string` | ✅ |  |\n| verified | `boolean` |  | `false` |\n| date | `Date` |  | Current date |\n| retweets | `number` |  | `0` |\n| likes | `number` |  | `0` |\n| replies | `number` |  | `0` |\n| avatar | `string` |  | [Default Twitter image](https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png) |\n| quoted | `Object` - all of the above except `quoted` |  | No quote |\n\n## Public demo\nYou can use the provided demo endpoint or host your own using [Now](https://zeit.co/now). Examples are given at the root of the website.\n\n[https://tweet-generator.now.sh/](https://tweet-generator.now.sh/)\n\n## Implementation example\nThe following ESM module script (`.mjs`) will generate a tweet image and download it to `generatedTweet.png`.\n\n```js\nimport fs from 'fs'\nimport fetch from 'node-fetch'\n\nconst setup = async () =\u003e {\n  // My future tweet data\n  const tweet = {\n    pseudo: 'My cool pseudo 🎉',\n    handle: 'my_handle',\n    content: 'My awesome tweet content 💖',\n    verified: true,\n    date: new Date(),\n    retweets: 54371,\n    likes: 54371,\n    replies: 543,\n    avatar: 'https://cdn.pixabay.com/photo/2016/03/09/16/47/woman-1246844_960_720.jpg',\n    quoted: {\n      pseudo: 'Quoted pseudo 🤷‍♂️',\n      handle: 'quoted_handle',\n      content: 'quoted tweet content',\n      verified: true,\n      date: new Date(Date.now() - 3694200),\n      retweets: 1,\n      likes: 14,\n      replies: 21,\n      avatar: 'https://cdn.pixabay.com/photo/2016/03/09/16/46/hiking-1246836__340.jpg'\n    }\n  }\n\n  // Create the uri (encodeURIComponent is important as stringified JSON can contain invalid query characters)\n  const uri = `https://tweet-generator.now.sh/screenshot?style=classic\u0026tweetData=${encodeURIComponent(JSON.stringify(tweet))}`)\n\n  /*\n  // If you have UTF-16 (like recent emojis), JSON stringify, URI encode and convert to Base64\n  const btoa = require('btoa')\n  const uri = `https://tweet-generator.now.sh/screenshot?style=classic\u0026tweetData=${btoa(encodeURIComponent(JSON.stringify(tweet)))}`\n  */\n\n  const { body } = await fetch(uri)\n    .then(async res =\u003e {\n      // The endpoint returned errors, throw\n      if (!res.ok) throw (await res.json()).errors.join(', ')\n      return res\n    })\n\n  // Save the response body to an image file\n  return new Promise((resolve, reject) =\u003e {\n    const fileStream = fs.createWriteStream('./generatedTweet.png')\n    body.pipe(fileStream)\n    body.on('error', err =\u003e reject(err))\n    fileStream.on('finish', () =\u003e resolve())\n  })\n}\n\nsetup()\n```\n\n## Contributing\nIf you want to contribute to this project, you can open an [issue](https://github.com/rigwild/tweet-generator-microservice/issues) detailing your suggestions or bugs.\n\nFeel free to open a [pull request](https://github.com/rigwild/tweet-generator-microservice/pulls).\n\n## License\n[The MIT license](./LICENSE)\n\nAuthor of this service is not affiliated in any way with `Twitter, Inc`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frigwild%2Ftweet-generator-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frigwild%2Ftweet-generator-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frigwild%2Ftweet-generator-microservice/lists"}