Writing an adapter
An adapter publishes to one platform. It’s a Python package in its own repository, built with the RelaySMS Adapter SDK, which the Publisher runs in its own virtualenv and calls over JSON-RPC.
Requirements
- Python 3.12 or newer
- A GitHub repository
- A developer account and API credentials for the platform
Steps
-
Copy the SDK’s echo adapter into a new repository named after the platform and protocol, such as
example-oauth2-adapter. -
Subclass the SDK’s base class for its protocol, such as
OAuth2Adapter, and implement its methods (Write an adapter). -
Describe it in
adapter.toml: its name, protocol, category, and a[config]table for each setting (Describe it). -
Try it with the
relaysms-adapterconsole, which runs it the way the Publisher does (Try it). -
Tag a release, such as
v1.0.0(Release an adapter). -
Install it on a Publisher:
sudo ./publisher.sh platforms add https://github.com/<ORG>/<REPOSITORY> -
Set its settings with
sudo ./publisher.sh platforms config set <NAME> <KEY>=<VALUE>, orplatforms setup <NAME>if it has a setup (Settings).
Check it
sudo ./publisher.sh platforms list shows the adapter with its tag, and ✓ under Configured once its settings are set. Then link a test account from the RelaySMS app.
The adapters in the provider guides, such as gmail-oauth2-adapter, are complete examples.