Skip to content

threadsjs/threads.js

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

* detect checkpoint

* make usage of pk_id consistent
eff376c

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
July 10, 2023 09:06
July 10, 2023 08:21
July 5, 2023 17:47
July 7, 2023 10:48
July 10, 2023 08:31

threads.js

thread.js is a Node.js library that allows you to interact with the Threads API

npm version Downloads Average time to resolve an issue Percentage of issues still open

FeaturesInstallation and updatingUsageMethods

Features

  • Object-oriented
  • Performant
  • Authenticated
  • 100% coverage

Installation and updating

npm install @threadsjs/threads.js

Usage

const { Client } = require('@threadsjs/threads.js');

(async () => {
	const client = new Client();
	// You can also specify a token: const client = new Client({ token: 'token' });
	await client.login('username', 'password');

	await client.users.fetch('25025320').then(user => {
		console.log(user);
	});
})();

Methods

client.users.fetch

In the parameters, pass the userId of the user whose information you want to get.

await client.users.fetch("1")

client.users.follow

Pass the userId of the user you want to subscribe to in the parameters

await client.users.follow("1")

client.users.search

Pass the query as the first parameter, and the number of objects in the response as the second parameter (by default - 30)

await client.users.search("zuck", "10")

client.users.followers

In the parameters, pass the userId of the user whose followers you want to get.

await client.users.followers("1")

client.users.following

In the parameters, pass the userId of the user whose followings you want to get.

await client.users.following("1")

client.feeds.fetchThreads

In the parameters, pass the userId of the user whose threads you want to get.

await client.feeds.fetchThreads("1")

client.feeds.fetchReplies

In the parameters, pass the userId of the user whose replies you want to get.

await client.feeds.fetchReplies("1")

client.feeds.recommended

Getting a list of recommendations.

await client.feeds.recommended()

client.posts.fetch

In the parameters pass the id of the post you want to get information about

await client.posts.fetch("aAaAAAaaa")

client.posts.likers

In the parameters pass the id of the post whose likes you want to get

await client.posts.likers("aAaAAAaaa")

client.posts.create

The method is used to create a thread. Pass the text of the thread as the first parameter, and the user id as the second

await client.posts.create("Hello world!", "1")

client.posts.reply

The method is used to create reply to a thread. Pass the text of the reply as the first parameter, the user id as the second, and post id as the third

await client.posts.reply("Hello world!", "1", "aAaAAAaaa")

client.posts.delete

The method is used to delete a thread. Pass the post id as the first parameter, and the user id as the second

await client.posts.delete("aAaAAAaaa", "1")

client.posts.like

The method is used to like a thread. Pass the post id as the first parameter, and the user id as the second

await client.posts.like("aAaAAAaaa", "1")

About

A Node.js library for the Threads API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published