diff --git a/packages/backend/src/apps/bigin-by-zoho-crm/actions/create-contact/index.js b/packages/backend/src/apps/bigin-by-zoho-crm/actions/create-contact/index.js
new file mode 100644
index 00000000..3d0bb8ab
--- /dev/null
+++ b/packages/backend/src/apps/bigin-by-zoho-crm/actions/create-contact/index.js
@@ -0,0 +1,217 @@
+import defineAction from '../../../../helpers/define-action.js';
+
+export default defineAction({
+ name: 'Create contact',
+ key: 'createContact',
+ description: 'Creates a new contact.',
+ arguments: [
+ {
+ label: 'Contact Owner',
+ key: 'contactOwnerId',
+ type: 'dropdown',
+ required: false,
+ description: '',
+ variables: true,
+ source: {
+ type: 'query',
+ name: 'getDynamicData',
+ arguments: [
+ {
+ name: 'key',
+ value: 'listContactOwners',
+ },
+ ],
+ },
+ },
+ {
+ label: 'First Name',
+ key: 'firstName',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Last Name',
+ key: 'lastName',
+ type: 'string',
+ required: true,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Title',
+ key: 'title',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Email',
+ key: 'email',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Company ID',
+ key: 'companyId',
+ type: 'dropdown',
+ required: false,
+ description: '',
+ variables: true,
+ source: {
+ type: 'query',
+ name: 'getDynamicData',
+ arguments: [
+ {
+ name: 'key',
+ value: 'listCompanies',
+ },
+ ],
+ },
+ },
+ {
+ label: 'Mobile',
+ key: 'mobile',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Email Opt Out',
+ key: 'emailOptOut',
+ type: 'dropdown',
+ required: false,
+ description: '',
+ variables: true,
+ options: [
+ { label: 'True', value: true },
+ { label: 'False', value: false },
+ ],
+ },
+ {
+ label: 'Tags',
+ key: 'tags',
+ type: 'dynamic',
+ required: false,
+ description: '',
+ fields: [
+ {
+ label: 'Tag',
+ key: 'tag',
+ type: 'string',
+ required: false,
+ variables: true,
+ },
+ ],
+ },
+ {
+ label: 'Description',
+ key: 'description',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Mailing Street',
+ key: 'mailingStreet',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Mailing City',
+ key: 'mailingCity',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Mailing State',
+ key: 'mailingState',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Mailing Country',
+ key: 'mailingCountry',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ {
+ label: 'Mailing Zip',
+ key: 'mailingZip',
+ type: 'string',
+ required: false,
+ description: '',
+ variables: true,
+ },
+ ],
+
+ async run($) {
+ const {
+ contactOwnerId,
+ firstName,
+ lastName,
+ title,
+ email,
+ companyId,
+ mobile,
+ emailOptOut,
+ tags,
+ description,
+ mailingStreet,
+ mailingCity,
+ mailingState,
+ mailingCountry,
+ mailingZip,
+ } = $.step.parameters;
+
+ const allTags = tags.map((tag) => ({
+ name: tag.tag,
+ }));
+
+ const body = {
+ data: [
+ {
+ Owner: {
+ id: contactOwnerId,
+ },
+ Account_Name: {
+ id: companyId,
+ },
+ First_Name: firstName,
+ Last_Name: lastName,
+ Title: title,
+ Email: email,
+ Mobile: mobile,
+ Email_Opt_Out: emailOptOut,
+ Tag: allTags,
+ Description: description,
+ Mailing_Street: mailingStreet,
+ Mailing_City: mailingCity,
+ Mailing_State: mailingState,
+ Mailing_Country: mailingCountry,
+ Mailing_Zip: mailingZip,
+ },
+ ],
+ };
+
+ const { data } = await $.http.post(`/bigin/v2/Contacts`, body);
+
+ $.setActionItem({
+ raw: data[0],
+ });
+ },
+});
diff --git a/packages/backend/src/apps/bigin-by-zoho-crm/actions/index.js b/packages/backend/src/apps/bigin-by-zoho-crm/actions/index.js
new file mode 100644
index 00000000..9dbfbd06
--- /dev/null
+++ b/packages/backend/src/apps/bigin-by-zoho-crm/actions/index.js
@@ -0,0 +1,3 @@
+import createContact from './create-contact/index.js';
+
+export default [createContact];
diff --git a/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/index.js b/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/index.js
index de48bc3f..6cf496b4 100644
--- a/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/index.js
+++ b/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/index.js
@@ -1,3 +1,5 @@
+import listCompanies from './list-companies/index.js';
import listOrganizations from './list-organizations/index.js';
+import listContactOwners from './list-contact-owners/index.js';
-export default [listOrganizations];
+export default [listCompanies, listOrganizations, listContactOwners];
diff --git a/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/list-companies/index.js b/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/list-companies/index.js
new file mode 100644
index 00000000..61caa9a5
--- /dev/null
+++ b/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/list-companies/index.js
@@ -0,0 +1,39 @@
+export default {
+ name: 'List companies',
+ key: 'listCompanies',
+
+ async run($) {
+ const companies = {
+ data: [],
+ };
+
+ const params = new URLSearchParams({
+ page: 1,
+ pageSize: 200,
+ fields: 'Account_Name',
+ });
+
+ let next = false;
+ do {
+ const { data } = await $.http.get('/bigin/v2/Accounts', { params });
+
+ if (data.info.more_records) {
+ params.page = params.page + 1;
+ next = true;
+ } else {
+ next = false;
+ }
+
+ if (data.data) {
+ for (const account of data.data) {
+ companies.data.push({
+ value: account.id,
+ name: account.Account_Name,
+ });
+ }
+ }
+ } while (next);
+
+ return companies;
+ },
+};
diff --git a/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/list-contact-owners/index.js b/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/list-contact-owners/index.js
new file mode 100644
index 00000000..50de81ea
--- /dev/null
+++ b/packages/backend/src/apps/bigin-by-zoho-crm/dynamic-data/list-contact-owners/index.js
@@ -0,0 +1,39 @@
+export default {
+ name: 'List contact owners',
+ key: 'listContactOwners',
+
+ async run($) {
+ const contactOwners = {
+ data: [],
+ };
+
+ const params = {
+ type: 'AllUsers',
+ page: 1,
+ pageSize: 200,
+ };
+
+ let next = false;
+ do {
+ const { data } = await $.http.get('/bigin/v2/users', params);
+
+ if (data.users.length === params.pageSize) {
+ next = true;
+ params.page = params.page + 1;
+ } else {
+ next = false;
+ }
+
+ if (data.users) {
+ for (const user of data.users) {
+ contactOwners.data.push({
+ value: user.id,
+ name: user.full_name,
+ });
+ }
+ }
+ } while (next);
+
+ return contactOwners;
+ },
+};
diff --git a/packages/backend/src/apps/bigin-by-zoho-crm/index.js b/packages/backend/src/apps/bigin-by-zoho-crm/index.js
index de1b0c5a..41d80096 100644
--- a/packages/backend/src/apps/bigin-by-zoho-crm/index.js
+++ b/packages/backend/src/apps/bigin-by-zoho-crm/index.js
@@ -4,6 +4,7 @@ import auth from './auth/index.js';
import setBaseUrl from './common/set-base-url.js';
import triggers from './triggers/index.js';
import dynamicData from './dynamic-data/index.js';
+import actions from './actions/index.js';
export default defineApp({
name: 'Bigin By Zoho CRM',
@@ -18,4 +19,5 @@ export default defineApp({
auth,
triggers,
dynamicData,
+ actions,
});
diff --git a/packages/docs/pages/.vitepress/config.js b/packages/docs/pages/.vitepress/config.js
index 8e3ff893..2d8487de 100644
--- a/packages/docs/pages/.vitepress/config.js
+++ b/packages/docs/pages/.vitepress/config.js
@@ -38,6 +38,7 @@ export default defineConfig({
collapsed: true,
items: [
{ text: 'Triggers', link: '/apps/bigin-by-zoho-crm/triggers' },
+ { text: 'Actions', link: '/apps/bigin-by-zoho-crm/actions' },
{ text: 'Connection', link: '/apps/bigin-by-zoho-crm/connection' },
],
},
diff --git a/packages/docs/pages/apps/bigin-by-zoho-crm/actions.md b/packages/docs/pages/apps/bigin-by-zoho-crm/actions.md
new file mode 100644
index 00000000..ae8bf543
--- /dev/null
+++ b/packages/docs/pages/apps/bigin-by-zoho-crm/actions.md
@@ -0,0 +1,12 @@
+---
+favicon: /favicons/bigin-by-zoho-crm.svg
+items:
+ - name: Create contact
+ desc: Creates a new contact.
+---
+
+
+
+