Skip to main content

$injector

Data structure that contains a list of properties specified during deployment or upload of a script. Certain parameters are available in chatbot scripts through the $injector variable.

The structure is being filled with the data from a few sources and new data is being written over the previous ones.

Sequence of filling in:

  • Platform properties that are set during server building. Contain server version in the server.version parameter.
  • Host properties that are set during server deployment/startup.
  • Script properties that are set in the injector section of a chatbot.yaml by default. Later these properties can be reset by the properties that are set during script deployment.
  • Properties that are set during script deployment.
  • Properties that are set under the require tag during script upload. Determine configuration parameters for the required modules.

How to use

name: weather-api

entryPoint:
- main.sc

injector:
api_key: 'APPID'
//Receiving of an API key from the chatbot.yaml
var OPENWEATHERMAP_API_KEY = $injector.api_key;