-
Notifications
You must be signed in to change notification settings - Fork 43
API Namespace plugin: subdomain events V1
Shashike Jayatunge edited this page Jul 3, 2022
·
4 revisions
To understand what a plugin is, please see more on the API system
Subdomain events version 1 is a service that uses the subdomain/event API Namespace to:
- Save events that happen on a subdomain (eg: email recieved, forum thread/post created etc)
- Trigger events based on the above events
To install, simply create the API Namespace object as you see here. This can be done through the web console:
For your convenience the following one liner has been created:
Apartment::Tenant.switch('schema'){ ApiNamespace.create!(name: 'subdomain/event',slug: 'subdomain_events',version: 1,requires_authentication: true,namespace_type: 'create-read-update-delete',properties: { model_definition: {record_id: {type: "integer",validations: {allow_blank: false,primary_key: true,unique: true}},record_type: {type: "string",validations: {allow_blank: false}}}}) }
Since the create action is fired on the subdomain/events namespace, we can use it to talk to external services and do a variety of things. See here for an on how to send a message to discord