threads-api icon indicating copy to clipboard operation
threads-api copied to clipboard

Is there a way to post multiple threads at once?

Open ishaanbuildsthings opened this issue 1 year ago • 3 comments

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.

ishaanbuildsthings avatar Jul 29 '23 03:07 ishaanbuildsthings

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.

Aerglonus avatar Jul 31 '23 22:07 Aerglonus

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?

ishaanbuildsthings avatar Jul 31 '23 22:07 ishaanbuildsthings

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.

tonypeng avatar Aug 02 '23 01:08 tonypeng