• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Djblets 5.x
    2. Version 5.x
    3. Version 4.x
    4. Version 3.x
    5. Version 2.x
    6. Version 2.0
    7. Version 1.0
    8. Version 0.9
    9. Djblets Documentation
    10. Module and Class References
    11. djblets.integrations.integration
  • Home
  • Guides
  • Avatar Services Guides
  • Writing Avatar Services
  • Extension Guides
  • Writing Extensions
  • Testing Extensions
  • Feature Checks Guides
  • Introduction to Feature Checks
  • Writing Features
  • Writing Feature Checkers
  • Testing with Feature Checks
  • Integration Guides
  • Supporting Integrations
  • Writing Integrations
  • Privacy Compliance Guides
  • Getting and Checking Consent
  • Working with Personally Identifiable Information
  • Service Integrations
  • reCAPTCHA Guides
  • Using reCAPTCHA
  • Registries Guides
  • Writing Registries
  • Web API Guides
  • Writing Web API Resources
  • Adding OAuth2 Support
  • Module and Class References
  • djblets
  • djblets.deprecation
  • djblets.auth.forms
  • djblets.auth.ratelimit
  • djblets.auth.signals
  • djblets.auth.util
  • djblets.auth.views
  • djblets.avatars.errors
  • djblets.avatars.forms
  • djblets.avatars.registry
  • djblets.avatars.services
  • djblets.avatars.services.base
  • djblets.avatars.services.fallback
  • djblets.avatars.services.file_upload
  • djblets.avatars.services.gravatar
  • djblets.avatars.services.url
  • djblets.avatars.settings
  • djblets.cache.backend
  • djblets.cache.backend_compat
  • djblets.cache.context_processors
  • djblets.cache.errors
  • djblets.cache.forwarding_backend
  • djblets.cache.serials
  • djblets.cache.synchronizer
  • djblets.conditions
  • djblets.conditions.choices
  • djblets.conditions.conditions
  • djblets.conditions.errors
  • djblets.conditions.operators
  • djblets.conditions.values
  • djblets.configforms.forms
  • djblets.configforms.mixins
  • djblets.configforms.pages
  • djblets.configforms.registry
  • djblets.configforms.views
  • djblets.datagrid.grids
  • djblets.db.backends.mysql.base
  • djblets.db.fields
  • djblets.db.fields.base64_field
  • djblets.db.fields.comma_separated_values_field
  • djblets.db.fields.counter_field
  • djblets.db.fields.json_field
  • djblets.db.fields.modification_timestamp_field
  • djblets.db.fields.relation_counter_field
  • djblets.db.managers
  • djblets.db.query
  • djblets.db.query_catcher
  • djblets.db.query_comparator
  • djblets.db.validators
  • djblets.extensions.admin
  • djblets.extensions.errors
  • djblets.extensions.extension
  • djblets.extensions.forms
  • djblets.extensions.hooks
  • djblets.extensions.loaders
  • djblets.extensions.manager
  • djblets.extensions.middleware
  • djblets.extensions.models
  • djblets.extensions.packaging
  • djblets.extensions.resources
  • djblets.extensions.settings
  • djblets.extensions.signals
  • djblets.extensions.staticfiles
  • djblets.extensions.testing
  • djblets.extensions.testing.testcases
  • djblets.extensions.urls
  • djblets.extensions.views
  • djblets.extensions.templatetags.djblets_extensions
  • djblets.features
  • djblets.features.checkers
  • djblets.features.decorators
  • djblets.features.errors
  • djblets.features.feature
  • djblets.features.level
  • djblets.features.registry
  • djblets.features.testing
  • djblets.features.templatetags.features
  • djblets.forms.fields
  • djblets.forms.fieldsets
  • djblets.forms.forms
  • djblets.forms.forms.key_value_form
  • djblets.forms.widgets
  • djblets.gravatars
  • djblets.gravatars.templatetags.gravatars
  • djblets.http.middleware
  • djblets.http.responses
  • djblets.integrations.errors
  • djblets.integrations.forms
  • djblets.integrations.hooks
  • djblets.integrations.integration
  • djblets.integrations.manager
  • djblets.integrations.mixins
  • djblets.integrations.models
  • djblets.integrations.urls
  • djblets.integrations.views
  • djblets.log
  • djblets.log.middleware
  • djblets.log.siteconfig
  • djblets.log.urls
  • djblets.log.views
  • djblets.mail.dmarc
  • djblets.mail.message
  • djblets.mail.testing
  • djblets.mail.utils
  • djblets.markdown
  • djblets.markdown.extensions.escape_html
  • djblets.markdown.extensions.wysiwyg
  • djblets.markdown.extensions.wysiwyg_email
  • djblets.pipeline.compilers.es6
  • djblets.pipeline.compilers.less
  • djblets.pipeline.compilers.mixins
  • djblets.pipeline.compilers.rollup
  • djblets.pipeline.compilers.typescript
  • djblets.pipeline.settings
  • djblets.privacy.consent
  • djblets.privacy.consent.base
  • djblets.privacy.consent.common
  • djblets.privacy.consent.errors
  • djblets.privacy.consent.forms
  • djblets.privacy.consent.hooks
  • djblets.privacy.consent.registry
  • djblets.privacy.consent.tracker
  • djblets.privacy.models
  • djblets.privacy.pii
  • djblets.privacy.templatetags.djblets_privacy
  • djblets.recaptcha.mixins
  • djblets.recaptcha.siteconfig
  • djblets.recaptcha.templatetags.djblets_recaptcha
  • djblets.recaptcha.widgets
  • djblets.registries
  • djblets.registries.errors
  • djblets.registries.importer
  • djblets.registries.mixins
  • djblets.registries.registry
  • djblets.registries.signals
  • djblets.secrets
  • djblets.secrets.crypto
  • djblets.secrets.token_generators
  • djblets.secrets.token_generators.base
  • djblets.secrets.token_generators.legacy_sha1
  • djblets.secrets.token_generators.registry
  • djblets.secrets.token_generators.vendor_checksum
  • djblets.siteconfig
  • djblets.siteconfig.admin
  • djblets.siteconfig.context_processors
  • djblets.siteconfig.django_settings
  • djblets.siteconfig.forms
  • djblets.siteconfig.managers
  • djblets.siteconfig.middleware
  • djblets.siteconfig.models
  • djblets.siteconfig.signals
  • djblets.siteconfig.views
  • djblets.template.caches
  • djblets.template.context
  • djblets.template.loaders.conditional_cached
  • djblets.template.loaders.namespaced_app_dirs
  • djblets.testing.decorators
  • djblets.testing.testcases
  • djblets.testing.testrunners
  • djblets.urls.context_processors
  • djblets.urls.decorators
  • djblets.urls.patterns
  • djblets.urls.resolvers
  • djblets.urls.root
  • djblets.urls.staticfiles
  • djblets.util.compat.django.core.cache
  • djblets.util.compat.python.past
  • djblets.util.contextmanagers
  • djblets.util.dates
  • djblets.util.decorators
  • djblets.util.filesystem
  • djblets.util.functional
  • djblets.util.html
  • djblets.util.http
  • djblets.util.humanize
  • djblets.util.json_utils
  • djblets.util.properties
  • djblets.util.serializers
  • djblets.util.symbols
  • djblets.util.templatetags.djblets_deco
  • djblets.util.templatetags.djblets_email
  • djblets.util.templatetags.djblets_forms
  • djblets.util.templatetags.djblets_images
  • djblets.util.templatetags.djblets_js
  • djblets.util.templatetags.djblets_utils
  • djblets.util.typing
  • djblets.util.views
  • djblets.views.generic.base
  • djblets.views.generic.etag
  • djblets.webapi.auth
  • djblets.webapi.auth.backends
  • djblets.webapi.auth.backends.api_tokens
  • djblets.webapi.auth.backends.base
  • djblets.webapi.auth.backends.basic
  • djblets.webapi.auth.backends.oauth2_tokens
  • djblets.webapi.auth.views
  • djblets.webapi.decorators
  • djblets.webapi.encoders
  • djblets.webapi.errors
  • djblets.webapi.fields
  • djblets.webapi.managers
  • djblets.webapi.models
  • djblets.webapi.oauth2_scopes
  • djblets.webapi.resources
  • djblets.webapi.resources.base
  • djblets.webapi.resources.group
  • djblets.webapi.resources.registry
  • djblets.webapi.resources.root
  • djblets.webapi.resources.user
  • djblets.webapi.resources.mixins.api_tokens
  • djblets.webapi.resources.mixins.forms
  • djblets.webapi.resources.mixins.oauth2_tokens
  • djblets.webapi.resources.mixins.queries
  • djblets.webapi.responses
  • djblets.webapi.signals
  • djblets.webapi.testing
  • djblets.webapi.testing.decorators
  • djblets.webapi.testing.testcases
  • General Index
  • Python Module Index
  • Release Notes
  • djblets.integrations.integration¶

    Base support for creating service integrations.

    class Integration(integration_mgr: IntegrationManager)[source]¶

    Bases: object

    Base class for an integration.

    Integrations are pluggable components that interface the application with a third-party service, notifying the service or triggering actions on certain events, or fetching data from the service. They can be registered by the consuming application or through extensions.

    Unlike an extension, an integration can contain multiple configurations active at one time. An example would be when you want multiple, distinct configurations for posting messages to different channels on a chat service.

    There’s one Integration instance for each class, and it typically operates by responding to events and communicating with another service, making use of the state stored in one or more BaseIntegrationConfig instances, which it can query. This allows hook registration and other logic to be shared across all configurations of an instance.

    Integrations can make use of extension hooks, binding the lifecycle of that hook’s registration to the lifecycle of that particular integration, making it very easy to tie an integration into any part of the application.

    integration_id: ClassVar[Optional[str]] = None¶

    The unique identifier of the integration.

    This identifier cannot collide with other integrations, and thus should contain some unique information, such as a vendor name.

    If not set, this will default to the full class path for the integration subclass.

    name: ClassVar[Optional[StrOrPromise]] = None¶

    The display name of the integration.

    description: ClassVar[Optional[StrOrPromise]] = None¶

    A short description of this integration, in plain text format.

    icon_static_urls: ClassVar[dict[str, str]] = {}¶

    Static paths for the integration’s icon.

    This is a dictionary that maps icon resolution indicators to URLs or relative static media paths. It must contain a 1x key, and can contain 2x, 3x, and other sizes. For now, only 1x and 2x are used.

    Each value must be a URL reachable by the browser, whether an absolute URL or a path relative to the root of the web server.

    The base 1x icon itself is expected to be 48x48. The other sizes are expected to be multiples of this size.

    If the paths need to be computed (through a call to static() or get_static_url(), it is best to declare this as a method and use cached_property().

    Example

    def get_icon_urls(self):
        return {
            '1x': self.extension.get_static_url('logo.png'),
            '2x': self.extension.get_static_url('logo@2x.png'),
        }
    
    default_settings: ClassVar[dict[str, object]] = {}¶

    Default settings for any configurations on this extension.

    If a setting hasn’t been explicitly saved in a configuration, it will use the default from here, if available.

    config_form_cls¶

    The form class for handling integration configuration.

    alias of IntegrationConfigForm

    config_template_name: ClassVar[Optional[str]] = None¶

    The template name used for the configuration page.

    __init__(integration_mgr: IntegrationManager) → None[source]¶

    Construct the integration.

    Implementations of an integration should generally not override this. Instead, they should implement initialize().

    Parameters:

    integration_mgr (djblets.integrations.manager.IntegrationManager) – The integration manager that manages this integration.

    integration_mgr: IntegrationManager¶

    The integration manager that’s managing this integration.

    hooks: set[ExtensionHook]¶

    The hooks currently registered by the integration.

    enabled: bool¶

    Whether the extension is currently enabled.

    property id: Optional[str][source]¶

    The ID of the integration.

    This is an alias around integration_id, meant to provide compatibility with an extension’s id attribute.

    enable_integration() → None[source]¶

    Enable this integration.

    This will initialize the integration, if not already enabled, allowing it to listen to signals and register hooks.

    disable_integration() → None[source]¶

    Disable this integration.

    This will shut down the integration, if not already disabled, cleaning up any signal handlers or hooks it registered.

    initialize() → None[source]¶

    Initialize the integration.

    Integration implementation subclasses must override this to provide any initialization needed for the integration, including signal and hook registration.

    This should only be called from enable_integration().

    shutdown() → None[source]¶

    Shut down the integration.

    Integration implementation subclasses can override this to perform any cleanup work for the integration. It will be called when shutting down the integration.

    By default, this doesn’t do anything. Subclasses do not need to call the parent method.

    shutdown_hooks() → None[source]¶

    Shut down all the hooks for the integration.

    By default, this is called when calling shutdown().

    __annotations__ = {'config_form_cls': 'ClassVar[type[IntegrationConfigForm]]', 'config_template_name': 'ClassVar[Optional[str]]', 'default_settings': 'ClassVar[dict[str, object]]', 'description': 'ClassVar[Optional[StrOrPromise]]', 'enabled': 'bool', 'hooks': 'set[ExtensionHook]', 'icon_static_urls': 'ClassVar[dict[str, str]]', 'integration_id': 'ClassVar[Optional[str]]', 'integration_mgr': 'IntegrationManager', 'name': 'ClassVar[Optional[StrOrPromise]]'}¶
    get_configs(**filter_kwargs) → Sequence[BaseIntegrationConfig][source]¶

    Return configurations matching the given filters.

    By default, all enabled configurations will be returned for this integration. This can be filtered down by specifying fields in the model and their values through keyword arguments.

    Each set of results for a unique combination of integration class and filter arguments will be cached locally, to speed up further lookups.

    Parameters:

    **filter_kwargs (dict, optional) – Keyword arguments to filter by. Each must match a field and value on the model.

    Returns:

    A list of enabled integration configurations matching the query.

    Return type:

    list of djblets.integrations.models.BaseIntegrationConfig

    create_config(save: bool = False, **kwargs) → BaseIntegrationConfig[source]¶

    Create a configuration for this integration.

    This will create a brand new configuration for this integration, with fields populated by the provided keyword arguments. The object created will be based on the djblets.integrations.manager.IntegrationManager.config_model attribute.

    By default, this configuration won’t be automatically saved to the database. The caller can pass save=True to change this behavior. Otherwise, it’s the caller’s responsibility to save the configuration.

    Subclasses can override this to provide additional defaults or state.

    Parameters:
    • save (bool, optional) – Whether to immediately save the new configuration. Defaults to False.

    • **kwargs (dict) – Values for fields on the configuration model.

    Returns:

    The new integration configuration instance.

    Return type:

    djblets.integrations.models.BaseIntegrationConfig

    IntegrationClassType¶

    A type alias for an integration class.

    New in version 3.3.

    alias of Type[Integration]

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • Integration
      • Integration.integration_id
      • Integration.name
      • Integration.description
      • Integration.icon_static_urls
      • Integration.default_settings
      • Integration.config_form_cls
      • Integration.config_template_name
      • Integration.__init__()
      • Integration.integration_mgr
      • Integration.hooks
      • Integration.enabled
      • Integration.id
      • Integration.enable_integration()
      • Integration.disable_integration()
      • Integration.initialize()
      • Integration.shutdown()
      • Integration.shutdown_hooks()
      • Integration.__annotations__
      • Integration.get_configs()
      • Integration.create_config()
    • IntegrationClassType