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 setObjects
method allows you to ingest multiple objects into the Teamwork Graph in a single API call.
1 2setObjects(request: SetObjectsRequest): Promise<BulkObjectResponse>
SetObjectsRequest
1 2// SetObjectsRequest object: { objects: Object[]; // objects: Array of objects to ingest (maximum 100 objects per request) properties?: Record<string, string>; // Max 5 properties to tag the entities with }
We only support up to 5 key-value pairs in properties object.
1 2import { types } from '@forge/teamwork-graph'; const document: types.DocumentObject = { schemaVersion: '1.0', id: 'doc-123', updateSequenceNumber: 123, displayName: 'API Documentation', url: 'https://example.com/doc' createdAt: '2024-01-15T10:00:00Z', lastUpdatedAt: '2024-01-20T14:30:00Z', permissions: [{ accessControls: [{ principals: [{ type: 'ATLASSIAN_WORKSPACE' }] }] }], 'atlassian:document': { type: { category: 'document' }, content: { mimeType: 'text/plain', text: 'Document content...' } } };
1 2import { types } from '@forge/teamwork-graph'; const message: types.MessageObject = { schemaVersion: '2.0', id: 'msg-456', updateSequenceNumber: 456, description: 'Team update message', url: 'https://slack.com/msg/123' createdAt: '2024-01-20T15:00:00Z', lastUpdatedAt: '2024-01-20T15:00:00Z', containerKey: { type: 'atlassian:conversation', value: { entityId: 'conv-123' } }, permissions: [{ accessControls: [{ principals: [{ type: 'ATLASSIAN_WORKSPACE' }] }] }], 'atlassian:message': { hidden: false, isPinned: false } };
1 2import { graph } from '@forge/teamwork-graph'; import { types } from '@forge/teamwork-graph'; const document: types.DocumentObject = { // ...common and required properties 'atlassian:document': { type: { category: 'document' }, content: { mimeType: 'text/plain', text: 'Project documentation...' } } }; const request = { objects: [document], properties: { "pull-id": "12334", "timestamp": "12344" } }; const response = await graph.setObjects(request);
1 2const objects = [ // Document object { schemaVersion: '1.0', id: 'api-doc', displayName: 'API Documentation', // ... other required fields 'atlassian:document': { type: { category: 'document' }, content: { mimeType: 'text/plain', text: 'Complete API reference...' } } }, // Message object { schemaVersion: '1.0', id: 'team-update', description: 'New feature released!', // ... other required fields 'atlassian:message': { hidden: false, isPinned: false } } ]; const response = await graph.setObjects({ objects });
The method validates the following:
objects
field must be a valid array.objects
array cannot be empty.Error message | Description |
---|---|
objects must be an array | The objects field is not an array. |
objects array cannot be empty | The objects array is empty. |
Bulk ingestion supports maximum 100 objects. Received X | The number of objects per request has exceeded the maximum limit. |
The method returns a promise that resolves to a BulkObjectResponse
object containing the
ingestion results.
1 2type AcceptedObject = { entityType: string; entityId: ObjectId; thirdPartyAri: string; }; type RejectedObjectKey = { entityType: string; entityId: ObjectId; }; type ValidationError = { message: string; key: string; }; type RejectedObject = { key: RejectedObjectKey; errors: ValidationError[]; }; type ValidObject = { entityType: string; entityId: ObjectId; thirdPartyAri: string; }; type BulkObjectResponse = { success: boolean; results?: { accepted?: AcceptedObject[]; rejected?: RejectedObject[]; validObjects?: ValidObject[]; }; error?: string; originalError?: unknown; };
The SDK provides type-safe request and response objects that ensure compile-time validation:
1 2import { types } from '@forge/teamwork-graph'; // Type-safe object creation - TypeScript enforces exactly one object type per object const document: types.DocumentObject = { schemaVersion: '1.0', id: 'doc-123', updateSequenceNumber: 123, displayName: 'API Documentation', url: 'https://example.com/doc', 'atlassian:document': { type: { category: 'document' }, content: { mimeType: 'text/plain', text: 'Document content...' } } // TypeScript error if you try to add 'atlassian:message' here }; // Type-safe request creation const request: types.SetObjectsRequest = { objects: [document], properties: { environment: 'production' } }; // Type-safe response handling const response = await graph.setObjects(request); if (response.success && response.results) { // TypeScript knows results exists here and provides proper typing if (response.results.accepted) { response.results.accepted.forEach(result => { console.log(`Successfully ingested: ${result.entityType}`); }); } if (response.results.rejected) { response.results.rejected.forEach(result => { console.error(`Failed to ingest: ${result.key.entityType}`); }); } }
The type system ensures:
atlassian:document
)request.objects
must be an array of valid Object
union typesresponse.results
has properly typed accepted
, rejected
, and validObjects
arraysRate this page: