Embedded Functions

Our Platform allows you to send embed functions written in node JS which allows you integrate third-party APIs directly inside your chatbot
let { ExtendedLogger } = require("@function-logger");
let logger = new ExtendedLogger("default", "bot_id", "functionNamespace");
module.exports = async (ctx) => {
let session = ctx.session;
let config = ctx.config;
let metadata = ctx.metadata;
let params = ctx.params;
let visitor = ctx.visitor;
return new Promise((resolve, reject) => {
//...your code goes here
resolve(ctx); //Always resolve ctx variable
Embedded functions as a services pass the conversation context (ctx) into your function allows to to return response, and process information that the chatbot has collected about the visitor and their sessions