Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
43c34fcb7b | ||
![]() |
c98f24338f | ||
![]() |
d0748bb7e2 | ||
![]() |
81e8e4963c |
@@ -1,3 +1,7 @@
|
|||||||
|
import newCalls from './new-calls/index.js';
|
||||||
|
import newCompanies from './new-companies/index.js';
|
||||||
import newContacts from './new-contacts/index.js';
|
import newContacts from './new-contacts/index.js';
|
||||||
|
import newProducts from './new-products/index.js';
|
||||||
|
import newTasks from './new-tasks/index.js';
|
||||||
|
|
||||||
export default [newContacts];
|
export default [newCalls, newCompanies, newContacts, newProducts, newTasks];
|
||||||
|
@@ -0,0 +1,89 @@
|
|||||||
|
import Crypto from 'crypto';
|
||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New calls',
|
||||||
|
key: 'newCalls',
|
||||||
|
type: 'webhook',
|
||||||
|
description: 'Triggers when a new call is added.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
key: 'organizationId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listOrganizations',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const dataItem = {
|
||||||
|
raw: $.request.body,
|
||||||
|
meta: {
|
||||||
|
internalId: Crypto.randomUUID(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async testRun($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const sampleEventData = {
|
||||||
|
ids: ['111111111111111111'],
|
||||||
|
token: null,
|
||||||
|
module: 'Calls',
|
||||||
|
operation: 'insert',
|
||||||
|
channel_id: organizationId,
|
||||||
|
server_time: 1708426963120,
|
||||||
|
query_params: {},
|
||||||
|
resource_uri: `${$.auth.data.apiDomain}/bigin/v1/Calls`,
|
||||||
|
affected_fields: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataItem = {
|
||||||
|
raw: sampleEventData,
|
||||||
|
meta: {
|
||||||
|
internalId: sampleEventData.channel_id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async registerHook($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
watch: [
|
||||||
|
{
|
||||||
|
channel_id: organizationId,
|
||||||
|
notify_url: $.webhookUrl,
|
||||||
|
events: ['Calls.create'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
await $.http.post('/bigin/v2/actions/watch', payload);
|
||||||
|
|
||||||
|
await $.flow.setRemoteWebhookId(organizationId);
|
||||||
|
},
|
||||||
|
|
||||||
|
async unregisterHook($) {
|
||||||
|
await $.http.delete(
|
||||||
|
`/bigin/v2/actions/watch?channel_ids=${$.flow.remoteWebhookId}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,89 @@
|
|||||||
|
import Crypto from 'crypto';
|
||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New companies',
|
||||||
|
key: 'newCompanies',
|
||||||
|
type: 'webhook',
|
||||||
|
description: 'Triggers when a new company is created.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
key: 'organizationId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listOrganizations',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const dataItem = {
|
||||||
|
raw: $.request.body,
|
||||||
|
meta: {
|
||||||
|
internalId: Crypto.randomUUID(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async testRun($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const sampleEventData = {
|
||||||
|
ids: ['111111111111111111'],
|
||||||
|
token: null,
|
||||||
|
module: 'Accounts',
|
||||||
|
operation: 'insert',
|
||||||
|
channel_id: organizationId,
|
||||||
|
server_time: 1708426963120,
|
||||||
|
query_params: {},
|
||||||
|
resource_uri: `${$.auth.data.apiDomain}/bigin/v1/Accounts`,
|
||||||
|
affected_fields: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataItem = {
|
||||||
|
raw: sampleEventData,
|
||||||
|
meta: {
|
||||||
|
internalId: sampleEventData.channel_id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async registerHook($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
watch: [
|
||||||
|
{
|
||||||
|
channel_id: organizationId,
|
||||||
|
notify_url: $.webhookUrl,
|
||||||
|
events: ['Accounts.create'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
await $.http.post('/bigin/v2/actions/watch', payload);
|
||||||
|
|
||||||
|
await $.flow.setRemoteWebhookId(organizationId);
|
||||||
|
},
|
||||||
|
|
||||||
|
async unregisterHook($) {
|
||||||
|
await $.http.delete(
|
||||||
|
`/bigin/v2/actions/watch?channel_ids=${$.flow.remoteWebhookId}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,89 @@
|
|||||||
|
import Crypto from 'crypto';
|
||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New products',
|
||||||
|
key: 'newProducts',
|
||||||
|
type: 'webhook',
|
||||||
|
description: 'Triggers when a new product is created.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
key: 'organizationId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listOrganizations',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const dataItem = {
|
||||||
|
raw: $.request.body,
|
||||||
|
meta: {
|
||||||
|
internalId: Crypto.randomUUID(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async testRun($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const sampleEventData = {
|
||||||
|
ids: ['111111111111111111'],
|
||||||
|
token: null,
|
||||||
|
module: 'Products',
|
||||||
|
operation: 'insert',
|
||||||
|
channel_id: organizationId,
|
||||||
|
server_time: 1708426963120,
|
||||||
|
query_params: {},
|
||||||
|
resource_uri: `${$.auth.data.apiDomain}/bigin/v1/Products`,
|
||||||
|
affected_fields: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataItem = {
|
||||||
|
raw: sampleEventData,
|
||||||
|
meta: {
|
||||||
|
internalId: sampleEventData.channel_id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async registerHook($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
watch: [
|
||||||
|
{
|
||||||
|
channel_id: organizationId,
|
||||||
|
notify_url: $.webhookUrl,
|
||||||
|
events: ['Products.create'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
await $.http.post('/bigin/v2/actions/watch', payload);
|
||||||
|
|
||||||
|
await $.flow.setRemoteWebhookId(organizationId);
|
||||||
|
},
|
||||||
|
|
||||||
|
async unregisterHook($) {
|
||||||
|
await $.http.delete(
|
||||||
|
`/bigin/v2/actions/watch?channel_ids=${$.flow.remoteWebhookId}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,89 @@
|
|||||||
|
import Crypto from 'crypto';
|
||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New tasks',
|
||||||
|
key: 'newTasks',
|
||||||
|
type: 'webhook',
|
||||||
|
description: 'Triggers when a new task is created.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
key: 'organizationId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listOrganizations',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const dataItem = {
|
||||||
|
raw: $.request.body,
|
||||||
|
meta: {
|
||||||
|
internalId: Crypto.randomUUID(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async testRun($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const sampleEventData = {
|
||||||
|
ids: ['111111111111111111'],
|
||||||
|
token: null,
|
||||||
|
module: 'Tasks',
|
||||||
|
operation: 'insert',
|
||||||
|
channel_id: organizationId,
|
||||||
|
server_time: 1708426963120,
|
||||||
|
query_params: {},
|
||||||
|
resource_uri: `${$.auth.data.apiDomain}/bigin/v1/Tasks`,
|
||||||
|
affected_fields: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataItem = {
|
||||||
|
raw: sampleEventData,
|
||||||
|
meta: {
|
||||||
|
internalId: sampleEventData.channel_id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.pushTriggerItem(dataItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
async registerHook($) {
|
||||||
|
const organizationId = $.step.parameters.organizationId;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
watch: [
|
||||||
|
{
|
||||||
|
channel_id: organizationId,
|
||||||
|
notify_url: $.webhookUrl,
|
||||||
|
events: ['Tasks.create'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
await $.http.post('/bigin/v2/actions/watch', payload);
|
||||||
|
|
||||||
|
await $.flow.setRemoteWebhookId(organizationId);
|
||||||
|
},
|
||||||
|
|
||||||
|
async unregisterHook($) {
|
||||||
|
await $.http.delete(
|
||||||
|
`/bigin/v2/actions/watch?channel_ids=${$.flow.remoteWebhookId}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
@@ -1,8 +1,16 @@
|
|||||||
---
|
---
|
||||||
favicon: /favicons/bigin-by-zoho-crm.svg
|
favicon: /favicons/bigin-by-zoho-crm.svg
|
||||||
items:
|
items:
|
||||||
|
- name: New calls
|
||||||
|
desc: Triggers when a new call is added.
|
||||||
|
- name: New companies
|
||||||
|
desc: Triggers when a new company is created.
|
||||||
- name: New contacts
|
- name: New contacts
|
||||||
desc: Triggers when a new contact is created.
|
desc: Triggers when a new contact is created.
|
||||||
|
- name: New products
|
||||||
|
desc: Triggers when a new product is created.
|
||||||
|
- name: New tasks
|
||||||
|
desc: Triggers when a new task is created.
|
||||||
---
|
---
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
Reference in New Issue
Block a user