diff --git a/lib/composio/connectors/__tests__/getConnectors.test.ts b/lib/composio/connectors/__tests__/getConnectors.test.ts index 41d54b1d9..08ec6d06d 100644 --- a/lib/composio/connectors/__tests__/getConnectors.test.ts +++ b/lib/composio/connectors/__tests__/getConnectors.test.ts @@ -37,7 +37,7 @@ describe("getConnectors", () => { expect(getComposioClient).toHaveBeenCalled(); expect(mockComposio.create).toHaveBeenCalledWith("account-123", { - toolkits: ["googlesheets", "googledrive", "googledocs", "tiktok"], + toolkits: ["googlesheets", "googledrive", "googledocs", "tiktok", "instagram"], }); expect(result).toEqual([ { diff --git a/lib/composio/connectors/__tests__/isAllowedArtistConnector.test.ts b/lib/composio/connectors/__tests__/isAllowedArtistConnector.test.ts index f0b223b09..02ee1680a 100644 --- a/lib/composio/connectors/__tests__/isAllowedArtistConnector.test.ts +++ b/lib/composio/connectors/__tests__/isAllowedArtistConnector.test.ts @@ -6,10 +6,13 @@ describe("isAllowedArtistConnector", () => { expect(isAllowedArtistConnector("tiktok")).toBe(true); }); + it("should return true for 'instagram'", () => { + expect(isAllowedArtistConnector("instagram")).toBe(true); + }); + it("should return false for connectors not in ALLOWED_ARTIST_CONNECTORS", () => { expect(isAllowedArtistConnector("googlesheets")).toBe(false); expect(isAllowedArtistConnector("googledrive")).toBe(false); - expect(isAllowedArtistConnector("instagram")).toBe(false); expect(isAllowedArtistConnector("random")).toBe(false); }); @@ -24,8 +27,9 @@ describe("isAllowedArtistConnector", () => { }); describe("ALLOWED_ARTIST_CONNECTORS", () => { - it("should include tiktok", () => { + it("should include tiktok and instagram", () => { expect(ALLOWED_ARTIST_CONNECTORS).toContain("tiktok"); + expect(ALLOWED_ARTIST_CONNECTORS).toContain("instagram"); }); it("should be a readonly array", () => { diff --git a/lib/composio/connectors/getConnectors.ts b/lib/composio/connectors/getConnectors.ts index d89f5211e..f32312bf3 100644 --- a/lib/composio/connectors/getConnectors.ts +++ b/lib/composio/connectors/getConnectors.ts @@ -15,7 +15,7 @@ export interface ConnectorInfo { * Passed explicitly to composio.create() because session.toolkits() * only returns the first 20 by default. */ -const SUPPORTED_TOOLKITS = ["googlesheets", "googledrive", "googledocs", "tiktok"]; +const SUPPORTED_TOOLKITS = ["googlesheets", "googledrive", "googledocs", "tiktok", "instagram"]; /** * Options for getting connectors. diff --git a/lib/composio/connectors/isAllowedArtistConnector.ts b/lib/composio/connectors/isAllowedArtistConnector.ts index 60201a474..9acfa63e3 100644 --- a/lib/composio/connectors/isAllowedArtistConnector.ts +++ b/lib/composio/connectors/isAllowedArtistConnector.ts @@ -2,7 +2,7 @@ * List of toolkit slugs that artists are allowed to connect. * Only these connectors will be shown in the artist-connectors API. */ -export const ALLOWED_ARTIST_CONNECTORS = ["tiktok"] as const; +export const ALLOWED_ARTIST_CONNECTORS = ["tiktok", "instagram"] as const; export type AllowedArtistConnector = (typeof ALLOWED_ARTIST_CONNECTORS)[number]; diff --git a/lib/composio/connectors/validateAuthorizeConnectorRequest.ts b/lib/composio/connectors/validateAuthorizeConnectorRequest.ts index fa8e39f43..da9d5de4f 100644 --- a/lib/composio/connectors/validateAuthorizeConnectorRequest.ts +++ b/lib/composio/connectors/validateAuthorizeConnectorRequest.ts @@ -50,6 +50,16 @@ export async function validateAuthorizeConnectorRequest( } const { connector, callback_url, account_id } = validated; + // Build auth configs for custom OAuth + const authConfigs: Record = {}; + if (connector === "tiktok" && process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID) { + authConfigs.tiktok = process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID; + } + if (connector === "instagram" && process.env.COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID) { + authConfigs.instagram = process.env.COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID; + } + const resolvedAuthConfigs = Object.keys(authConfigs).length > 0 ? authConfigs : undefined; + // 3. If account_id is provided, verify access and use that entity if (account_id) { const accessResult = await checkAccountAccess(accountId, account_id); @@ -60,17 +70,11 @@ export async function validateAuthorizeConnectorRequest( ); } - // Build auth configs for custom OAuth - const authConfigs: Record = {}; - if (connector === "tiktok" && process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID) { - authConfigs.tiktok = process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID; - } - return { accountId: account_id, connector, callbackUrl: callback_url, - authConfigs: Object.keys(authConfigs).length > 0 ? authConfigs : undefined, + authConfigs: resolvedAuthConfigs, }; } @@ -79,5 +83,6 @@ export async function validateAuthorizeConnectorRequest( accountId, connector, callbackUrl: callback_url, + authConfigs: resolvedAuthConfigs, }; }