Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Is there a way to post multiple threads at once? #291

Open
agrawalishaan opened this issue Jul 29, 2023 · 3 comments
Open

Is there a way to post multiple threads at once? #291

agrawalishaan opened this issue Jul 29, 2023 · 3 comments

Comments

@agrawalishaan
Copy link

Thanks to all the contributors to this project, and sorry for my constant questions / requests. In threads, you can create multi-posts, I was wondering if there was a way we could access this feature via this API? We can currently emulate it by running n separate requests, but that is non-atomic and presumably takes extra requests.

@Aerglonus
Copy link
Contributor

You can do this

const mainpost = await threadsAPI.publish({
  text: "Main post",
)}
// main post will return the post ID

await threadsAPI.publish({
    text: "🤖 Beep",
    link: "https://github.com/junhoyeo/threads-api",
    parentPostID: mainpost,
});

Why this approach?

  • The multiple threads feature in the app is basically this. Lets say you post 3 consecutively, First post is the main post and the second post is a reply to the main post and third post is a reply to the second post. The multi-thread are basically replies to a post

--These are the requests the app makes when posting multi-threads--

Can this be simplified?

  • Probably, but even them in the app make multiple request like the code above, if you pay attention when you post a multi-thread it shows a pop-up that says "posting...." if you make a multi-thread with 3 posts it will show 3 times the "posting.." pop-up because as i said multi-threads are just replies to a main post.

@agrawalishaan
Copy link
Author

You can do this

const mainpost = await threadsAPI.publish({
  text: "Main post",
)}
// main post will return the post ID

await threadsAPI.publish({
    text: "🤖 Beep",
    link: "https://github.com/junhoyeo/threads-api",
    parentPostID: mainpost,
});

Why this approach?

  • The multiple threads feature in the app is basically this. Lets say you post 3 consecutively, First post is the main post and the second post is a reply to the main post and third post is a reply to the second post. The multi-thread are basically replies to a post

--These are the requests the app makes when posting multi-threads--

Can this be simplified?

  • Probably, but even them in the app make multiple request like the code above, if you pay attention when you post a multi-thread it shows a pop-up that says "posting...." if you make a multi-thread with 3 posts it will show 3 times the "posting.." pop-up because as i said multi-threads are just replies to a main post.

Hey, thanks so much, this helps a lot. Can I ask what tool you are using to look at the requests?

@tonypeng
Copy link

tonypeng commented Aug 2, 2023

You can do this

const mainpost = await threadsAPI.publish({
  text: "Main post",
)}
// main post will return the post ID

await threadsAPI.publish({
    text: "🤖 Beep",
    link: "https://github.com/junhoyeo/threads-api",
    parentPostID: mainpost,
});

Why this approach?

  • The multiple threads feature in the app is basically this. Lets say you post 3 consecutively, First post is the main post and the second post is a reply to the main post and third post is a reply to the second post. The multi-thread are basically replies to a post

--These are the requests the app makes when posting multi-threads--

Can this be simplified?

  • Probably, but even them in the app make multiple request like the code above, if you pay attention when you post a multi-thread it shows a pop-up that says "posting...." if you make a multi-thread with 3 posts it will show 3 times the "posting.." pop-up because as i said multi-threads are just replies to a main post.

fwiw, doing this caused my test account to get blocked for automated activity trying to post 25 posts (posted 22 and then blocked)

looking at the requests vs this code, it seems like the official app makes an API request to /api/v1/warning/check_offensive_multi_text first, and each publish API call also includes a nav_chain and _uuid which are not sent by this library.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants