e6a415b438
as title
40 lines
977 B
TypeScript
40 lines
977 B
TypeScript
import type { Bundle, ZObject } from 'zapier-platform-core';
|
|
|
|
import requestDb from 'src/utils/requestDb';
|
|
|
|
const testAuthentication = async (z: ZObject, bundle: Bundle) => {
|
|
return await requestDb({
|
|
z,
|
|
bundle,
|
|
query: 'query currentWorkspace {currentWorkspace {id displayName}}',
|
|
endpoint: 'metadata',
|
|
});
|
|
};
|
|
|
|
export default {
|
|
type: 'custom',
|
|
test: testAuthentication,
|
|
fields: [
|
|
{
|
|
computed: false,
|
|
key: 'apiKey',
|
|
required: true,
|
|
label: 'Api Key',
|
|
type: 'string',
|
|
helpText:
|
|
'Create an API key in [your twenty workspace](https://app.twenty.com/settings/apis)',
|
|
},
|
|
{
|
|
computed: false,
|
|
key: 'apiUrl',
|
|
required: false,
|
|
label: 'Self hosted instance url',
|
|
type: 'string',
|
|
placeholder: 'https://crm.custom-url.com',
|
|
helpText: 'Set this only if you self-host Twenty',
|
|
},
|
|
],
|
|
connectionLabel: '{{data.currentWorkspace.displayName}}',
|
|
customConfig: {},
|
|
};
|