Can't access bot in custom Action

I simply tried to do console.log(bot) in my action but I get a

ReferenceError: bot is not defined

But from what I can read in the documentation about Actions, it should be available alongside other arguments (other arguments that I am able to access).

I tried to look at the Memory section but it’s unclear why this occurs.

(also the System Parameters part in the doc is not rendering as intended)

Hi @vgalisson

Can you show us the complete file of that action?

When you return a function in your action, you need to pass the globals to that function. What about the other globals, are those defined?


Weirdly I am able to access temp or session but not bot.

My file is just


Nothing before except comments and nothing after.

The Stack Trace is :

09:37:29.828 ActionService An error occurred while executing the action "recherche/searchValue [ ReferenceError, bot is not defined]
ReferenceError: bot is not defined
at Object. (vm.js:10:14)
at (C:\snapshot\build-windows\node_modules\vm2\lib\main.js:428:23)
at runInVm.Promise (C:\snapshot\build-windows\out\bp\core\services\action\vm.js:0:0)
at Promise._execute (~\botpress\modules.cache\module__413477195fa0b06d25e9a1bf929d1d2f3db1cef40a689f5fe961392dfcddc8ee\node_production_modules\bluebird\js\release\debuggability.js:313:9)
at Promise._resolveFromExecutor (~\botpress\modules.cache\module__413477195fa0b06d25e9a1bf929d1d2f3db1cef40a689f5fe961392dfcddc8ee\node_production_modules\bluebird\js\release\promise.js:483:18)
at new Promise (~\botpress\modules.cache\module__413477195fa0b06d25e9a1bf929d1d2f3db1cef40a689f5fe961392dfcddc8ee\node_production_modules\bluebird\js\release\promise.js:79:10)
at VmRunner.runInVm (C:\snapshot\build-windows\out\bp\core\services\action\vm.js:0:0)
at ScopedActionService. (C:\snapshot\build-windows\out\bp\core\services\action\action-service.js:0:0)
at ()
at fulfilled (C:\snapshot\build-windows\out\bp\core\services\action\action-service.js:0:0)

Same here.

botpress_1 | 03/04/2020 09:18:17.840 ActionService An error occurred while executing the action "my-hitl/need-attention [ReferenceError, bot is not defined]

While bp and user, args, are accessible.

is documentation is outdated?

note : to anyone needing the botId, you can take in event.botId.

The variable will be set if there’s a KVS entry for the bot named “global”. The documentation seems a bit off, since there no “bot” variable right now (only

1 Like