threads.js icon indicating copy to clipboard operation
threads.js copied to clipboard

Method IDs (post and user)

Open mazenkourouche opened this issue 2 years ago • 4 comments

Not sure if this has been answered yet but which IDs should be used for user and post?

I'm getting 'Unknown server error' when performing a reply.

Im using the post.id and user.pk_id for that post. Should the user ID be my ID? (if so, have we found a way to get that ID from the token)?

mazenkourouche avatar Jul 11 '23 00:07 mazenkourouche

the user ID needs to be the the poster's. so if instagram makes a post, it would be the post ID and then the user ID of instagram

elijah-wright avatar Jul 11 '23 01:07 elijah-wright

Sorry just trying to work my head around why I'm getting the "unknown server error". So assuming this is the post I want to reply to:

"items": [
    {
      "thread_items": [
        {
          "post": {
            "pk": 3144129357602005500,
            "id": "3144129357602005392_1468330069",
            "text_post_app_info": {
              ...
            },
            "caption": {
              "pk": "17923171223651751",
              "user_id": 1468330069,
              "text": "why does tiredness on the couch not follow me to the bed",
              ...
              "user": {
                "pk": 1468330069,
                "pk_id": "1468330069",
                "username": "nugget",
                "full_name": "Nugget",
                "is_private": false,
                "is_verified": false,
                ...
              },
              "is_covered": false,
              "is_ranked_comment": false,
              "media_id": 3144129357602005500,
              "private_reply_status": 0
            },
            ...
            "top_likers": ["iy0017"],
            "user": {
              "pk": 1468330069,
              "pk_id": "1468330069",
              "username": "nugget",
              "full_name": "Nugget",
              "is_private": false,
              "is_verified": false,
              "profile_pic_id": "3140521191102418822_1468330069",
              "friendship_status": {
                "following": false,
                "followed_by": false,
                ...
              },
              "has_anonymous_profile_picture": false,
              "has_onboarded_to_text_post_app": true,
              "account_badges": []
            },
          },
        }
      ],
      "header": null,
      "thread_type": "thread",
      "show_create_reply_cta": false,
      "id": 3144129357602005500,
      "view_state_item_type": 132,
      ...
    }
the post ID would be '"id": "3144129357602005392_1468330069" and the user ID would be 1468330069?

Because using those values resulted in the error mentioned

mazenkourouche avatar Jul 11 '23 01:07 mazenkourouche

here's what I tried:

await client.posts.fetch('3144129357602005500', '1468330069').then(post => {
	console.log(post);
});

and I got something about being unable to read the post

elijah-wright avatar Jul 11 '23 02:07 elijah-wright

Some actions aren't available for certain types of posts, like reposts. I believe you can't directly reply to a repost. For this case I grab the ID of the referenced post in the post.text_post_app_info.share_info.reposted_post key.

stevenlafl avatar Jul 11 '23 14:07 stevenlafl

closing, I assume this is resolved

elijah-wright avatar Jul 12 '23 03:07 elijah-wright