Skip to content

Commit

Permalink
Upgrade to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanlee16 committed May 2, 2024
1 parent 77a6f30 commit bb1106e
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .para/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projectId": "8c41b36e-5e69-4ea8-8f9d-e96118d9c93a",
"projectId": "7011260a-9672-46a9-a527-845371266b3f",
"projectName": "main",
"profile": "default"
}
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"build": "para build"
},
"dependencies": {
"@useparagon/core": "0.0.1-canary.43",
"@useparagon/core": "^1.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@sendgrid/mail": "^7.6.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/analytics-node": "^3.1.14",
"@types/archiver": "^5.3.2",
"@types/bluebird": "^3.5.42",
Expand All @@ -31,7 +32,6 @@
"@types/oauth": "^0.9.4",
"@types/pg": "^8.10.9",
"@types/postlight__mercury-parser": "^2.2.7",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/ramda": "^0.29.9",
"@types/snowflake-sdk": "^1.6.20",
"@types/ssh2-sftp-client": "^5.2.2",
Expand All @@ -50,9 +50,9 @@
"moment": "^2.24.0",
"mysql2": "^2.1.0",
"neo4j-driver": "^5.5.0",
"promise-parallel-throttle": "^3.3.0",
"prettier": "^3.1.0",
"prettier-plugin-organize-imports": "^3.2.3",
"promise-parallel-throttle": "^3.3.0",
"redis": "^4.6.7",
"sendpulse-api": "^1.1.4",
"slack": "^11.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/events/newTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IEventInit } from '@useparagon/core/event';

export type EventSchema = {
title: 'Example Title';
description: "Example Description";
description: 'Example Description';
};

const event: IEventInit<EventSchema> = {
Expand All @@ -16,7 +16,7 @@ const event: IEventInit<EventSchema> = {
*/
schema: {
title: 'Example Title',
description: "Example Description"
description: 'Example Description',
},
};

Expand Down
9 changes: 7 additions & 2 deletions src/integrations/googledrive/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import { IIntegrationConfig } from '@useparagon/core/integration';
*/
const config: IIntegrationConfig = {
description: 'Save files to Google Drive',
overviewText:
'Connect your Google account and sync files from your Google Drive.\n\nOur Google Drive integration enables you to:\n\n• Save files to your Google Drive\n• Sync files from your Google Drive',
overviewText: `Connect your Google account and sync files from your Google Drive.
Our Google Drive integration enables you to:
• Save files to your Google Drive
• Sync files from your Google Drive`,
showWatermark: true,
workflowDisplayOrder: [],
};

export default config;
12 changes: 10 additions & 2 deletions src/integrations/hubspot/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ import { IIntegrationConfig } from '@useparagon/core/integration';
*/
const config: IIntegrationConfig = {
description: 'Sync records from HubSpot',
overviewText:
'Connect your HubSpot account to sync records from your HubSpot CRM. Enable your sales team to close more deals by keeping your HubSpot CRM records up to date - without manual data entry. \n \n\nOur HubSpot integration enables you to: \n \n\n• Automatically create or update records like contacts or deals in HubSpot \n• Sync records from HubSpot \n• Receive updates when new records are created in HubSpot',
overviewText: `Connect your HubSpot account to sync records from your HubSpot CRM. Enable your sales team to close more deals by keeping your HubSpot CRM records up to date - without manual data entry.
Our HubSpot integration enables you to:
• Automatically create or update records like contacts or deals in HubSpot
• Sync records from HubSpot
• Receive updates when new records are created in HubSpot`,
showWatermark: true,
workflowDisplayOrder: [],
};

export default config;
14 changes: 12 additions & 2 deletions src/integrations/salesforce/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { IIntegrationConfig } from '@useparagon/core/integration';

import { default as SyncContactsFromSalesforce } from './workflows/syncContactsFromSalesforce';

/**
* configuration for a salesforce
*/
const config: IIntegrationConfig = {
description: 'Sync records from Salesforce',
overviewText:
'Connect your Salesforce account and sync your Salesforce accounts, contacts, leads, or opportunities. Enable your sales team to close more deals by keeping your Salesforce CRM records up to date - without manual data entry. \n \nOur Salesforce integration enables you to: \n \n• Automatically create or update records in Salesforce \n• Sync records from Salesforce \n• Receive updates when a record in Salesforce is created or updated',
overviewText: `Connect your Salesforce account and sync your Salesforce accounts, contacts, leads, or opportunities. Enable your sales team to close more deals by keeping your Salesforce CRM records up to date - without manual data entry.
Our Salesforce integration enables you to:
• Automatically create or update records in Salesforce
• Sync records from Salesforce
• Receive updates when a record in Salesforce is created or updated`,
showWatermark: true,
workflowDisplayOrder: [
SyncContactsFromSalesforce,
],
};

export default config;
23 changes: 22 additions & 1 deletion src/integrations/salesforce/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@ import { createInputs } from '@useparagon/integrations/salesforce';
/**
* define inputs here which can be used across workflows
*/
const integrationInputs = createInputs({});
const integrationInputs = createInputs({
field_mapping: {
id: '8eddc0e2-2b01-4334-9b73-e972b71cf7ca',
title: 'Field Mapping',
tooltip: 'tooltip',
required: true,
type: 'field_mapping',
useDynamicMapper: false,
fieldMappings: [
{
label: 'ASDF',
value: 'a',
},
{
label: 'b',
},
{
label: 'c',
},
],
},
});

export default integrationInputs;
89 changes: 57 additions & 32 deletions src/integrations/salesforce/workflows/syncContactsFromSalesforce.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { ConditionalStep, RequestStep, Workflow } from '@useparagon/core';
import {
ConditionalStep,
IntegrationRequestStep,
RequestStep,
Workflow,
} from '@useparagon/core';
import { IContext } from '@useparagon/core/execution';
import * as Operators from '@useparagon/core/operator';
import { IPersona } from '@useparagon/core/persona';
Expand All @@ -11,6 +16,7 @@ import {
} from '@useparagon/integrations/salesforce';

import personaMeta from '../../../persona.meta';
import sharedInputs from '../inputs';

/**
* Sync contacts from Salesforce Workflow implementation
Expand All @@ -31,79 +37,98 @@ export default class extends Workflow<
const triggerStep = integration.triggers.recordCreated({
recordType: 'Contact',
recordsFilterFormula: undefined,
objectMapping: `${context.getInput(sharedInputs.field_mapping).record_type}`,
});

const searchByEmailStep = new RequestStep({
const requestStep = new RequestStep({
autoRetry: false,
continueWorkflowOnError: false,
description: 'Search By Email',
url: `https://api.myapp.io/api/contacts?email=${triggerStep.output.contact.email}`,
method: 'GET',
params: {},
headers: {},
description: 'Search By Email',
autoRetry: false,
continueWorkflowOnError: false,
});

const contactExistsCondition = new ConditionalStep({
if: Operators.ArrayIsNotEmpty(
searchByEmailStep.output.response.body.data,
),
const ifelseStep = new ConditionalStep({
if: Operators.ArrayIsNotEmpty(requestStep.output.response.body.data),
description: 'Check If Exists',
});

const createContactStep = new RequestStep({
description: 'Create Contact',
const updateContactStep = new RequestStep({
autoRetry: false,
continueWorkflowOnError: false,
description: 'Update Contact',
url: `https://api.myapp.io/api/contacts`,
method: 'POST',
method: 'PATCH',
params: {},
headers: {},
authorization: {
type: 'bearer',
token: `${context.getEnvironmentSecret('API_SECRET')}`,
},
body: { user_id: connectUser.userId, contact: triggerStep.output.result },
body: {
user_id: connectUser.userId,
contact: `${triggerStep.output.result}`,
contact_id: `${requestStep.output.response.body['0'].id}`,
},
bodyType: 'json',
autoRetry: false,
continueWorkflowOnError: false,
});

const updateContactStep = new RequestStep({
description: 'Update Contact',
const createContactStep = new RequestStep({
autoRetry: false,
continueWorkflowOnError: false,
description: 'Create Contact',
url: `https://api.myapp.io/api/contacts`,
method: 'PATCH',
method: 'POST',
params: {},
headers: {},
authorization: {
type: 'bearer',
token: `${context.getEnvironmentSecret('API_SECRET')}`,
},
body: {
user_id: connectUser.userId,
contact: `${triggerStep.output.result}`,
contact_id: `${searchByEmailStep.output.response.body[0].id}`,
},
body: { user_id: connectUser.userId, contact: triggerStep.output.result },
bodyType: 'json',
autoRetry: false,
});

const integrationRequestStep = new IntegrationRequestStep({
autoRetry: true,
continueWorkflowOnError: false,
description: 'Search Deals in Stages',
method: 'POST',
url: (pageToken: string) =>
`/crm/v3/objects/deals/search?q=testquery is ${pageToken}`,
params: { q: (pageToken: string) => `testquery is ${pageToken}` },
headers: { 'Content-Type': 'application/json' },
body: { limit: '2', after: (pageToken: string) => `${pageToken}` },
bodyType: 'json',
pagination: (currentStep) => ({
pageToken: `${currentStep.output.response.body.paging.next.after}`,
outputPath: `${currentStep.output.response.body.results}`,
stopCondition: Operators.DoesNotExist(
`${currentStep.output.response.body.paging.next.after}`,
),
}),
});

triggerStep
.nextStep(searchByEmailStep)
.nextStep(requestStep)
.nextStep(
contactExistsCondition
.whenTrue(updateContactStep)
.whenFalse(createContactStep),
);
ifelseStep.whenTrue(updateContactStep).whenFalse(createContactStep),
)
.nextStep(integrationRequestStep);

/**
* Pass all steps used in the workflow to the `.register()`
* function. The keys used in this function must remain stable.
*/
return this.register({
triggerStep,
searchByEmailStep,
contactExistsCondition,
createContactStep,
requestStep,
ifelseStep,
updateContactStep,
createContactStep,
integrationRequestStep,
});
}

Expand Down
11 changes: 9 additions & 2 deletions src/integrations/slack/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import { IIntegrationConfig } from '@useparagon/core/integration';
*/
const config: IIntegrationConfig = {
description: 'Send notifications to Slack',
overviewText:
'Connect your Slack workspace to receive notifications and alerts in Slack. Stay connected to important activity by bringing it all together in your Slack workspace.\n \n\nOur Slack integration enables you to:\n \n\n• Receive alerts and notifications in your Slack workspace\n• Notify or DM specific team members based on certain activity',
overviewText: `Connect your Slack workspace to receive notifications and alerts in Slack. Stay connected to important activity by bringing it all together in your Slack workspace.
Our Slack integration enables you to:
• Receive alerts and notifications in your Slack workspace
• Notify or DM specific team members based on certain activity`,
showWatermark: true,
workflowDisplayOrder: [],
};

export default config;
11 changes: 9 additions & 2 deletions src/integrations/zoom/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import { IIntegrationConfig } from '@useparagon/core/integration';
*/
const config: IIntegrationConfig = {
description: 'Sync meetings with Zoom',
overviewText:
'Connect your Zoom account to create new Zoom meetings or create and update meeting registrants. Keep your meetings and events in sync with Zoom - without manual data entry.\n\n \nOur Zoom integration enables you to:\n \n• Automatically create or update meetings in Zoom\n• Create or update Zoom meeting registrants\n• Receive updates when your Zoom meetings are created or updated',
overviewText: `Connect your Zoom account to create new Zoom meetings or create and update meeting registrants. Keep your meetings and events in sync with Zoom - without manual data entry.
Our Zoom integration enables you to:
• Automatically create or update meetings in Zoom
• Create or update Zoom meeting registrants
• Receive updates when your Zoom meetings are created or updated`,
showWatermark: true,
workflowDisplayOrder: [],
};

export default config;

0 comments on commit bb1106e

Please sign in to comment.