AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(pieces): see which Canva, SurveyMonkey, Typeform or Facebook account each connection belongs to (#16551)
Kishan Parmaraac8e039dda6
diff --git a/bun.lock b/bun.lockindex eb94f48cbf2..5dc60e1b142 100644--- a/bun.lock+++ b/bun.lock@@ -1549,7 +1549,7 @@},"packages/pieces/community/canva": {"name": "@activepieces/piece-canva",- "version": "0.1.2",+ "version": "0.2.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",@@ -3062,7 +3062,7 @@},"packages/pieces/community/facebook-leads": {"name": "@activepieces/piece-facebook-leads",- "version": "0.4.0",+ "version": "0.4.1","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",@@ -3075,7 +3075,7 @@},"packages/pieces/community/facebook-pages": {"name": "@activepieces/piece-facebook-pages",- "version": "0.4.1",+ "version": "0.4.2","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",@@ -8910,7 +8910,7 @@},"packages/pieces/community/surveymonkey": {"name": "@activepieces/piece-surveymonkey",- "version": "0.2.0",+ "version": "0.3.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",@@ -9444,7 +9444,7 @@},"packages/pieces/community/typeform": {"name": "@activepieces/piece-typeform",- "version": "0.6.1",+ "version": "0.6.2","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",diff --git a/packages/pieces/community/canva/package.json b/packages/pieces/community/canva/package.jsonindex 0539c83e766..5d93a8eeb7a 100644--- a/packages/pieces/community/canva/package.json+++ b/packages/pieces/community/canva/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-canva",- "version": "0.1.2",+ "version": "0.2.0","type": "commonjs","main": "./dist/src/index.js","types": "./dist/src/index.d.ts",diff --git a/packages/pieces/community/canva/src/index.ts b/packages/pieces/community/canva/src/index.tsindex 3c1ec2e815f..62221587aaa 100644--- a/packages/pieces/community/canva/src/index.ts+++ b/packages/pieces/community/canva/src/index.ts@@ -21,7 +21,7 @@ To connect Canva, follow these steps:1. Go to https://www.canva.com/developers/integrations and sign in.2. Click **Create an integration** and fill in the app name and description.3. Under **Configure** → **Authentication**, set the redirect URL to the one shown above.-4. Under **Configure** → **Scopes**, enable: \`design:content:read\`, \`design:content:write\`, \`design:meta:read\`, \`asset:read\`, \`asset:write\`, \`folder:read\`, \`folder:write\`.+4. Under **Configure** → **Scopes**, enable: \`design:content:read\`, \`design:content:write\`, \`design:meta:read\`, \`asset:read\`, \`asset:write\`, \`folder:read\`, \`folder:write\`, \`profile:read\`.5. Copy the **Client ID** and **Client secret** and paste them above.`;@@ -40,7 +40,21 @@ export const canvaAuth = PieceAuth.OAuth2({'asset:write','folder:read','folder:write',+ 'profile:read',],+ getConnectionIdentifier: async ({ auth }) => {+ try {+ const response = await httpClient.sendRequest<{ profile?: { display_name?: string } }>({+ method: HttpMethod.GET,+ url: `${canvaCommon.baseUrl}/users/me/profile`,+ headers: { Authorization: `Bearer ${auth.access_token}` },+ timeout: 5000,+ });+ return response.body.profile?.display_name || undefined;+ } catch {+ return undefined;+ }+ },validate: async ({ auth }) => {try {const authValue = auth as OAuth2PropertyValue;diff --git a/packages/pieces/community/facebook-leads/package.json b/packages/pieces/community/facebook-leads/package.jsonindex 558f5a8f1b9..112ca2a763e 100644--- a/packages/pieces/community/facebook-leads/package.json+++ b/packages/pieces/community/facebook-leads/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-facebook-leads",- "version": "0.4.0",+ "version": "0.4.1","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/facebook-leads/src/lib/auth.ts b/packages/pieces/community/facebook-leads/src/lib/auth.tsindex 8cc282f6161..f2885d35fb5 100644--- a/packages/pieces/community/facebook-leads/src/lib/auth.ts+++ b/packages/pieces/community/facebook-leads/src/lib/auth.ts@@ -1,5 +1,7 @@import { PieceAuth } from '@activepieces/pieces-framework';+import { facebookLeadsApi } from './common/api';+export const facebookLeadsAuth = PieceAuth.OAuth2({description: '',authUrl: 'https://graph.facebook.com/oauth/authorize',@@ -12,4 +14,12 @@ export const facebookLeadsAuth = PieceAuth.OAuth2({'pages_manage_metadata','business_management',],+ getConnectionIdentifier: async ({ auth }) => {+ try {+ const me = await facebookLeadsApi.getMe({ accessToken: auth.access_token, timeout: 5000 });+ return me.name || undefined;+ } catch {+ return undefined;+ }+ },});diff --git a/packages/pieces/community/facebook-leads/src/lib/common/api.ts b/packages/pieces/community/facebook-leads/src/lib/common/api.tsindex 0549a2eb44e..50049632f00 100644--- a/packages/pieces/community/facebook-leads/src/lib/common/api.ts+++ b/packages/pieces/community/facebook-leads/src/lib/common/api.ts@@ -11,11 +11,12 @@ import type {FacebookLeadsUser,} from './types';-async function getMe({ accessToken }: { accessToken: string }): Promise<FacebookLeadsUser> {+async function getMe({ accessToken, timeout }: { accessToken: string; timeout?: number }): Promise<FacebookLeadsUser> {return await facebookLeadsClient.request<FacebookLeadsUser>({method: HttpMethod.GET,path: '/me',query: { access_token: accessToken, fields: 'id,name' },+ timeout,});}diff --git a/packages/pieces/community/facebook-leads/src/lib/common/client.ts b/packages/pieces/community/facebook-leads/src/lib/common/client.tsindex 77cdd94be52..96f19399c0e 100644--- a/packages/pieces/community/facebook-leads/src/lib/common/client.ts+++ b/packages/pieces/community/facebook-leads/src/lib/common/client.ts@@ -6,12 +6,13 @@ function baseUrl(): string {return BASE_URL;}-async function request<T>({ method, path, query, body }: RequestParams): Promise<T> {+async function request<T>({ method, path, query, body, timeout }: RequestParams): Promise<T> {const response = await httpClient.sendRequest<T>({method,url: `${BASE_URL}${path}`,queryParams: query,body,+ timeout,});return response.body;}@@ -42,6 +43,7 @@ type RequestParams = {path: string;query?: QueryParams;body?: unknown;+ timeout?: number;};type PaginateParams = {diff --git a/packages/pieces/community/facebook-pages/package.json b/packages/pieces/community/facebook-pages/package.jsonindex 2f1d1a5fa2d..ce5d860caeb 100644--- a/packages/pieces/community/facebook-pages/package.json+++ b/packages/pieces/community/facebook-pages/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-facebook-pages",- "version": "0.4.1",+ "version": "0.4.2","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/facebook-pages/src/lib/auth.ts b/packages/pieces/community/facebook-pages/src/lib/auth.tsindex 70ecf98d177..854e4acdee1 100644--- a/packages/pieces/community/facebook-pages/src/lib/auth.ts+++ b/packages/pieces/community/facebook-pages/src/lib/auth.ts@@ -1,3 +1,4 @@+import { httpClient, HttpMethod } from '@activepieces/pieces-common';import { PieceAuth } from '@activepieces/pieces-framework';const markdown = `@@ -26,4 +27,18 @@ export const facebookPagesAuth = PieceAuth.OAuth2({'business_management','pages_read_engagement',],+ getConnectionIdentifier: async ({ auth }) => {+ try {+ const response = await httpClient.sendRequest<{ name?: string }>({+ method: HttpMethod.GET,+ url: 'https://graph.facebook.com/v23.0/me',+ queryParams: { fields: 'name' },+ headers: { Authorization: `Bearer ${auth.access_token}` },+ timeout: 5000,+ });+ return response.body.name || undefined;+ } catch {+ return undefined;+ }+ },});diff --git a/packages/pieces/community/surveymonkey/package.json b/packages/pieces/community/surveymonkey/package.jsonindex 3c929c277ed..58d71d58e87 100644--- a/packages/pieces/community/surveymonkey/package.json+++ b/packages/pieces/community/surveymonkey/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-surveymonkey",- "version": "0.2.0",+ "version": "0.3.0","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/surveymonkey/src/index.ts b/packages/pieces/community/surveymonkey/src/index.tsindex 731fa3d5209..5e27bd136ba 100644--- a/packages/pieces/community/surveymonkey/src/index.ts+++ b/packages/pieces/community/surveymonkey/src/index.ts@@ -4,21 +4,48 @@ import {PieceAuth,} from '@activepieces/pieces-framework';-import { createCustomApiCallAction } from '@activepieces/pieces-common';+import { createCustomApiCallAction, httpClient, HttpMethod } from '@activepieces/pieces-common';import { PieceCategory } from '@activepieces/pieces-framework';import { newResponse } from './lib/triggers/new-response';+const smAuthDescription = `+To connect SurveyMonkey, create your own app:+1. Go to https://developer.surveymonkey.com/apps/ and click **Add a New App**.+2. On the app's **Settings** tab, set the **OAuth Redirect URL** to the redirect URL shown above.+3. Under **Scopes**, set these to **Required** and click **Update Scopes**: View Surveys, View Responses, View Response Details, View Webhooks, Create/Modify Webhooks, View Users.+4. Copy the **Client ID** and **Secret** from the **Credentials** section and paste them above.++A new app starts as a draft that only your own SurveyMonkey account can connect, for 90 days. To keep using it, deploy it as **Private** (needs a paid plan) or **Public** (needs SurveyMonkey review).+`;+export const smAuth = PieceAuth.OAuth2({+ description: smAuthDescription,authUrl: 'https://api.surveymonkey.com/oauth/authorize',tokenUrl: 'https://api.surveymonkey.com/oauth/token',required: true,+ prompt: 'omit',+ extra: { access_type: '' },scope: ['responses_read','responses_read_detail','webhooks_read','webhooks_write','surveys_read',+ 'users_read',],+ getConnectionIdentifier: async ({ auth }) => {+ try {+ const response = await httpClient.sendRequest<{ email?: string; username?: string }>({+ method: HttpMethod.GET,+ url: 'https://api.surveymonkey.com/v3/users/me',+ headers: { Authorization: `Bearer ${auth.access_token}` },+ timeout: 5000,+ });+ return response.body.email || response.body.username || undefined;+ } catch {+ return undefined;+ }+ },});export const surveymonkey = createPiece({diff --git a/packages/pieces/community/typeform/package.json b/packages/pieces/community/typeform/package.jsonindex ca10508e59d..d938bd1c1c1 100644--- a/packages/pieces/community/typeform/package.json+++ b/packages/pieces/community/typeform/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-typeform",- "version": "0.6.1",+ "version": "0.6.2","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/typeform/src/lib/auth.ts b/packages/pieces/community/typeform/src/lib/auth.tsindex c6c6d2669c3..a6806d948db 100644--- a/packages/pieces/community/typeform/src/lib/auth.ts+++ b/packages/pieces/community/typeform/src/lib/auth.ts@@ -1,3 +1,4 @@+import { httpClient, HttpMethod } from '@activepieces/pieces-common';import { PieceAuth } from '@activepieces/pieces-framework';export const typeformAuth = PieceAuth.OAuth2({@@ -19,4 +20,17 @@ export const typeformAuth = PieceAuth.OAuth2({'images:write','offline',],+ getConnectionIdentifier: async ({ auth }) => {+ try {+ const response = await httpClient.sendRequest<{ email?: string; alias?: string }>({+ method: HttpMethod.GET,+ url: 'https://api.typeform.com/me',+ headers: { Authorization: `Bearer ${auth.access_token}` },+ timeout: 5000,+ });+ return response.body.email || response.body.alias || undefined;+ } catch {+ return undefined;+ }+ },});