Types of plug-ins¶
Tattler plug-ins can be either:
- Addressbook plug-ins
Allow you to give tattler information about a user (notification recipient).
- Context plug-ins
Allow you to give tattler data to fill out template variables.
- SMS backend plug-ins
Allow you to deliver SMS through a gateway that tattler does not support out of the box – or to add a whole new vector, by declaring a vector name of your own.
Tattler can operate both without and with plug-ins. You can also provide multiple plug-ins of each type.
Each type of plug-in is coded in python, by extending a class.
Plug-in interface¶
Regardless of the type, you provide any plug-in by placing a python script into a special folder.
This file must fulfill these requirements:
Be written in python.
Be placed in the folder pointed to by the TATTLER_PLUGIN_PATH configuration directive.
Be named with suffix
_tattler_plugin.py.- Name its classes uniquely:
No two plug-ins may define the same class name: tattler refuses to start on collision. Importing the same class into multiple plug-ins, e.g. a shared base class, is fine.
These class names are used by tattler’s built-in plug-ins, so they are reserved:
BulkGateBackend,BulkSMSBackend,PassThroughAddressbookPlugin.These file names are used by tattler’s built-in plug-ins, so they are reserved too:
bulkgate_tattler_plugin.py,bulksms_tattler_plugin.py,passthrough_addressbook_tattler_plugin.py.
- Contain one class which subclasses either:
class
AddressbookPluginif you are providing an Addressbook plug-in.class
ContextPluginif you are providing a Context plug-in.class
DeliveryBackendif you are providing an SMS backend plug-in.
So if you configure TATTLER_PLUGIN_PATH=foo/my_plugin_path, this directory may look like this:
foo/my_plugin_path/
├─ foo.py # <- will be ignored: wrong suffix
├─ users_tattler_plugin.py
└─ billing_tattler_plugin.py
Plug-in chains¶
For each type of plug-in you may provide zero, one or multiple plug-ins.
If you provide multiple plug-ins, they are processed in sequence, in the alphanumeric order of their class names.
Addressbook plug-ins are run in sequence until one provides any data.
Context plug-ins are run in sequence, and:
The first plug-in receives the native context generated by Tattler.
Each subsequent plug-in receives the context returned by its preceding plug-in.