{"id":22731324,"url":"https://github.com/sno2/dwitter","last_synced_at":"2025-12-11T21:08:56.512Z","repository":{"id":62421613,"uuid":"289799048","full_name":"sno2/dwitter","owner":"sno2","description":"A typescript API wrapper for the Twitter API v2","archived":false,"fork":false,"pushed_at":"2020-09-25T14:24:57.000Z","size":33,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T14:51:50.443Z","etag":null,"topics":["hacktoberfest","twitter","twitter-api","twitter-api-v2","twitter-bot","twitterbot"],"latest_commit_sha":null,"homepage":"https://deno.land/x/dwitter","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sno2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-24T01:31:23.000Z","updated_at":"2023-02-26T14:40:43.000Z","dependencies_parsed_at":"2022-11-01T17:45:44.450Z","dependency_job_id":null,"html_url":"https://github.com/sno2/dwitter","commit_stats":null,"previous_names":["codingcarter/dwitter"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fdwitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fdwitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fdwitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fdwitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sno2","download_url":"https://codeload.github.com/sno2/dwitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248802377,"owners_count":21163834,"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","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":["hacktoberfest","twitter","twitter-api","twitter-api-v2","twitter-bot","twitterbot"],"created_at":"2024-12-10T19:21:28.785Z","updated_at":"2025-12-11T21:08:51.194Z","avatar_url":"https://github.com/sno2.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dwitter\n\nA [Deno](https://deno.land) module to use the new [Twitter Developer API v2](https://developer.twitter.com/en/docs/twitter-api/early-access)!\n\n## Module Installation\n\nTo use Dwitter, make sure that you have Deno installed. If you don't, make sure you go to the [Deno installation page](https://deno.land/#installation) and follow those steps. After that, you can import and use Dwitter via the following code:\n\n```ts\nimport { Dwitter } from \"https://deno.land/x/dwitter/mod.ts\";\n```\n\n## Usage\n\nHere is an example usage of the dwitter module which would log out some data about a tweet:\n\n```ts\nimport { config } from \"https://deno.land/x/dotenv/mod.ts\";\nimport { Dwitter } from \"https://deno.land/x/dwitter/mod.ts\";\n\nconst { bearerToken } = config({ path: \"./.twitter.env\" });\n\nconst dwitter = new Dwitter(bearerToken);\n\nconst myTweet = await dwitter.getTweet(\"1297888065764171776\");\n\nconsole.log(myTweet);\n```\n\nThe above code would log out the following to the console:\n\n```sh\n{\n  data: {\n    id: \"1297888065764171776\",\n    text: \"A second lil test tweet for a Deno module I'm working on...\"\n  }\n}\n```\n\nAs you can see, Dwitter returns the data in the same format that the Twitter API v2 does. For simplicity, we aren't going to be including the setup code in the following examples.\n\nIf you need to get more data about the tweets, you don't even need to worry about working with janky url parameters (yes, I just said janky). Include all of the request fields as the second parameter of supported methods, and Dwitter will just return your data like magic!\n\n```ts\nawait dwitter.getTweet(\"1297888065764171776\", {\n  \"tweet.fields\": [\"author_id\"],\n});\n```\n\n```sh\n{\n  data: {\n    author_id: \"1155201433261805570\",\n    id: \"1297888065764171776\",\n    text: \"A second lil test tweet for a Deno module I'm working on...\"\n  }\n}\n```\n\nNow, you may be thinking, does this mean that I can query any field on any of my requests? Your answer to that question is yes. Very much so yes. Here is how I can get some of the user data and expansions of tweets:\n\n```ts\nawait dwitter.getTweet(\"1297888065764171776\", {\n  \"tweet.fields\": [\"public_metrics\"],\n  \"user.fields\": [\"pinned_tweet_id\"],\n  expansions: [\"author_id\"],\n});\n```\n\n```sh\n{\n  data: {\n    author_id: \"1155201433261805570\",\n    text: \"A second lil test tweet for a Deno module I'm working on...\",\n    public_metrics: { retweet_count: 0, reply_count: 0, like_count: 1, quote_count: 0 },\n    id: \"1297888065764171776\"\n  },\n  includes: {\n    users: [\n      {\n        pinned_tweet_id: \"1307874778007699456\",\n        username: \"CodingCarter\",\n        id: \"1155201433261805570\",\n        name: \"Carter Snook\"\n      }\n    ]\n  }\n}\n```\n\nAs you can see, you can add any of the parameters that are acceptable according the [Twitter API v2 api reference docs](https://developer.twitter.com/en/docs/twitter-api/api-reference-index).\n\n## API\n\nOk, now that you understand how you can use Dwitter, let's show you all of what it has to offer!\n\n#### `.getTweet(id: string, fields?: any)`\n\n#### `.getTweets(ids: string[], fields?: any)`\n\n#### `.getUserById(id: string, fields?: any)`\n\n#### `.getUserByName(name: string, fields?: any)`\n\n#### `.getUsersByIds(ids: string[], fields?: any)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsno2%2Fdwitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsno2%2Fdwitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsno2%2Fdwitter/lists"}