The Connector SDK APIs are available through Forge's Early Access Program (EAP).
EAPs are offered to selected users for testing and feedback purposes. APIs and features under EAP are unsupported and subject to change without notice. APIs and features under EAP are not recommended for use in production environments.
To use the Connector SDK, you must be part of the Forge connector EAP. You can express interest in joining this EAP through this form.
The getGroupByExternalId
method allows you to retrieve a specific group from the Teamwork Graph
using its external ID. This is useful for fetching individual groups when you know their external
identifier.
1 2getGroupByExternalId(request: GetGroupByExternalIdRequest): Promise<GetGroupByExternalIdResponse>
GetGroupByExternalIdRequest
1 2// GetGroupByExternalIdRequest object: { externalId: string; // externalId: The external identifier of the group }
1 2import { graph } from '@forge/teamwork-graph'; const request = { externalId: 'developers' }; const response = await graph.getGroupByExternalId(request); if (response.success) { console.log('Group found:', response.group); } else { console.error('Error retrieving group:', response.error); }
1 2const response = await graph.getGroupByExternalId({ externalId: 'developers' }); if (response.success && response.group) { const group = response.group; console.log('Group ID:', group.id); console.log('External ID:', group.externalId); console.log('Display Name:', group.displayName); if (group.members) { console.log(`Group has ${group.members.length} members:`); group.members.forEach(member => { console.log(`- ${member.displayName || member.externalId} (${member.type})`); }); } if (group.meta) { console.log('Created:', group.meta.created); console.log('Last Modified:', group.meta.lastModified); console.log('Resource Type:', group.meta.resourceType); } }
Only one externalId
per request.
The method validates the following:
externalId
field must be a non-empty string.externalId
.Error message | Description |
---|---|
externalId is required | The externalId is missing or empty. |
Group not found | The specified group doesn't exist (API response). |
Failed to get group by external ID | The API request failed. |
The method returns a promise that resolves to a GetGroupByExternalIdResponse
object.
1 2// GetGroupByExternalIdResponse { success: boolean; // Indicates if the operation was successful group?: Group; // The retrieved group (if found) error?: string; // Error message (if operation failed) originalError?: unknown; // Original error object (if available) }
The returned Group
object contains comprehensive group information:
1 2type Group = { id: string; // Internal group ID (ARI) externalId: string; // External identifier displayName?: string; // Display name for the group members?: GroupMember[]; // Array of group members meta?: { // Metadata resourceType: string; created: string; lastModified: string; location: string; }; }; type GroupMember = { externalId: string; // External identifier for the member type: string; // Type of member (e.g., 'USER') updateSequenceNumber?: number; // Sequence number for tracking updates displayName?: string; // Display name for the member };
The SDK provides type-safe request and response objects that ensure compile-time validation:
1 2import { types } from '@forge/teamwork-graph'; // Type-safe request creation const request: types.GetGroupByExternalIdRequest = { externalId: 'developers' }; // Type-safe response handling const response = await graph.getGroupByExternalId(request); if (response.success && response.group) { // TypeScript knows group exists here const group = response.group; // Access group properties safely with proper typing console.log('Group ID:', group.id); console.log('External ID:', group.externalId); if (group.members) { // TypeScript knows members is an array of GroupMember group.members.forEach(member => { // member is properly typed as GroupMember console.log(`Member: ${member.externalId} (${member.type})`); }); } }
The type system ensures:
request.externalId
must be a stringresponse.group
is properly typed as Group
when success
is trueGroup
properties like id
, externalId
, displayName
, members
, and meta
are correctly typedGroupMember
objects have the correct structure with externalId
, type
, updateSequenceNumber
, and displayName
Rate this page: