Built-ins
IMProviderDefinition
Describe a messaging provider’s setup, identity, and adapter.
The definition ID matches the adapter’s provider_key. The definition describes setup and intended capabilities. The adapter validates the connected account and determines which features are available for that connection.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable ID used in connection and conversation records. |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
display_name | str | Promise | Required | Name shown in the connection editor. |
icon | str | Required | Icon shown for this provider. |
address_field | str | Required | Identity field holding the provider address. |
adapter_class | type[BaseIMAdapter] | Required | Class that implements the provider's messaging transport. |
description | str | Promise | '' | Summary of the provider's supported messaging integration. |
auth_mode | Literal['internal', 'embedded_signup', 'oauth'] | 'internal' | How users establish a provider connection. |
planned_capabilities | IMCapabilities | Factory: IMCapabilities | Capabilities declared by the integration design. |
selection_steps | tuple[IMSelectionStep, ...] | () | Steps for selecting an existing provider identity or conversation. |
creation_actions | tuple[IMCreationAction, ...] | () | Actions that create a provider conversation or contact. |
start_handler | IMStartHandler | str | '' | Callback or import path for starting a conversation. |
send_handler | Union[Annotated[IMSendHandler, SkipValidation()], str] | '' | Callback or import path for sending a message. |
actions_resolver | IMActionsResolver | str | '' | Callback or import path for resolving available actions. |
identity_label_resolver | IMIdentityLabelResolver | str | '' | Callback or import path for formatting provider identities. |
timeline_sources | tuple[IMTimelineSource, ...] | () | Configured sources of timeline events. |
calling | IMCallingDefinition | None | None | Optional calling configuration for the provider. |
internal | bool | False | Whether the provider is used for BloomERP's internal messaging. |
transport_ready | bool | False | Whether the provider transport is ready to connect. |
config_schema | type[IMConnectionConfiguration] | IMConnectionConfiguration | Pydantic model used to validate provider connection settings. |
Register a draft messaging provider
Reuse the existing draft Slack adapter as a scaffold. The definition stays unavailable for transport while connection validation is being implemented.
from bloomerp.communication.builtins.instant_messaging.builtins.slack import SlackAdapter, SlackConnectionConfiguration
from bloomerp.communication.builtins.instant_messaging.definition import IMProviderDefinition
from bloomerp.communication.builtins.instant_messaging.registry import IM_PROVIDER_REGISTRY
class ReviewChatAdapter(SlackAdapter):
'''Identify the draft adapter for the review chat integration.'''
provider_key = "example_review_chat"
review_chat = IMProviderDefinition(
id=ReviewChatAdapter.provider_key,
display_name="Review chat",
icon="fa-solid fa-comments",
address_field="id",
adapter_class=ReviewChatAdapter,
config_schema=SlackConnectionConfiguration,
transport_ready=False,
)
IM_PROVIDER_REGISTRY.register("EXAMPLE_REVIEW_CHAT", review_chat)Add a field to the messaging setup form
Use a connection schema subclass to collect an extra setting. The adapter can read it from the validated connection configuration.
from pydantic import Field
from bloomerp.communication.builtins.instant_messaging.builtins.slack import SlackAdapter, SlackConnectionConfiguration
from bloomerp.communication.builtins.instant_messaging.definition import IMProviderDefinition
from bloomerp.communication.builtins.instant_messaging.registry import IM_PROVIDER_REGISTRY
class SupportChatSettings(SlackConnectionConfiguration):
'''Collect the channel that belongs to the support team.'''
support_channel: str = Field(min_length=1, title="Support channel")
class SupportChatAdapter(SlackAdapter):
'''Identify the draft adapter for support chat connections.'''
provider_key = "example_support_chat"
support_chat = IMProviderDefinition(
id=SupportChatAdapter.provider_key,
display_name="Support chat",
icon="fa-solid fa-headset",
address_field="id",
adapter_class=SupportChatAdapter,
config_schema=SupportChatSettings,
transport_ready=False,
)
IM_PROVIDER_REGISTRY.register("EXAMPLE_SUPPORT_CHAT", support_chat)Bloomerp
ID internal · Lookup ID INTERNAL
Native staff conversations, groups, quotes and threads.
| Field | Value |
|---|---|
icon | fa-solid fa-comment-dots |
address_field | email |
auth_mode | internal |
start_handler | bloomerp.communication.builtins.instant_messaging.selection.start_staff |
internal | True |
transport_ready | True |
IMConnectionConfiguration
Describe provider setup fields used by the shared connection wizard.
| Setting | Type | Default | Description |
|---|---|---|---|
name | str | Required | Minimum length: 1Maximum length: 255 |
ID whatsapp · Lookup ID WHATSAPP
Business messaging through an authorized phone endpoint.
| Field | Value |
|---|---|
icon | fa-brands fa-whatsapp |
address_field | phone |
auth_mode | embedded_signup |
start_handler | bloomerp.communication.builtins.instant_messaging.selection.start_external |
internal | False |
transport_ready | False |
WhatsAppConnectionConfiguration
Typed setup fields for the whatsapp connection wizard.
| Setting | Type | Default | Description |
|---|---|---|---|
name | str | Required | Minimum length: 1Maximum length: 255 |
business_account_id | str | Required | Maximum length: 255Pattern: '^[0-9]+$' |
phone_number_id | str | Required | Maximum length: 255Pattern: '^[0-9]+$' |
access_token | pydantic.types.SecretStr | Required | Token for your WhatsApp Business account.Minimum length: 1 |
app_secret | pydantic.types.SecretStr | SecretStr('') | Used to verify incoming webhook signatures. |
webhook_verify_token | pydantic.types.SecretStr | SecretStr('') | Shared token for webhook verification. |
Slack
ID slack · Lookup ID SLACK
Workspace messaging with explicit bot or user authorization.
| Field | Value |
|---|---|
icon | fa-brands fa-slack |
address_field | username |
auth_mode | oauth |
start_handler | bloomerp.communication.builtins.instant_messaging.selection.start_external |
internal | False |
transport_ready | False |
SlackConnectionConfiguration
Typed setup fields for the slack connection wizard.
| Setting | Type | Default | Description |
|---|---|---|---|
name | str | Required | Minimum length: 1Maximum length: 255 |
workspace_id | str | Required | Minimum length: 1Maximum length: 255 |
bot_token | pydantic.types.SecretStr | Required | Minimum length: 1 |
signing_secret | pydantic.types.SecretStr | SecretStr('') | — |
Phone
ID phone · Lookup ID PHONE
| Field | Value |
|---|---|
icon | fa-solid fa-phone |
address_field | phone |
auth_mode | internal |
internal | True |
transport_ready | True |
IMConnectionConfiguration
Describe provider setup fields used by the shared connection wizard.
| Setting | Type | Default | Description |
|---|---|---|---|
name | str | Required | Minimum length: 1Maximum length: 255 |
