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
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { PieceAuth } from '@activepieces/pieces-framework';
const markdown = `
To Obtain a Client ID and Client Secret:
1. Go to https://developers.facebook.com/
2. Register for a Facebook Developer account.
3. Once login, click "Make a new app" button.
4. Select "Other" for use cases.
5. Choose "Business" as the type of app.
6. Provide application details: custom name and associated email.
7. Once your application is created, you need to add a new "product".
8. Configure a new product of type "Facebook Login Settings".
9. Default settings should be fine, you only need to provide the Redirect URL in "Valid OAuth Redirect URIs" and your domain name in "Allowed Domains for the JavaScript SDK".
10. Finally, get your application ID and application secret from your app dashboard in Settings > Basic.
`;
export const facebookPagesAuth = PieceAuth.OAuth2({
description: markdown,
authUrl: 'https://graph.facebook.com/oauth/authorize',
tokenUrl: 'https://graph.facebook.com/oauth/access_token',
required: true,
scope: [
'pages_show_list',
'pages_manage_posts',
'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;
}
},
});