feat(pipedrive): add create lead action

This commit is contained in:
Rıdvan Akca
2023-10-05 14:03:05 +03:00
parent 584b9323ec
commit 17916f29f6
7 changed files with 280 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ import listActivityTypes from './list-activity-types';
import listCurrencies from './list-currencies';
import listDeals from './list-deals';
import listLeads from './list-leads';
import listLeadLabels from './list-lead-labels';
import listOrganizations from './list-organizations';
import listPersons from './list-persons';
import listUsers from './list-users';
@@ -11,6 +12,7 @@ export default [
listCurrencies,
listDeals,
listLeads,
listLeadLabels,
listOrganizations,
listPersons,
listUsers,

View File

@@ -0,0 +1,34 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List lead labels',
key: 'listLeadLabels',
async run($: IGlobalVariable) {
const leadLabels: {
data: IJSONObject[];
} = {
data: [],
};
const { data } = await $.http.get(
`${$.auth.data.apiDomain}/api/v1/leadLabels`
);
if (!data?.data) {
return { data: [] };
}
if (data.data.length) {
for (const leadLabel of data.data) {
const name = `${leadLabel.name} (${leadLabel.color})`;
leadLabels.data.push({
value: leadLabel.id,
name,
});
}
}
return leadLabels;
},
};