feat(pipedrive): add pipedrive integration

This commit is contained in:
Rıdvan Akca
2023-09-21 16:25:36 +03:00
committed by Faruk AYDIN
parent 6a66b65f2a
commit f53909355f
10 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { IField, IGlobalVariable } from '@automatisch/types';
import { URLSearchParams } from 'url';
export default async function generateAuthUrl($: IGlobalVariable) {
const oauthRedirectUrlField = $.app.auth.fields.find(
(field: IField) => field.key == 'oAuthRedirectUrl'
);
const redirectUri = oauthRedirectUrlField.value as string;
const searchParams = new URLSearchParams({
client_id: $.auth.data.clientId as string,
redirect_uri: redirectUri,
});
const url = `https://oauth.pipedrive.com/oauth/authorize?${searchParams.toString()}`;
await $.auth.set({
url,
});
}