UNPKG

@apidaze/node-red-contrib-apidaze

Version:
25 lines (17 loc) 548 B
module.exports = function (RED) { 'use strict'; function RecordingProcessor(config) { RED.nodes.createNode(this, config); this.on('input', (msg, send) => { const { payload } = msg; const { hookType, body, file } = payload; if (hookType !== 'recording' && !file) return null; msg.payload.call = body; if (file) { msg.payload.file.binary = msg.payload.file.buffer.toString('base64'); } send(msg); }); } RED.nodes.registerType('recording-processor', RecordingProcessor); };