1. Home
  2. Docs
  3. Developers
  4. Develop custom packages
  5. Service templates

Service templates

Templates are slightly more complex than intents, entities, and functions. Templates are stored in .json files, the same as intents are, and the loading mechanism is similar. Place your .json file in the same directory as your package definition. Instead of having to implement a specific interface or override a method, you load the template file in the constructor for your package.

Use $this->addTemplate($this->_loadFile(‘Path/To/Package/template.json’)) to load your template file.

A template consists of a couple of top level properties. These are its ID, name, description, and then the service definition which is much more complex.

The template ID can be any string, but it must be prefixed with the namespace of the package it belongs to. For example, the default blank template is part of the core package. Its ID is “convo-core.blank“.

The name and description can be whatever you want, but it is recommended to keep it short and concise.

TODO: explain the structure of a service