It’s possible to specify the bot configuration in Node-RED settings.js
by-passing the configuration panel in Node-RED ui.
settings.js
in Node-RED home dir (usually ~./.node-red
) and locate the key functionGlobalContext
functionGlobalContext: {
// ...
telegram: {
'My Bot': {
token: '1234567:my-token',
polling: 1000,
parseMode: 'none',
}
}
},
Be sure to use the same name My Bot used in the configuration panel. 4. Restart Node-RED, the system console should confirm that RedBot is using a global configuration (or dump errors if the configuration is invalid) and the configuration panel in the UI should be disabled.
It’s possible to store multiple configurations in the key telegram: {}
and for all supported platforms using the right key (for example facebook: {}
)
The Telegram configuration:
Name | Type | Description |
---|---|---|
token | string | The access token from Telegram, is something like ‘xxxxx:yyyyyyyyyyyyyyyyyyyyyy’. Required. |
polling | number | Polling interval in milliseconds. Default 1000. |
usernames | string | Comma separated list of chatIds or username that are considered authorized in the chatbot |
logfile | string | Absolute path of the log file for the chatbot |
contextProvider | string | Which context provide to use, must be one of: memory, plain-file, sqlite |
contextParams | object | Params for the context provider |
debug | boolean | Show message debug in console |
Example
functionGlobalContext: {
// ...
telegram: {
'My Bot': {
token: '1234567:my-token',
polling: 1000,
parseMode: 'none',
contextProvider: 'plain-file',
contextParams: {
path: '/tmp/red-bot-contexts'
},
logfile: '/var/log/red-bot.logs'
}
}
}
The Facebook configuration:
Name | Type | Description |
---|---|---|
token | string | The access token, from the Facebok app page. Required. |
appSecret | string | The app secret, from the Facebok app page. Required. |
verifyToken | string | The verify token to verify the web hook. |
usernames | string | Comma separated list of chatIds or username that are considered authorized in the chatbot |
logfile | string | Absolute path of the log file for the chatbot |
contextProvider | string | Which context provide to use, must be one of: memory, plain-file, sqlite |
contextParams | object | Params for the context provider |
debug | boolean | Show message debug in console |
Example