A snap-in platform manages snap-in packages and installs snap-ins. It enables snap-ins to register, validate, and deploy functions, creating other DevRev objects, registering events/webhooks, and triggering actions enriched by context.
Snap-ins are collections of objects that extend DevRev's core platform value. These objects include automation, event sources, keyrings, custom types, vistas, etc. With snap-ins, developers can develop at "arms-length" and without making any changes to DevRev's core platform.
Snap-in developers interact with DevRev objects through APIs, get updates on DevRev objects through webhooks, and register an event source to subscribe to GitHub/Slack/any external events.
A snap-in package is a collection of DevRev objects and their relationships that describe the functionality of the developed snap-in. It doesn't reference an object within the installer's dev org. It's a parent object collecting snap-in package versions.
A snap-in version is the definition of a snap-in. It doesn't belong to any dev org. It's equivalent to a snap-in source code. When a snap-in version is installed, it requires certain inputs from the installer, such as a PAT for GitHub, registering a URL on Bitbucket or some configuration, etc.
The snap-in developer can specify some input configurations that the installer can use to customize the snap-in.
In automation, the event source is linked to a function, so whenever an event occurs on that event source, the function is triggered and the event payload is passed along. All keyrings configured by the installer are included in the payload passed to the functions, along with developer-level tokens.
A connection uses a keyring object to provide authentication, access token refreshment, and secret storage (access token, refresh token, PAT, API key, etc.). Upon creating the connection, the platform automatically refreshes the OAuth access token whenever necessary. Objects can reference secrets to access external or DevRev-protected APIs. The platform may use a connection to automatically register the webhook URL with an external source. Automations may also use connections to pass secret values to corresponding functions.
Event sources collect events from webhooks, emails, and timer-based API calls. Events can also be manually published. DevRev supports the ingestion of webhooks from any source. Each event source is assigned to a dev org.
For example, if you want to collect webhook events from an organization's GitHub, create an event source which in turn gives us a URL to subscribe to on GitHub. Webhook events published to this URL are available from this event source.
Connection values can be passed to a function at runtime, enabling it to execute API calls to DevRev and to external systems such as GitHub, Slack, Bitbucket, and Discord.
Snap-ins can be configured to enable and disable features, based on custom inputs defined by the developer and provided by the installer.
A user can trigger commands on different surfaces based on some parameters. Once a command is executed, a function is triggered.
A developer can develop commands to be included in a snap-in Version along with associated functions. These commands are installed when the snap-in is installed.
As part of the snap-in, commands have access to keyrings, global variables, and event sources.
Hooks enable developers to invoke functions when various events in the lifecycle of a snap-in occur. Hooks can be used to perform various actions based on the event such as validating the snap-in inputs and keyrings when the configuration is updated, registering event-sources and webhooks in external platforms when snap-in is activated, or setting custom fields to be used by the snap-in.
Detailed documentation on hooks can be found in the hooks reference.
The snap-in can have the following states:
- DRAFT: The snap-in installation is in progress and the event-sources, automations, and commands aren't created yet.
- ACTIVATING: The snap-in is being activated, and the automations, commands, and snap-kit actions are paused. The snap-in can't be updated in this state.
- ACTIVE: The snap-in is functioning, and the automations, commands, and snap-kit actions can be invoked.
- ERROR: The snap-in isn't functioning, and the automations, commands, and snap-kit actions are paused. This state can be reached in case of any misconfiguration of the snap-in (such as invalid keyrings or inputs) or failure to activate the snap-in.
- DEACTIVATING: The snap-in is being deactivated, and the automations, commands, and snap-kit actions are paused. The snap-in can't be updated in this state.
- INACTIVE: The snap-in is paused by the user, and the automations, commands, and snap-kit actions are paused.
ACTIVATING and DEACTIVATING are transitory states and background processes and hooks move the snap-in from these states to a stable state.
The following diagram illustrates the transitions between different states.
Snap-kit defines UI customization components. It's defined in the snap-in package and used to display developer-defined components. A snap-kit component can display data to a user or collect input for triggering a function.
The marketplace is a portal where DevRev and external developers can publish snap-ins and other extensions.
Similarly, developers can use private marketplaces to publish their own custom snap-ins that are scoped to their dev org.
The developer's dev org is responsible for publishing the snap-in to the marketplace. The publisher is responsible for supporting snap-in users.
Installers install the snap-in, provide configuration inputs, set up the necessary keyrings, and configure webhooks for external apps.