Groups

Search, join and read Facebook groups, list their members, and publish in them with Unipile API.

A group's posts are regular posts: once you have a post ID from a group, the Posts methods (comments, replies, reactions, deletion) work on it.


Search groups

Use Perform Groups Search. Send the same body with the cursor of the previous page to get the next one.

  • is_member: true only returns the groups the account is a member of, is_public: true only the public ones. false is not supported and gets a 400.
  • Facebook sets the page size: a page may hold fewer results than limit.
  • Each result has the account's membership_status: member, pending or not_member.
curl --request POST \
     --url 'https://api.unipile.com/v2/{ACCOUNT_ID}/search/groups?limit=10' \
     --header 'X-API-KEY: {YOUR_API_KEY}' \
     --header 'content-type: application/json' \
     --data '{ "keywords": "marketing", "is_public": true }'

Join a group

Use Join a Group with the group's numeric ID. When the group's admins approve new members, the answer is pending until they do.


List members and posts

  • List all Group's Members returns the members, newest first, with is_admin. Facebook returns up to 10 members per page: use next_cursor.
  • List all Group's Posts returns the posts, newest first, a few per page. The posts of a private group are returned to its members only: a non-member gets an empty list.

Retrieve and create a group

  • Get a Group returns its name, link, member count, the account's membership and whether it is an admin, and the description of its About tab when the account can see it.
  • Create a Group creates a group administered by the account: private by default, public with is_public: true. Facebook creates it without a description: description gets a 400.

Invite friends

Add a Member to a Group invites a friend of the account (user_id, a numeric Facebook ID): they join once they accept. A friend already invited gets a 409.


Publish in a group

Use Create a Post in a Group with text and, optionally, attachments. The account must be a member. Delete the post with Delete a Post: a group post is deleted, not moved to the trash.

curl --request POST \
     --url https://api.unipile.com/v2/{ACCOUNT_ID}/groups/{GROUP_ID}/posts \
     --header 'X-API-KEY: {YOUR_API_KEY}' \
     --header 'content-type: application/json' \
     --data '{ "text": "Hello group" }'

Not supported

Updating and leaving a group, and administering it (admins, removing members, join requests, invite link) are not supported.


What’s Next

Continue with Facebook events.

Did this page help you?