index.ts•1.29 kB
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import {
OAuth2PropertyValue,
PieceAuth,
createPiece,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { newResponse } from './lib/triggers/new-form-response';
export const googleFormsAuth = PieceAuth.OAuth2({
authUrl: 'https://accounts.google.com/o/oauth2/auth',
tokenUrl: 'https://oauth2.googleapis.com/token',
required: true,
scope: [
'https://www.googleapis.com/auth/forms.responses.readonly',
'https://www.googleapis.com/auth/drive.readonly',
],
});
export const googleForms = createPiece({
displayName: 'Google Forms',
description: 'Receive form responses from Google Forms',
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/google-forms.png',
categories: [PieceCategory.FORMS_AND_SURVEYS],
authors: ["kishanprmr","MoShizzle","khaledmashaly","abuaboud","Startouf"],
auth: googleFormsAuth,
actions: [
createCustomApiCallAction({
baseUrl: () => 'https://forms.googleapis.com/v1',
auth: googleFormsAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
],
triggers: [newResponse],
});