Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Feat/triggers (#272)

Alaa-eddine K.c18154ca32a2
diff --git a/packages/app/src/backend/routes/api/page/builder.ts b/packages/app/src/backend/routes/api/page/builder.ts
index 60d29da2..722d335d 100644
--- a/packages/app/src/backend/routes/api/page/builder.ts
+++ b/packages/app/src/backend/routes/api/page/builder.ts
@@ -1356,4 +1356,31 @@ router.post('/store-limit-reached', async (req, res) => {
}
});
+router.post('/trigger/:id/register', async (req, res) => {
+ try {
+ const { id } = req.params;
+ const { payload } = req.body;
+
+ const url = `${config.env.API_SERVER}/user/trigger/${id}/register`;
+
+ const headers = {
+ 'X-AGENT-ID': req.headers['x-agent-id'],
+ ...(await authHeaders(req)), //add auth headers
+ };
+
+ console.log('trigger register url', url, headers);
+
+ const result: any = await axios.post(url, { ...payload }, headers);
+
+ console.log('>>> trigger register result', result.data);
+
+ res
+ .status(result.status || 200)
+ .send(result.error ? { error: result.error } : { ...result.data });
+ } catch (error) {
+ console.error('Error registering trigger:', error);
+ res.status(500).send({ error: 'Error registering trigger' });
+ }
+});
+
export default router;
diff --git a/packages/app/src/backend/routes/pages/builder-sidebar.ts b/packages/app/src/backend/routes/pages/builder-sidebar.ts
index 194c99a5..c72c093e 100644
--- a/packages/app/src/backend/routes/pages/builder-sidebar.ts
+++ b/packages/app/src/backend/routes/pages/builder-sidebar.ts
@@ -94,7 +94,11 @@ const baseMenu: Menu = {
],
//hide triggers for now
- //Triggers: [{ name: 'GmailTrigger', label: 'Gmail Trigger', description: '' }],
+ // Triggers: [
+ // { name: 'GmailTrigger', label: 'Gmail Trigger', description: '' },
+ // { name: 'WhatsAppTrigger', label: 'Whatsapp Trigger', description: '' },
+ // { name: 'JobSchedulerTrigger', label: 'Job Scheduler Trigger', description: '' },
+ // ],
Integrations: [],
};
diff --git a/packages/app/src/builder-ui/components/APIEndpoint.class.ts b/packages/app/src/builder-ui/components/APIEndpoint.class.ts
index 24d12ee9..80cc4091 100644
--- a/packages/app/src/builder-ui/components/APIEndpoint.class.ts
+++ b/packages/app/src/builder-ui/components/APIEndpoint.class.ts
@@ -3,7 +3,7 @@ import { debounce } from 'lodash-es';
import { EMBODIMENT_DESCRIPTIONS } from '../../shared/constants/general';
import EventEmitter from '../EventEmitter.class';
import { openEmbodimentDialog } from '../pages/builder/agent-settings';
-import { confirm } from '../ui/dialogs';
+import { alert, confirm } from '../ui/dialogs';
import { renderEndpointFormPreviewSidebar } from '../ui/react-injects';
import { delay } from '../utils';
import { Component } from './Component.class';
@@ -469,6 +469,9 @@ export class APIEndpoint extends Component {
if (prop === 'name') {
const oldName = oldValue;
const newName = newValue;
+ //!\\ don't enable this line for now, it may introduce a breaking change
+ //const newOutputName = `_.${newName}`;
+ const newOutputName = newName;
const inputName = inputDiv.getAttribute('smt-name');
const outputName = outputDiv.getAttribute('smt-name');
@@ -477,9 +480,9 @@ export class APIEndpoint extends Component {
inputDiv.querySelector('.name').innerText = newName;
}
- if (outputName != newName) {
- outputDiv.setAttribute('smt-name', newName);
- outputDiv.querySelector('.name').innerText = newName;
+ if (outputName != newOutputName) {
+ outputDiv.setAttribute('smt-name', newOutputName);
+ outputDiv.querySelector('.name').innerText = newOutputName;
// Update the expression attribute to use the new name
if (outputDiv?.hasAttribute('smt-expression')) {
@@ -502,7 +505,6 @@ export class APIEndpoint extends Component {
}
}
});
-
await delay(50);
this.advancedModeActions(this.isOnAdvancedMode);
}
@@ -528,6 +530,8 @@ export class APIEndpoint extends Component {
const outputDiv: any = await super.addOutput(
outputParent,
+ //!\\ don't enable this line for now, it may introduce a breaking change
+ //`_.${name}`,
name,
{
expression: `body.${name}`,
@@ -948,4 +952,21 @@ export class APIEndpoint extends Component {
// Sync default values after redraw
setTimeout(() => this.syncAllDefaultValues(), 100);
}
+
+ checkConnValidity(info: any) {
+ console.log('checkConnValidity', info);
+ const sourceDomComponent = info.source.closest('.component');
+ const targetDomComponent = info.target.closest('.component');
+ if (!sourceDomComponent || !targetDomComponent) return false;
+ if (!sourceDomComponent.classList.contains('agent-card')) {
+ alert(
+ 'Unsupported Connection',
+ 'Skills can only be connected to the agent card',
+ 'OK',
+ 'error',
+ );
+ return false;
+ }
+ return true;
+ }
}
diff --git a/packages/app/src/builder-ui/components/Component.class/index.ts b/packages/app/src/builder-ui/components/Component.class/index.ts
index a204bb79..8b4d9759 100644
--- a/packages/app/src/builder-ui/components/Component.class/index.ts
+++ b/packages/app/src/builder-ui/components/Component.class/index.ts
@@ -174,6 +174,7 @@ export class Component extends EventEmitter {
displayName: this.constructor.name,
cssClass: '',
iconCSSClass: 'mif-cog',
+ icon: '',
showSettings: true,
addOutputButton: 'Outputs',
addInputButton: 'Inputs',
@@ -426,6 +427,10 @@ export class Component extends EventEmitter {
}, 15);
});
}
+
+ checkConnValidity(info: any) {
+ return true;
+ }
protected async repaint(redrawConnectors = false) {
if (redrawConnectors) {
let connections = [...this.domElement.querySelectorAll('.endpoint')]
@@ -856,6 +861,7 @@ export class Component extends EventEmitter {
const propSettings = this.outputSettings[propName];
switch (propSettings?.type) {
+ case 'text':
case 'string':
return outputProps?.[propName] || propSettings?.default || _default;
case 'number':
@@ -866,7 +872,8 @@ export class Component extends EventEmitter {
}
public async addOutput(parent, name, outputProperties: any = {}, options: any = {}) {
if (this.outputNameExists(name)) {
- errorToast(`${name} already exists`);
+ errorToast(`Output "${name}" already exists`);
+ console.warn(`Output "${name}" already exists`, this);
return;
}
const jsPlumbInstance = this.workspace.jsPlumbInstance;
@@ -993,6 +1000,7 @@ export class Component extends EventEmitter {
: '<span class="text-xl">Edit Output</span>';
const orderedValConfig = getOrderedValConfig(valConfig, [
+ 'name',
'description',
'expression',
'additionalOptionsLabel',
@@ -1014,6 +1022,8 @@ export class Component extends EventEmitter {
titleElm.appendChild(buttonElm);
}
+ this.emit('outputEditorReady', dialog);
+
// requires a tiny delay to make sure the input is focused
delay(50).then(() => focusField(nameElm));
},
@@ -1181,6 +1191,7 @@ export class Component extends EventEmitter {
switch (propSettings?.type) {
case 'string':
+ case 'text':
return inputProps?.[propName] || propSettings?.default || _default;
case 'number':
return inputProps?.[propName] || propSettings?.default || _default;
@@ -1191,7 +1202,8 @@ export class Component extends EventEmitter {
public async addInput(parent, name, inputProperties: any = {}) {
if (this.inputNameExists(name)) {
- errorToast(`${name} already exists`);
+ errorToast(`Input "${name}" already exists`);
+ console.warn(`Input "${name}" already exists`, this);
return;
}
const jsPlumbInstance: any = this.workspace.jsPlumbInstance;
@@ -1433,6 +1445,8 @@ export class Component extends EventEmitter {
titleElm.appendChild(buttonElm);
}
+ this.emit('inputEditorReady', dialog);
+
// requires a tiny delay to make sure the input is focused
delay(50).then(() => focusField(nameElm));
},
@@ -1961,7 +1975,7 @@ export class Component extends EventEmitter {
const titleBar = document.createElement('div');
titleBar.className = 'title-bar';
- const iconCss = this.drawSettings.iconCSSClass || '';
+ const iconCss = this.drawSettings.icon || this.drawSettings.iconCSSClass || '';
if (iconCss.startsWith('<svg')) {
const color = this.drawSettings.color || '#000';
@@ -1979,6 +1993,15 @@ export class Component extends EventEmitter {
if (!pathFill) {
allPathes.forEach((p) => p.setAttribute('fill', color));
}
+ } else if (iconCss.startsWith('/img/')) {
+ titleBar.innerHTML = `<div class="flex flex-row items-center gap-1 title-bar-top">
+ <span class="icon h-full">
+ <img src="${iconCss}" />
+ </span>
+ <span class="title font-semibold">${this.title}</span>
+ </div>
+ <span class="description">${this.description}</span>
+ `;
} else {
titleBar.innerHTML = `<div class="flex flex-row items-center gap-1 title-bar-top">
<span class="icon ${iconCss} h-full"></span>
@@ -2787,6 +2810,8 @@ export class Component extends EventEmitter {
titleElm.appendChild(buttonElm);
}
+ this.emit('inputEditorReady', dialog);
+
// requires a tiny delay to make sure the input is focused
delay(50).then(() => focusField(nameElm));
},
@@ -2876,6 +2901,7 @@ export class Component extends EventEmitter {
: '<span class="text-xl">Add Output</span>';
const orderedValConfig = getOrderedValConfig(valConfig, [
+ 'name',
'description',
'expression',
'additionalOptionsLabel',
@@ -2897,6 +2923,8 @@ export class Component extends EventEmitter {
titleElm.appendChild(buttonElm);
}
+ this.emit('outputEditorReady', dialog);
+
// requires a tiny delay to make sure the input is focused
delay(50).then(() => focusField(nameElm));
},
diff --git a/packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts b/packages/app/src/builder-ui/components/Triggers/Gmail.trigger.ts
similarity index 53%
rename from packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts
rename to packages/app/src/builder-ui/components/Triggers/Gmail.trigger.ts
index 21db51aa..8e13003d 100644
--- a/packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts
+++ b/packages/app/src/builder-ui/components/Triggers/Gmail.trigger.ts
@@ -11,12 +11,37 @@ declare var Metro;
* for better separation of concerns and reusability.
*/
export class GmailTrigger extends Trigger {
+ public schema: any = {
+ email: {
+ id: 'string',
+ threadId: 'string',
+ labelIds: 'array',
+ snippet: 'string',
+ sizeEstimate: 'number',
+ internalDate: 'string',
+ headers: {
+ from: 'string',
+ to: 'string',
+ cc: 'string',
+ bcc: 'string',
+ subject: 'string',
+ date: 'string',
+ messageId: 'string',
+ },
+ body: {
+ text: 'string',
+ html: 'string',
+ },
+ attachments: 'array',
+ isUnread: 'boolean',
+ },
+ };
private oauth: oAuthSettings | undefined;
protected async prepare(): Promise<boolean> {
try {
// Initialize OAuth settings helper
- this.oauth = new oAuthSettings(this);
+ this.oauth = new oAuthSettings(this, 'oauth_cred_id');
await this.oauth.initialize();
return true;
} catch (error) {
@@ -45,8 +70,28 @@ export class GmailTrigger extends Trigger {
...this.oauth?.configure(),
};
- this.drawSettings.iconCSSClass = 'svg-icon ' + this.constructor.name;
- this.drawSettings.color = '#ff00f2';
+ // this.properties.defaultOutputs = [
+ // 'Payload',
+ // 'id',
+ // 'headers.subject',
+ // 'body.text',
+ // 'attachments',
+ // 'isUnread',
+ // ];
+ // for (let output of this.properties.defaultOutputs) {
+ // this.properties.outputProps.push({
+ // name: output,
+ // type: 'string',
+ // color: '#95f562',
+ // expression: output == 'Payload' ? 'Payload' : `Payload.email.${output}`,
+ // });
+ // }
+
+ this.drawSettings.icon = `/img/triggers/gmail.svg`;
+
+ this.drawSettings.color = '#00ff00';
+ this.drawSettings.componentDescription = 'Poll Gmail for new incoming emails';
+ this.drawSettings.displayName = '<i class="fa-solid fa-bolt"></i> Gmail';
}
public async checkSettings(): Promise<void> {
diff --git a/packages/app/src/builder-ui/components/Triggers/JobScheduler.trigger.ts b/packages/app/src/builder-ui/components/Triggers/JobScheduler.trigger.ts
new file mode 100644
index 00000000..322dba31
--- /dev/null
+++ b/packages/app/src/builder-ui/components/Triggers/JobScheduler.trigger.ts
@@ -0,0 +1,112 @@
+import { COMP_NAMES } from '@src/builder-ui/config';
+import { handleKvFieldEditBtn } from '@src/builder-ui/utils';
+import { oAuthSettings } from '../../helpers/oauth/oauth-settings.helper';
+import { Trigger } from './Trigger.class';
+
+declare var Metro;
+
+/**
+ * Gmail Trigger Component - Clean and Modular
+ *
+ * This component handles Gmail-based triggers with OAuth authentication.
+ * All OAuth logic has been extracted to the oAuthSettings() helper class
+ * for better separation of concerns and reusability.
+ */
+export class JobSchedulerTrigger extends Trigger {
+ public schema: any = {};
+ private oauth: oAuthSettings | undefined;
+
+ protected async init(): Promise<void> {
+ await super.init();
+
+ // Set up component settings with OAuth configuration
+ this.settings = {
+ ...this.settings,
+ interval: {
+ type: 'input',
+ label: 'Interval',
+ min: 1,
+ max: 720,
+ value: 5,
+ step: 1,
+ validate: 'required min=1 max=720',
+ validateMessage: 'Allowed range 1 to 720',
+ desc: 'Interval in minutes',
+ },
+ payload: {
+ type: 'textarea',
+ label: 'Job Parameters',
+ readonly: true,
+ help: 'Use this to configure your job with custom parameters to pass to your workflow',
+ tooltipClasses: 'w-64',
+ arrowClasses: '-ml-13',
+ validate: `custom=isValidJson`,
+ validateMessage: 'Provide a Valid JSON with non-empty keys',
+ actions: [
+ {
+ label: '',
+ icon: 'fa-regular fa-pen-to-square',
+ id: 'editPayload',
+ events: {
+ click: handleKvFieldEditBtn.bind(this, 'payload', {
+ showVault: true,
+ vaultScope: COMP_NAMES.apiCall,
+ }),
+ },
+ },
+ ],
+ },
+ };
+
+ this.drawSettings.icon = `/img/triggers/job-scheduler.svg`;
+
+ this.drawSettings.color = '#00ff00';
+ this.drawSettings.componentDescription = 'Poll Job Scheduler for new incoming jobs';
+ this.drawSettings.displayName = '<i class="fa-solid fa-bolt"></i> JobScheduler';
+ }
+
+ public async checkSettings(): Promise<void> {
+ await this.oauth?.checkSettings();
+ }
+
+ /**
+ * Clean up event listeners and resources
+ */
+ destroy(): void {
+ super.destroy?.();
+ }
+
+ protected async run(): Promise<any> {
+ super.run();
+ //get the jobScheduler schema from the payload field
+ const payload = this.data.payload || '{}';
+ this.schema = JSON.parse(payload);
+
+ this.addEventListener('settingsSaved', async (settingsValues) => {
+ //first update the jobScheduler schema
+ // Job scheduler schema is dynamic, and is used to provide Trigger variables to the trigger outputs
+ //we need to read it from the payload field
+ const payload = settingsValues.payload || '{}';
+ this.schema = JSON.parse(payload);
+
+ /*
+ await this.workspace.waitServerData();
+ await this.workspace.saveAgent();
+ const base = this.workspace.serverData.frontUrl;
+ const id = this.uid;
+ const url = `${base}/api/page/builder/trigger/${id}/register`;
+ //const result: any = await axios.post(url, { data: '123' });
+ const headers = {
+ 'X-AGENT-ID': this.workspace.agent.id,
+ };
+ const result: any = await fetch(url, {
+ method: 'POST',
+ body: JSON.stringify({ data: '123' }),
+ headers,
+ });
+ const json = await result.json();
+ console.log('JobSchedulerTrigger result', json);
+ */
+ });
+ }
+}
diff --git a/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts b/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts
index f7384304..4ba4d0cd 100644
--- a/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts
+++ b/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts
@@ -13,29 +13,108 @@ export class Trigger extends Component {
},
};
+ this.outputSettings = {
+ ...this.outputSettings,
+ expression: {
+ type: 'text',
+ label: 'Field Mapping',
+ editConfig: {
+ validate: 'required custom=isValidOutputName',
+ validateMessage: `Field Mapping is required for triggers, Use a valid JSON path notation, e.g., Payload.id, Payload.name, etc.`,
+
+ // fieldCls:
+ // 'bg-white border text-gray-900 rounded block w-full outline-none focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none text-sm font-normal placeholder:text-sm placeholder:font-normal py-2 px-3 transition-all duration-150 ease-in-out border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500',
+ attributes: {
+ 'data-trigger-vars': 'true',
+ 'data-auto-size': 'true',
+ rows: '2',
+ placeholder: `Map the triggers variables to this input`,
+ }, // Enable auto-size for consistent UX with 2-line default
+ //section: 'Advanced_Options',
+ hintPosition: 'after_label',
+ },
+ },
+ };
+
// #region [ I/O config ] ==================
this.properties.defaultOutputs = ['Payload'];
this.properties.defaultInputs = [];
+ this.properties.outputProps = [{ name: 'Payload', type: 'string', color: '#95f562' }];
// #endregion
+ const dataEntries = ['triggerEndpoint'];
+ for (let item of dataEntries) {
+ if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;
+ }
+
// #region [ Draw config ] ==================
- this.drawSettings.addOutputButton = null;
+ //this.drawSettings.addOutputButton = null;
this.drawSettings.addInputButton = null;
- this.drawSettings.addOutputButtonLabel = '';
+ this.drawSettings.addOutputButtonLabel = ' ';
this.drawSettings.addInputButtonLabel = '';
- this.drawSettings.componentDescription = 'Trigger';
+ this.drawSettings.componentDescription = ' ';
- this.drawSettings.shortDescription = 'Trigger';
+ this.drawSettings.shortDescription = '';
this.drawSettings.color = '#ff00f2';
// #endregion
}
+ protected async run(): Promise<any> {
+ this.addEventListener('outputEditorReady', (dialog) => {
+ console.log('outputEditorReady', dialog);
+
+ const triggerName = dialog.querySelector('.form-box [name="name"]');
+ if (triggerName) {
+ //ensure that the trigger name is available in the expression
+ triggerName.setAttribute('data-triggers', this.uid);
+ }
+
+ //try to find the triggerExpression field by name
+ const triggerExpression = dialog.querySelector('.form-box [name="expression"]');
+ if (triggerExpression) {
+ //ensure that the trigger variables are available in the expression
+ triggerExpression.setAttribute('data-triggers', this.uid);
+ }
+ });
+ }
+
public redraw(triggerSettings?: boolean): any {
super.redraw(triggerSettings);
// add new connection endpoint
this.domElement.classList.add('Trigger');
this.domElement.setAttribute('smt-trigger', '');
+
+ //bind trigger variables
+
+ // const _ResultOutput = document.createElement('div');
+ // _ResultOutput.className = 'smyth endpoint output-endpoint GmailTrigger';
+ // _ResultOutput.setAttribute('smt-name', 'Result');
+ // _ResultOutput.innerHTML = `<span class="name"><span class="label">Result</span></span>`;
+ // this.outputContainer.appendChild(_ResultOutput);
+
+ const toggleOutputContainer = document.createElement('button');
+ toggleOutputContainer.className = 'toggle-output-container';
+ const toggleIcon = document.createElement('i');
+ toggleIcon.className = this.domElement.classList.contains('collapsed')
+ ? 'fa-solid fa-chevron-right text-gray-300'
+ : 'fa-solid fa-chevron-left text-gray-300';
+
+ toggleOutputContainer.appendChild(toggleIcon);
+ toggleOutputContainer.onclick = (event: MouseEvent) => {
+ event.stopPropagation();
+ event.stopImmediatePropagation();
+ event.preventDefault();
+ this.domElement.classList.toggle('collapsed');
+ if (this.domElement.classList.contains('collapsed')) {
+ toggleIcon.className = 'fa-solid fa-chevron-right text-gray-300';
+ } else {
+ toggleIcon.className = 'fa-solid fa-chevron-left text-gray-300';
+ }
+
+ this.repaint();
+ };
+ this.outputContainer.appendChild(toggleOutputContainer);
}
}
diff --git a/packages/app/src/builder-ui/components/Triggers/WhatsApp.trigger.ts b/packages/app/src/builder-ui/components/Triggers/WhatsApp.trigger.ts
new file mode 100644
index 00000000..3d59e434
--- /dev/null
+++ b/packages/app/src/builder-ui/components/Triggers/WhatsApp.trigger.ts
@@ -0,0 +1,91 @@
+import { Trigger } from './Trigger.class';
+
+/**
+ * Gmail Trigger Component - Clean and Modular
+ *
+ * This component handles Gmail-based triggers with OAuth authentication.
+ * All OAuth logic has been extracted to the oAuthSettings() helper class
+ * for better separation of concerns and reusability.
+ */
+export class WhatsAppTrigger extends Trigger {
+ public schema: any = {
+ message: {
+ id: 'string',
+ from: 'string',
+ profileName: 'string',
+ text: 'string',
+ type: 'string',
+ timestamp: 'string',
+ phoneNumberId: 'string',
+ },
+ };
+
+ protected async init(): Promise<void> {
+ await super.init();
+
+ // Set up component settings with OAuth configuration
+ this.settings = {
+ ...this.settings,
+ verifyToken: {
+ type: 'input',
+ label: 'Verify Token',
+ hint: 'Verify Token',
+ validate: `required maxlength=256`,
+ validateMessage: `Provide a valid verify token that only contains 'a-z', 'A-Z', '0-9', '-', '_' , without leading or trailing spaces. Length should be less than 50 characters.`,
+ },
+ clientId: {
+ type: 'input',
+ label: 'Client ID',
+ hint: 'Client ID',
+ validate: `required maxlength=512`,
+ validateMessage: `Provide a valid client id that only contains 'a-z', 'A-Z', '0-9', '-', '_' , without leading or trailing spaces. Length should be less than 50 characters.`,
+ },
+ clientSecret: {
+ type: 'input',
+ label: 'Client Secret',
+ hint: 'Client Secret',
+ validate: `required maxlength=512`,
+ validateMessage: `Provide a valid client secret that only contains 'a-z', 'A-Z', '0-9', '-', '_' , without leading or trailing spaces. Length should be less than 50 characters.`,
+ },
+ };
+
+ this.drawSettings.icon = `/img/triggers/whatsapp.svg`;
+
+ this.drawSettings.color = '#00ff00';
+ this.drawSettings.componentDescription = 'Poll Whatsapp for new incoming messages';
+ this.drawSettings.displayName = '<i class="fa-solid fa-bolt"></i> WhatsApp';
+ }
+
+ // public async checkSettings(): Promise<void> {
+
+ // }
+
+ /**
+ * Clean up event listeners and resources
+ */
+ destroy(): void {
+ //
+ super.destroy?.();
+ }
+
+ protected async run(): Promise<any> {
+ this.addEventListener('settingsSaved', async (settingsValues) => {
+ await this.workspace.waitServerData();
+ await this.workspace.saveAgent();
+ const base = this.workspace.serverData.frontUrl;
+ const id = this.uid;
+ const url = `${base}/api/page/builder/trigger/${id}/register`;
+ //const result: any = await axios.post(url, { data: '123' });
+ const headers = {
+ 'X-AGENT-ID': this.workspace.agent.id,
+ };
+ const result: any = await fetch(url, {
+ method: 'POST',
+ body: JSON.stringify({ data: '123' }),
+ headers,
+ });
+ const json = await result.json();
+ console.log('WhatsappTrigger result', json);
+ });
+ }
+}
diff --git a/packages/app/src/builder-ui/components/index.ts b/packages/app/src/builder-ui/components/index.ts
index 125248be..278ae0a3 100644
--- a/packages/app/src/builder-ui/components/index.ts
+++ b/packages/app/src/builder-ui/components/index.ts
@@ -37,7 +37,9 @@ import { VisionLLM } from './VisionLLM.class';
import { ZapierAction } from './ZapierAction.class';
import { AgentCard } from './AgentCard.class';
-import { GmailTrigger } from './Triggers/GmailTrigger.class';
+import { GmailTrigger } from './Triggers/Gmail.trigger';
+import { WhatsAppTrigger } from './Triggers/WhatsApp.trigger';
+import { JobSchedulerTrigger } from './Triggers/JobScheduler.trigger';
const baseComponents = {
Component,
@@ -77,7 +79,9 @@ const baseComponents = {
ImageGenerator,
MCPClient,
GmailTrigger,
+ WhatsAppTrigger,
AgentCard,
+ JobSchedulerTrigger,
};
export const getBuilderComponents = () => {
diff --git a/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts b/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts
index 8e268335..ea0fc329 100644
--- a/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts
+++ b/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts
@@ -10,7 +10,6 @@ import { UIHelper } from './ui.helper';
* for components to integrate OAuth functionality without cluttering the component code.
*/
export class oAuthSettings {
- private component: any;
private oauthService: OAuthService | undefined;
private uiHelper: UIHelper | undefined;
private oauthConnectionNames: SelectOption[] = [];
@@ -18,7 +17,10 @@ export class oAuthSettings {
private boundHandleFocusAfterAuth: () => Promise<void>;
private boundHandleAuthMessage: (event: MessageEvent) => void;
- constructor(component: any) {
+ constructor(
+ private component: any,
+ private setting_name: string = 'oauth_con_id',
+ ) {
this.component = component;
this.boundHandleFocusAfterAuth = this.handleFocusAfterAuth.bind(this);
this.boundHandleAuthMessage = this.handleAuthMessage.bind(this);
@@ -29,8 +31,10 @@ export class oAuthSettings {
* Minimal integration so other components can just call oauth.checkSettings().
*/
public async checkSettings(): Promise<void> {
- const connectionId: string | undefined = this.component?.data?.oauth_con_id;
- const existingBtn = this.component?.domElement?.querySelector('button.oauthButton') as HTMLButtonElement || null;
+ const connectionId: string | undefined = this.component?.data?.[this.setting_name];
+ const existingBtn =
+ (this.component?.domElement?.querySelector('button.oauthButton') as HTMLButtonElement) ||
+ null;
// If no connection chosen, remove component-level button (if any) and exit
if (!connectionId || connectionId === 'None') {
@@ -87,12 +91,12 @@ export class oAuthSettings {
*/
configure(): Record<string, any> {
return {
- oauth_con_id: {
+ [this.setting_name]: {
type: 'select',
label: 'OAuth Connection',
section: 'OAuth',
options: this.oauthConnectionNames,
- value: this.component.data.oauth_con_id || 'None',
+ value: this.component.data[this.setting_name] || 'None',
events: {
change: (event: Event) =>
this.handleOAuthConnectionChange((event.target as HTMLSelectElement).value),
@@ -106,6 +110,7 @@ export class oAuthSettings {
visible: () => true,
events: {
click: () => {
+ this.component.data[this.setting_name] = 'None';
this.handleOAuthConnectionAction('None');
},
},
@@ -116,7 +121,8 @@ export class oAuthSettings {
id: 'editOAuthConnection',
cls: 'mt-[7px] !mr-[24px] !pt-[10px]',
visible: () =>
- this.component.data.oauth_con_id && this.component.data.oauth_con_id !== 'None',
+ this.component.data[this.setting_name] &&
+ this.component.data[this.setting_name] !== 'None',
events: {
click: () => this.handleOAuthConnectionAction(this.component.data.oauth_con_id),
},
@@ -199,13 +205,13 @@ export class oAuthSettings {
await this.oauthService.loadConnections();
const options = this.oauthService.buildSelectOptions();
- if (this.component.settings?.oauth_con_id) {
- this.component.settings.oauth_con_id.options = options;
+ if (this.component.settings?.[this.setting_name]) {
+ this.component.settings[this.setting_name].options = options;
}
} catch (error) {
console.error('Error updating OAuth connection options:', error);
- if (this.component.settings?.oauth_con_id) {
- this.component.settings.oauth_con_id.options = [{ value: 'None', text: 'None' }];
+ if (this.component.settings?.[this.setting_name]) {
+ this.component.settings[this.setting_name].options = [{ value: 'None', text: 'None' }];
}
}
}
@@ -219,7 +225,7 @@ export class oAuthSettings {
return;
}
- const selectedConnectionId = this.component.data.oauth_con_id;
+ const selectedConnectionId = this.component.data[this.setting_name];
if (selectedConnectionId === 'None' || !selectedConnectionId) {
errorToast('Please select a valid OAuth Connection first', 'Error', 'alert');
return;
@@ -276,7 +282,7 @@ export class oAuthSettings {
this.uiHelper.activateSpinner(button);
- const success = await this.oauthService.signOut(this.component.data.oauth_con_id);
+ const success = await this.oauthService.signOut(this.component.data[this.setting_name]);
if (success) {
await this.uiHelper.updateAuthButtonState(false);
@@ -296,6 +302,8 @@ export class oAuthSettings {
return;
}
+ //const currentValue = this.component.data[this.setting_name];
+
try {
const connections = await this.oauthService.loadConnections();
@@ -308,7 +316,7 @@ export class oAuthSettings {
await this.oauthService.saveConnection(connectionId, formData);
// Update component state
- this.component.data.oauth_con_id = connectionId;
+ this.component.data[this.setting_name] = connectionId;
await this.updateOAuthConnectionOptions();
this.component.refreshSettingsSidebar();
this.uiHelper.updateOAuthActionButtons(this.hasValidConnection());
@@ -327,7 +335,7 @@ export class oAuthSettings {
* Handles OAuth connection selection change
*/
private async handleOAuthConnectionChange(selectedValue: string): Promise<void> {
- this.component.data.oauth_con_id = selectedValue;
+ this.component.data[this.setting_name] = selectedValue;
if (!selectedValue || selectedValue === 'None') {
await this.uiHelper?.updateAuthButtonState(false);
@@ -366,7 +374,7 @@ export class oAuthSettings {
this.uiHelper.activateSpinner(authButton);
const isAuthenticated =
- this.component.data.oauth_con_id && this.component.data.oauth_con_id !== 'None'
+ this.component.data[this.setting_name] && this.component.data[this.setting_name] !== 'None'
? await this.checkAuthentication()
: false;
@@ -378,14 +386,16 @@ export class oAuthSettings {
*/
private async checkAuthentication(): Promise<boolean> {
if (!this.oauthService) return false;
- return this.oauthService.checkAuthentication(this.component.data.oauth_con_id);
+ return this.oauthService.checkAuthentication(this.component.data[this.setting_name]);
}
/**
* Helper to check if current connection is valid
*/
private hasValidConnection(): boolean {
- return !!(this.component.data.oauth_con_id && this.component.data.oauth_con_id !== 'None');
+ return !!(
+ this.component.data[this.setting_name] && this.component.data[this.setting_name] !== 'None'
+ );
}
/**
diff --git a/packages/app/src/builder-ui/types/component.types.ts b/packages/app/src/builder-ui/types/component.types.ts
index 396d564f..d4fcfb97 100644
--- a/packages/app/src/builder-ui/types/component.types.ts
+++ b/packages/app/src/builder-ui/types/component.types.ts
@@ -37,6 +37,7 @@ export type DrawSettingsType = {
displayName?: string;
cssClass?: string;
iconCSSClass?: string;
+ icon?: string;
showSettings?: boolean;
addOutputButton?: string;
addInputButton?: string;
diff --git a/packages/app/src/builder-ui/ui/form/misc.ts b/packages/app/src/builder-ui/ui/form/misc.ts
index d3b4816c..3c42e474 100644
--- a/packages/app/src/builder-ui/ui/form/misc.ts
+++ b/packages/app/src/builder-ui/ui/form/misc.ts
@@ -135,6 +135,8 @@ export function createTemplateVarBtn(
cls = ' btn-field-var';
} else if (type === 'global') {
cls = ' btn-global-var';
+ } else if (type === 'trigger') {
+ cls = ' btn-trigger-var';
}
button.className = `button primary small template-var-button${cls}`;
@@ -154,7 +156,9 @@ export function generateTemplateVarBtns(
): HTMLElement | null {
// Look for existing wrapper within the specific parent container, not globally
const searchScope = parentContainer || document;
- let wrapper = searchScope.querySelector(`.${TEMPLATE_VAR_BTNS_WRAPPER_CLASS}.tvb-${compUid}`) as HTMLDivElement;
+ let wrapper = searchScope.querySelector(
+ `.${TEMPLATE_VAR_BTNS_WRAPPER_CLASS}.tvb-${compUid}`,
+ ) as HTMLDivElement;
if (!wrapper) {
wrapper = document.createElement('div');
@@ -173,6 +177,9 @@ export function generateTemplateVarBtns(
const globalVarWrapper = document.createElement('div');
globalVarWrapper.classList.add('global-vars-wrapper');
+ const triggerVarWrapper = document.createElement('div');
+ triggerVarWrapper.classList.add('trigger-vars-wrapper');
+
if (variables?.size > 0) {
for (const [key, value] of variables) {
if (key) {
@@ -181,9 +188,15 @@ export function generateTemplateVarBtns(
switch (value?.type) {
case 'field':
fieldVarWrapper.appendChild(button);
+ wrapper.classList.add('fields');
break;
case 'global':
globalVarWrapper.appendChild(button);
+ wrapper.classList.add('globals');
+ break;
+ case 'trigger':
+ triggerVarWrapper.appendChild(button);
+ wrapper.classList.add('triggers');
break;
default:
// Default case handles standard input types (e.g. Any, String, Binary) by adding them to inputVarWrapper
@@ -202,6 +215,9 @@ export function generateTemplateVarBtns(
if (globalVarWrapper?.children?.length) {
wrapper.appendChild(globalVarWrapper);
}
+ if (triggerVarWrapper?.children?.length) {
+ wrapper.appendChild(triggerVarWrapper);
+ }
wrapper.style.display = 'block';
} else {
@@ -242,6 +258,8 @@ export function handleTemplateVars(targetElm, component = null) {
(formGroup?.querySelector('textarea[data-agent-vars=true]') as HTMLTextAreaElement) ||
(formGroup?.querySelector('input[data-template-vars=true]') as HTMLTextAreaElement) ||
(formGroup?.querySelector('input[data-agent-vars=true]') as HTMLTextAreaElement) ||
+ (formGroup?.querySelector('textarea[data-trigger-vars=true]') as HTMLTextAreaElement) ||
+ (formGroup?.querySelector('input[data-trigger-vars=true]') as HTMLTextAreaElement) ||
(formGroup?.querySelector('textarea') as HTMLTextAreaElement);
// changing select element does not remove template-var-buttons and these buttons can add inputs to readonly field
@@ -296,7 +314,9 @@ export function handleTemplateVars(targetElm, component = null) {
let fieldName = clickedElm?.name;
if (!fieldName) {
const formGroup = (clickedElm as HTMLElement).closest('.form-group');
- const textarea = formGroup?.querySelector('textarea[data-template-vars=true]') as HTMLTextAreaElement;
+ const textarea = formGroup?.querySelector(
+ 'textarea[data-template-vars=true]',
+ ) as HTMLTextAreaElement;
fieldName = textarea?.name;
}
@@ -335,7 +355,11 @@ export function handleTemplateVars(targetElm, component = null) {
// #endregion
const focusedElmParent = clickedElm.closest('.form-group') as HTMLElement;
- const buttonsContainer = generateTemplateVarBtns(variables, compUid, focusedElmParent) as HTMLDivElement;
+ const buttonsContainer = generateTemplateVarBtns(
+ variables,
+ compUid,
+ focusedElmParent,
+ ) as HTMLDivElement;
if (!buttonsContainer) return;
@@ -351,7 +375,9 @@ export function handleTemplateVars(targetElm, component = null) {
let fieldName = clickedElm?.name;
if (!fieldName) {
const formGroup = (clickedElm as HTMLElement).closest('.form-group');
- const textarea = formGroup?.querySelector('textarea[data-agent-vars=true]') as HTMLTextAreaElement;
+ const textarea = formGroup?.querySelector(
+ 'textarea[data-agent-vars=true]',
+ ) as HTMLTextAreaElement;
fieldName = textarea?.name;
}
@@ -366,10 +392,42 @@ export function handleTemplateVars(targetElm, component = null) {
>;
const focusedElmParent = clickedElm.closest('.form-group') as HTMLElement;
- const buttonsContainer = generateTemplateVarBtns(variables, compUid, focusedElmParent) as HTMLDivElement;
+ const buttonsContainer = generateTemplateVarBtns(
+ variables,
+ compUid,
+ focusedElmParent,
+ ) as HTMLDivElement;
if (!buttonsContainer) return;
+ focusedElmParent.appendChild(buttonsContainer);
+ } else if (
+ clickedElm.getAttribute('data-trigger-vars') === 'true' &&
+ !clickedElm?.hasAttribute('readonly')
+ ) {
+ console.log('clicked elm', clickedElm);
+ let dataTriggers = clickedElm.getAttribute('data-triggers');
+ if (!dataTriggers) return;
+
+ const triggersList = Array.isArray(dataTriggers) ? dataTriggers.split(',') : [dataTriggers];
+ const triggersSchema = triggersList.map((triggerId) => {
+ const component = document.getElementById(triggerId);
+ const control = (component as any)?._control;
+ return control?.schema;
+ });
+
+ //generate variables from schema
+ let variables = new Map();
+ for (const schema of triggersSchema) {
+ const triggerVariables = extractTriggerVariables(schema);
+ for (const [key, value] of triggerVariables) {
+ variables.set(key, value);
+ }
+ }
+
+ const buttonsContainer = generateTemplateVarBtns(variables, compUid) as HTMLDivElement;
+ if (!buttonsContainer) return;
+ const focusedElmParent = clickedElm.closest('.form-group');
focusedElmParent.appendChild(buttonsContainer);
} else {
// * Remove template variable buttons
@@ -380,6 +438,21 @@ export function handleTemplateVars(targetElm, component = null) {
}
};
}
+function extractTriggerVariables(schema: any, path = '') {
+ let variables = new Map();
+
+ for (const key in schema) {
+ const fullPath = `${path?.trim() ? `${path}.` : ''}${key}`;
+ variables.set(fullPath, { var: `${fullPath}`, type: 'trigger' });
+ if (typeof schema[key] === 'object') {
+ const nestedVariables = extractTriggerVariables(schema[key], fullPath);
+ for (const [nestedKey, nestedValue] of nestedVariables) {
+ variables.set(nestedKey, nestedValue);
+ }
+ }
+ }
+ return variables;
+}
export const setTabIndex = (selector: string): void => {
// prevent to focus the fake textarea with tab key
diff --git a/packages/app/src/builder-ui/workspace/Workspace.class.ts b/packages/app/src/builder-ui/workspace/Workspace.class.ts
index e39d604f..07e54dd8 100644
--- a/packages/app/src/builder-ui/workspace/Workspace.class.ts
+++ b/packages/app/src/builder-ui/workspace/Workspace.class.ts
@@ -248,8 +248,8 @@ export class Workspace extends EventEmitter {
if (conflict) this.jsPlumbInstance.deleteConnection(info.connection);
- const agentCardValid = AgentCard.checkConnValidity(info);
- if (!agentCardValid) this.jsPlumbInstance.deleteConnection(info.connection);
+ // const agentCardValid = AgentCard.checkConnValidity(info);
+ // if (!agentCardValid) this.jsPlumbInstance.deleteConnection(info.connection);
//! SHOULDN'T WE ABORT EARLY IF THERE WAS A CONFLICT!!?? I feel like it aborts and works correctly
//! but cannot detect how and where does it abort if a conflict or non-valid conn was detected
@@ -257,6 +257,12 @@ export class Workspace extends EventEmitter {
const sourceComponent = info.source.closest('.component')?._control;
const targetComponent = info.target.closest('.component')?._control;
+ const validSourceConn = sourceComponent?.checkConnValidity(info);
+ if (!validSourceConn) this.jsPlumbInstance.deleteConnection(info.connection);
+
+ const validTargetConn = targetComponent?.checkConnValidity(info);
+ if (!validTargetConn) this.jsPlumbInstance.deleteConnection(info.connection);
+
sourceComponent?.emit(
'connectionAttached',
info.source.getAttribute('smt-name'),
@@ -1399,16 +1405,7 @@ export class Workspace extends EventEmitter {
);
}
} else {
- //handle the special case of triggers connecting to APIEndpoints
-
- if (
- sourceComponent.classList.contains('Trigger') &&
- targetComponent.classList.contains('APIEndpoint')
- ) {
- targetEndpoint = targetComponent.querySelector(`.endpoint-connection`);
- } else {
- targetEndpoint = [...targetComponent.querySelectorAll(`.input-endpoint`)][targetEndpointID];
- }
+ targetEndpoint = [...targetComponent.querySelectorAll(`.input-endpoint`)][targetEndpointID];
}
// @ts-ignore
diff --git a/packages/app/static/css/smyth-builder.css b/packages/app/static/css/smyth-builder.css
index d87bd903..c9671498 100644
--- a/packages/app/static/css/smyth-builder.css
+++ b/packages/app/static/css/smyth-builder.css
@@ -584,6 +584,9 @@ body.locked #agent-sidebar-root .restore-button {
padding: 0px;
}
+.collapsed.component .output-container,
+.collapsed.component .input-container,
+.collapsed.component .endpoint,
.collapsed .component .output-container,
.collapsed .component .input-container,
.collapsed .component .endpoint {
@@ -591,10 +594,13 @@ body.locked #agent-sidebar-root .restore-button {
overflow: hidden;
}
+.collapsed.component .ep-control button,
.collapsed .component .ep-control button {
display: none;
}
+.collapsed.component .output-container,
+.collapsed.component .input-container,
.collapsed .component .output-container,
.collapsed .component .input-container {
position: relative;
@@ -602,7 +608,7 @@ body.locked #agent-sidebar-root .restore-button {
opacity: 0;
}
-.collapsed .component .ep-control.outputs::after {
+.collapsed.component .ep-control.outputs::after .collapsed .component .ep-control.outputs::after {
content: ' ';
display: block;
background: #d8d8d8;
@@ -614,7 +620,7 @@ body.locked #agent-sidebar-root .restore-button {
top: 4px;
}
-.collapsed .component .ep-control.inputs::before {
+.collapsed.component .ep-control.inputs::before .collapsed .component .ep-control.inputs::before {
content: ' ';
display: block;
background: #d8d8d8;
diff --git a/packages/app/static/css/smyth-components.css b/packages/app/static/css/smyth-components.css
index 74de7de3..9aadbf96 100644
--- a/packages/app/static/css/smyth-components.css
+++ b/packages/app/static/css/smyth-components.css
@@ -50,7 +50,6 @@
height: 60px;
}
-
.component.Async .output-endpoint:not(.default) .name .label::before {
content: '[ async ]';
font-size: 10px;
@@ -268,4 +267,157 @@
.Note .note-markdown li {
display: list-item !important;
-}
\ No newline at end of file
+}
+
+/*Trigger styles*/
+
+.component.Trigger {
+ min-height: 100px;
+ min-width: 280px;
+ border-radius: 100px 10px 10px 100px;
+}
+
+.component.Trigger .internal-name {
+ padding-left: 40px;
+}
+
+.component.Trigger .title-bar-top {
+ height: 100px;
+}
+.debug-enabled .component.Trigger .debug-bar {
+ position: absolute;
+ width: calc(100% - 85px);
+ margin-left: 85px !important;
+ margin-top: 10px;
+}
+.component.Trigger .title-bar {
+ padding-top: 0px !important;
+ padding-bottom: 0px !important;
+ position: absolute !important;
+ top: 0 !important;
+ left: 0 !important;
+ width: 100% !important;
+ height: 100% !important;
+}
+.component.Trigger .title-bar .title {
+ position: absolute;
+ bottom: 0px;
+ margin-left: 100px;
+ padding: 5px 0px;
+ color: #888;
+}
+.component.Trigger .title-bar .icon {
+ border-radius: 100px 10px 10px 100px;
+ padding: 10px;
+}
+.component.Trigger .title-bar .icon img {
+ height: 100%;
+ padding: 5px 0px;
+}
+
+.component.Trigger .ep-control.inputs {
+ display: none !important;
+ visibility: hidden !important;
+}
+.component.Trigger .ep-control.outputs {
+ background: transparent !important;
+ position: absolute;
+ top: 4px;
+ right: -163px;
+ z-index: 1;
+}
+
+.component.Trigger .output-container {
+ position: absolute;
+ background: white;
+ width: 150px;
+ right: -160px;
+ top: -10px;
+ padding: 30px 0px 10px 0px;
+ border: 1px solid #ccc;
+ border-radius: 10px;
+}
+.component.Trigger .output-container::before {
+ content: 'Payload';
+ position: absolute;
+ top: 0px;
+ right: 43px;
+ font-size: 16px;
+ font-weight: 700;
+ color: #ccc;
+}
+
+.collapsed.component.Trigger .output-container {
+ opacity: 1;
+ right: unset;
+ position: relative;
+ left: calc(100% - 142px);
+ border: 0px;
+ overflow: visible;
+ background: transparent;
+}
+.collapsed.component.Trigger .output-container::after {
+ content: ' ';
+ display: block;
+ background: #91df3f;
+ position: absolute;
+ right: -2px;
+ width: 20px;
+ height: 20px;
+ border-radius: 10px;
+ top: 18px;
+}
+.collapsed.component.Trigger .output-container::before {
+ right: 40px;
+ top: -26px;
+}
+
+.component.Trigger .output-container button.toggle-output-container {
+ position: absolute;
+ top: 0px;
+ right: 130px;
+}
+
+.collapsed.component.Trigger .output-container button.toggle-output-container {
+ top: -25px;
+ right: -110px;
+ left: 0px;
+}
+
+.component.Trigger .output-container button.toggle-output-container:hover {
+ scale: 1.2;
+}
+
+/*
+.component.Trigger .output-endpoint button {
+ visibility: hidden !important;
+ display: none !important;
+ width: 0px !important;
+ height: 0px !important;
+ padding: 0px !important;
+ margin: 0px !important;
+ border: 0px !important;
+ opacity: 0 !important;
+ pointer-events: none !important;
+ cursor: default !important;
+ user-select: none !important;
+}
+*/
+.component.Trigger .output-endpoint .name {
+ width: 100%;
+}
+.component.Trigger .output-endpoint .name .label {
+ color: #55ad26;
+}
+
+.component.Trigger .output-container {
+ margin-top: 10px;
+}
+
+.component.Trigger .cpt-overlay {
+ border-radius: 100px 10px 10px 100px !important;
+}
+
+.component.Trigger .cpt-overlay .content {
+ margin: 0px 0px !important;
+}
diff --git a/packages/app/static/img/triggers/gmail.svg b/packages/app/static/img/triggers/gmail.svg
new file mode 100644
index 00000000..47b9cf57
--- /dev/null
+++ b/packages/app/static/img/triggers/gmail.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg xmlns="http://www.w3.org/2000/svg"
+aria-label="Gmail" role="img"
+viewBox="0 0 512 512"><rect
+width="512" height="512"
+rx="15%"
+fill="#ffffff"/><path d="M158 391v-142l-82-63V361q0 30 30 30" fill="#4285f4"/><path d="M 154 248l102 77l102-77v-98l-102 77l-102-77" fill="#ea4335"/><path d="M354 391v-142l82-63V361q0 30-30 30" fill="#34a853"/><path d="M76 188l82 63v-98l-30-23c-27-21-52 0-52 26" fill="#c5221f"/><path d="M436 188l-82 63v-98l30-23c27-21 52 0 52 26" fill="#fbbc04"/></svg>
\ No newline at end of file
diff --git a/packages/app/static/img/triggers/job-scheduler.svg b/packages/app/static/img/triggers/job-scheduler.svg
new file mode 100644
index 00000000..22cdd6a7
--- /dev/null
+++ b/packages/app/static/img/triggers/job-scheduler.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg fill="#000000" width="800px" height="800px" viewBox="0 0 24 24" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg">
+<path d="M9,24H1a1,1,0,0,1,0-2H9a1,1,0,0,1,0,2Z
+M7,20H1a1,1,0,0,1,0-2H7a1,1,0,0,1,0,2Z
+M5,16H1a1,1,0,0,1,0-2H5a1,1,0,0,1,0,2Z
+M13,23.955a1,1,0,0,1-.089-2A10,10,0,1,0,2.041,11.09a1,1,0,0,1-1.992-.18A12,12,0,0,1,24,12,11.934,11.934,0,0,1,13.09,23.951C13.06,23.954,13.029,23.955,13,23.955Z
+M12,6a1,1,0,0,0-1,1v5a1,1,0,0,0,.293.707l3,3a1,1,0,0,0,1.414-1.414L13,11.586V7A1,1,0,0,0,12,6Z"/></svg>
\ No newline at end of file
diff --git a/packages/app/static/img/triggers/whatsapp.svg b/packages/app/static/img/triggers/whatsapp.svg
new file mode 100644
index 00000000..1636ec0f
--- /dev/null
+++ b/packages/app/static/img/triggers/whatsapp.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ viewBox="0 0 58 58" xml:space="preserve">
+<g>
+ <path style="fill:#2CB742;" d="M0,58l4.988-14.963C2.457,38.78,1,33.812,1,28.5C1,12.76,13.76,0,29.5,0S58,12.76,58,28.5
+ S45.24,57,29.5,57c-4.789,0-9.299-1.187-13.26-3.273L0,58z"/>
+ <path style="fill:#FFFFFF;" d="M47.683,37.985c-1.316-2.487-6.169-5.331-6.169-5.331c-1.098-0.626-2.423-0.696-3.049,0.42
+ c0,0-1.577,1.891-1.978,2.163c-1.832,1.241-3.529,1.193-5.242-0.52l-3.981-3.981l-3.981-3.981c-1.713-1.713-1.761-3.41-0.52-5.242
+ c0.272-0.401,2.163-1.978,2.163-1.978c1.116-0.627,1.046-1.951,0.42-3.049c0,0-2.844-4.853-5.331-6.169
+ c-1.058-0.56-2.357-0.364-3.203,0.482l-1.758,1.758c-5.577,5.577-2.831,11.873,2.746,17.45l5.097,5.097l5.097,5.097
+ c5.577,5.577,11.873,8.323,17.45,2.746l1.758-1.758C48.048,40.341,48.243,39.042,47.683,37.985z"/>
+</g>
+</svg>
\ No newline at end of file