Skip to content

The workspaces resource covers everything outside content publishing: connections, members, permissions, and keys.

Workspaces

typescript
// List
const list = await socifyr.workspaces.list()

// Create
const ws = await socifyr.workspaces.create({ name: 'New brand' })

// Fetch one
const one = await socifyr.workspaces.get(workspaceId)

// Rename
await socifyr.workspaces.update(workspaceId, { name: 'Renamed' })

// Delete
await socifyr.workspaces.delete(workspaceId)

Connections

typescript
const connections = await socifyr.workspaces.listConnections(workspaceId)

// Disconnect (removes from workspace, keeps platform OAuth)
await socifyr.workspaces.disconnectPlatform(workspaceId, connectionId)

// Revoke (revokes the OAuth token AND removes)
await socifyr.workspaces.revokePlatform(workspaceId, connectionId)

// For Facebook / Instagram, update which page or account the connection targets
await socifyr.workspaces.updatePlatformPages(workspaceId, connectionId, {
  targetId: '101574425127722',
})

Members

typescript
const members = await socifyr.workspaces.listMembers(workspaceId)
//  [{ id, userId, roleKey: 'OWNER' | 'ADMIN' | 'EDITOR' | 'CONTRIBUTOR', joinedAt }]

await socifyr.workspaces.updateMemberRole(workspaceId, userId, {
  roleKey: 'EDITOR',
})

await socifyr.workspaces.removeMember(workspaceId, userId)

Invitations

typescript
const invite = await socifyr.workspaces.invite(workspaceId, {
  email: 'teammate@example.com',
  roleKey: 'EDITOR',
})

const pending = await socifyr.workspaces.listInvitations(workspaceId)

await socifyr.workspaces.cancelInvitation(workspaceId, invite.id)

API keys

typescript
const keys = await socifyr.workspaces.listApiKeys(workspaceId)

const { plaintext, key } = await socifyr.workspaces.createApiKey(workspaceId, {
  label: 'CI bot',
})
console.log(plaintext) // shown only once — save it now

await socifyr.workspaces.deleteApiKey(workspaceId, keyId)