| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /**
- * @node get-trigger
- * @name GET Trigger
- * @category triggers
- * @version 1.0.0
- * @description Triggers workflow on HTTP GET request to webhook endpoint
- * @trigger
- * @icon globe
- */
- const configSchema = {
- type: 'object',
- properties: {
- path: {
- type: 'string',
- title: 'Path Filter',
- description: 'Optional path suffix to match (e.g., /status). Leave empty to match any path.',
- default: ''
- },
- requireAuth: {
- type: 'boolean',
- title: 'Require Authentication',
- description: 'Require API key in request header',
- default: false
- },
- apiKeyHeader: {
- type: 'string',
- title: 'API Key Header',
- description: 'Header name containing the API key',
- default: 'X-API-Key',
- 'x-if': 'requireAuth'
- },
- apiKey: {
- type: 'string',
- title: 'API Key',
- description: 'Expected API key value',
- format: 'password',
- 'x-if': 'requireAuth'
- }
- }
- };
- const inputSchema = {
- type: 'object',
- properties: {}
- };
- const outputSchema = {
- type: 'object',
- properties: {
- method: {
- type: 'string',
- description: 'HTTP method (GET)'
- },
- path: {
- type: 'string',
- description: 'Request path after /webhook/{workflow_id}'
- },
- query: {
- type: 'object',
- description: 'Query parameters as key-value pairs'
- },
- headers: {
- type: 'object',
- description: 'Request headers as key-value pairs'
- },
- timestamp: {
- type: 'number',
- description: 'Unix timestamp when request was received'
- },
- clientIp: {
- type: 'string',
- description: 'Client IP address'
- }
- }
- };
- async function execute(config, input, context) {
- smartbotic.log.info('GET trigger activated');
- // The trigger data comes from the webhook controller
- const triggerData = context.triggerData || {};
- return {
- method: triggerData.method || 'GET',
- path: triggerData.path || '',
- query: triggerData.query || {},
- headers: triggerData.headers || {},
- timestamp: Date.now(),
- clientIp: triggerData.clientIp || ''
- };
- }
- module.exports = { configSchema, inputSchema, outputSchema, execute };
|