Messengers make use of a config.json file, that defines basic configuration settings for the messenger.
Configuration Format
Example
/components/messengers/my_messenger/config.json
{ "version": "1.0.0", "name": "My Messenger Name", "description": "Send notifications via SMS!", "authors": [ { "name": "Phillips Data, Inc.", "url": "http://www.blesta.com" } ], "types": [ "sms" ] }
Definition
Option | Description | ||||||
---|---|---|---|---|---|---|---|
version | The version of the messenger. This should be a semantic version number. | ||||||
name | The name of the messenger. This may also be a language definition. | ||||||
description | A brief description of the messenger. This may also be a language definition. | ||||||
authors | An array of author objects.
| ||||||
logo | The path within the module to the logo file. If not set, defaults to views/default/images/logo.png. | ||||||
types | An array of strings representing each type of communication supported by the messenger. At the moment the only type of communication supported by Blesta is "sms". |
Using the Configuration
To use the configuration file you must include it within the constructor of your messenger using the loadConfig() method.
/components/messengers/my_messenger/my_messenger.php
<?php class MyMessenger extends Messenger { public function __construct() { // Load configuration required by this messenger $this->loadConfig(dirname(__FILE__) . DS . 'config.json'); } } ?>
If your configuration uses any language definitions, be sure to include those before loading the config.
/components/messengers/my_messenger/my_messenger.php
<?php class MyMessenger extends Messenger { public function __construct() { // Load the language required by this messenger Language::loadLang("my_module", null, dirname(__FILE__) . DS . "language" . DS); // Load configuration required by this messenger $this->loadConfig(dirname(__FILE__) . DS . "config.json"); } } ?>