2049 timebox 1j zapier integration 4 define and implement a first trigger for zapier app (#2132)
* Add create company trigger * Refactor * Add operation in subscribe * Add create hook api endpoint * Add import of hook module * Add a test for hook subscribe * Add delete hook api endpoint * Add delete hook test * Add findMany hook route --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,26 +1,16 @@
|
||||
import { Bundle, ZObject } from 'zapier-platform-core';
|
||||
import handleQueryParams from '../utils/handleQueryParams';
|
||||
import requestDb from '../utils/requestDb';
|
||||
|
||||
const perform = async (z: ZObject, bundle: Bundle) => {
|
||||
const response = await z.request({
|
||||
body: {
|
||||
query: `
|
||||
mutation CreateCompany {
|
||||
createOneCompany(
|
||||
data:{${handleQueryParams(bundle.inputData)}}
|
||||
)
|
||||
{id}
|
||||
}`,
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${bundle.authData.apiKey}`,
|
||||
},
|
||||
method: 'POST',
|
||||
url: `${process.env.SERVER_BASE_URL}/graphql`,
|
||||
});
|
||||
return response.json;
|
||||
const query = `
|
||||
mutation CreateCompany {
|
||||
createOneCompany(
|
||||
data:{${handleQueryParams(bundle.inputData)}}
|
||||
)
|
||||
{id}
|
||||
}`;
|
||||
return await requestDb(z, bundle, query);
|
||||
};
|
||||
export default {
|
||||
display: {
|
||||
|
||||
@ -1,26 +1,16 @@
|
||||
import { Bundle, ZObject } from 'zapier-platform-core';
|
||||
import handleQueryParams from '../utils/handleQueryParams';
|
||||
import requestDb from '../utils/requestDb';
|
||||
|
||||
const perform = async (z: ZObject, bundle: Bundle) => {
|
||||
const response = await z.request({
|
||||
body: {
|
||||
query: `
|
||||
mutation CreatePerson {
|
||||
createOnePerson(
|
||||
data:{${handleQueryParams(bundle.inputData)}}
|
||||
)
|
||||
{id}
|
||||
}`,
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${bundle.authData.apiKey}`,
|
||||
},
|
||||
method: 'POST',
|
||||
url: `${process.env.SERVER_BASE_URL}/graphql`,
|
||||
});
|
||||
return response.json;
|
||||
const query = `
|
||||
mutation CreatePerson {
|
||||
createOnePerson(
|
||||
data:{${handleQueryParams(bundle.inputData)}}
|
||||
)
|
||||
{id}
|
||||
}`;
|
||||
return await requestDb(z, bundle, query);
|
||||
};
|
||||
export default {
|
||||
display: {
|
||||
|
||||
Reference in New Issue
Block a user