- Created chatwoot-agent-bot/ with Node.js webhook server - Bot detects intent (greeting, billing, technical, features, account) - Auto-responds from FAQ knowledge base or escalates to human - FAQ-KB.md: Living knowledge base that grows with customer questions - CHATWOOT-SETUP.md: Complete deployment and configuration guide - Supports Telegram notifications on escalation - Bot runs on port 3001, ready for Chatwoot webhook integration
19 lines
417 B
JavaScript
19 lines
417 B
JavaScript
import utils from '../utils.js';
|
|
|
|
const callbackify = (fn, reducer) => {
|
|
return utils.isAsyncFn(fn)
|
|
? function (...args) {
|
|
const cb = args.pop();
|
|
fn.apply(this, args).then((value) => {
|
|
try {
|
|
reducer ? cb(null, ...reducer(value)) : cb(null, value);
|
|
} catch (err) {
|
|
cb(err);
|
|
}
|
|
}, cb);
|
|
}
|
|
: fn;
|
|
};
|
|
|
|
export default callbackify;
|