List user posts

Learn how to get the posts and activity of a Facebook user or Page with Unipile API.

📘

A Facebook post ID has the form <author id>_<post id>. For endpoints requiring a post ID, use the identifiers returned by Unipile.

List posts

To get a list of posts, use the List all User's Posts endpoint, specifying whose posts you want to retrieve in user_id:

  • me for the account's own posts.
  • The Page ID for one of the account's activated Pages.
  • The ID or vanity name of any other person or Page.
const { data } = await usersApi.getPostsList({
  path: {
    account_id: "acc_123456789",
    user_id: "me",
  },
});
posts = users_api.get_posts_list("me", "acc_123456789")
curl --request GET \
     --url https://api.unipile.com/v2/acc_123456789/users/me/posts \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json'
🚧

Page size

Facebook sets the page size: each page holds up to 3 posts whatever the limit. Use next_cursor to get more. Pagination with offset is not supported.


Get a post

To get a single post, use the Get a Post endpoint.

const { data } = await postsApi.getPost({
  path: {
    account_id: "acc_123456789",
    post_id: "post_id",
  },
});
post = posts_api.get_post("post_id", "acc_123456789")
curl --request GET \
     --url https://api.unipile.com/v2/acc_123456789/posts/post_id \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json'

Retrieve user activity

Use List all User's Comments or List all User's Reactions to retrieve what a user commented or reacted to.

On Facebook, these endpoints read the activity log, so user_id must be me or one of the account's activated Pages. Each page holds at most 25 results.

const { data } = await postsApi.getUserCommentsList({
  path: {
    account_id: "acc_123456789",
    user_id: "me",
  },
  query: {
    limit: 25,
  },
});
data = posts_api.get_user_comments_list(
    "me",
    "acc_123456789",
    limit=25,
)
curl --request GET \
     --url 'https://api.unipile.com/v2/acc_123456789/users/me/comments?limit=25' \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json'

Did this page help you?