UNPKG

n8n-nodes-imobzi

Version:

Nodes para integração com a API da Imobzi no n8n

91 lines 3.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ImobziWebhook = void 0; const n8n_workflow_1 = require("n8n-workflow"); class ImobziWebhook { constructor() { this.description = { displayName: 'Imobzi Webhook', name: 'imobziWebhook', icon: 'file:webhook.svg', group: ['trigger'], version: 1, description: 'Recebe eventos da API Imobzi via Webhook', subtitle: '={{$parameter[\'event\']}}', defaults: { name: 'Imobzi Webhook', }, inputs: [], outputs: ['main'], credentials: [ { name: 'imobziApi', required: true, }, ], webhooks: [ { name: 'default', httpMethod: 'POST', responseMode: 'onReceived', path: 'imobzi/webhook', }, ], properties: [ { displayName: 'Eventos', name: 'event', type: 'multiOptions', options: [ { name: 'Contato Atualizado', value: 'contact.updated' }, { name: 'Contato Criado', value: 'contact.created' }, { name: 'Contrato Atualizado', value: 'contract.updated' }, { name: 'Contrato Criado', value: 'contract.created' }, { name: 'Documento Atualizado', value: 'document.updated' }, { name: 'Documento Criado', value: 'document.created' }, { name: 'Evento Atualizado', value: 'event.updated' }, { name: 'Evento Criado', value: 'event.created' }, { name: 'Imóvel Atualizado', value: 'property.updated' }, { name: 'Imóvel Criado', value: 'property.created' }, { name: 'Lead Atualizado', value: 'lead.updated' }, { name: 'Lead Criado', value: 'lead.created' }, { name: 'Tarefa Atualizada', value: 'task.updated' }, { name: 'Tarefa Criada', value: 'task.created' }, { name: 'Visita Agendada', value: 'visit.scheduled' }, { name: 'Visita Cancelada', value: 'visit.cancelled' }, ], default: [], description: 'Selecione os tipos de eventos para acionar o webhook', }, ], }; } async webhook() { const body = this.getRequestObject().body; if (!body || !body.event) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Formato de webhook inválido'); } return { workflowData: [ { json: { event: body.event, timestamp: body.timestamp, data: body.data, }, }, ], }; } async checkExists() { return true; } async create() { return true; } async delete() { return true; } } exports.ImobziWebhook = ImobziWebhook; //# sourceMappingURL=ImobziWebhook.node.js.map