BloomERP

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.

SettingTypeDefaultDescription
idstrRequiredStable ID used in connection and conversation records.
documentationstr''Markdown and tagged examples included in the generated developer reference.
display_namestr | PromiseRequiredName shown in the connection editor.
iconstrRequiredIcon shown for this provider.
address_fieldstrRequiredIdentity field holding the provider address.
adapter_classtype[BaseIMAdapter]RequiredClass that implements the provider's messaging transport.
descriptionstr | Promise''Summary of the provider's supported messaging integration.
auth_modeLiteral['internal', 'embedded_signup', 'oauth']'internal'How users establish a provider connection.
planned_capabilitiesIMCapabilitiesFactory: IMCapabilitiesCapabilities declared by the integration design.
selection_stepstuple[IMSelectionStep, ...]()Steps for selecting an existing provider identity or conversation.
creation_actionstuple[IMCreationAction, ...]()Actions that create a provider conversation or contact.
start_handlerIMStartHandler | str''Callback or import path for starting a conversation.
send_handlerUnion[Annotated[IMSendHandler, SkipValidation()], str]''Callback or import path for sending a message.
actions_resolverIMActionsResolver | str''Callback or import path for resolving available actions.
identity_label_resolverIMIdentityLabelResolver | str''Callback or import path for formatting provider identities.
timeline_sourcestuple[IMTimelineSource, ...]()Configured sources of timeline events.
callingIMCallingDefinition | NoneNoneOptional calling configuration for the provider.
internalboolFalseWhether the provider is used for BloomERP's internal messaging.
transport_readyboolFalseWhether the provider transport is ready to connect.
config_schematype[IMConnectionConfiguration]IMConnectionConfigurationPydantic 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.

python
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.

python
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.

FieldValue
iconfa-solid fa-comment-dots
address_fieldemail
auth_modeinternal
start_handlerbloomerp.communication.builtins.instant_messaging.selection.start_staff
internalTrue
transport_readyTrue

IMConnectionConfiguration

Describe provider setup fields used by the shared connection wizard.

SettingTypeDefaultDescription
namestrRequiredMinimum length: 1Maximum length: 255

WhatsApp

ID whatsapp · Lookup ID WHATSAPP

Business messaging through an authorized phone endpoint.

FieldValue
iconfa-brands fa-whatsapp
address_fieldphone
auth_modeembedded_signup
start_handlerbloomerp.communication.builtins.instant_messaging.selection.start_external
internalFalse
transport_readyFalse

WhatsAppConnectionConfiguration

Typed setup fields for the whatsapp connection wizard.

SettingTypeDefaultDescription
namestrRequiredMinimum length: 1Maximum length: 255
business_account_idstrRequiredMaximum length: 255Pattern: '^[0-9]+$'
phone_number_idstrRequiredMaximum length: 255Pattern: '^[0-9]+$'
access_tokenpydantic.types.SecretStrRequiredToken for your WhatsApp Business account.Minimum length: 1
app_secretpydantic.types.SecretStrSecretStr('')Used to verify incoming webhook signatures.
webhook_verify_tokenpydantic.types.SecretStrSecretStr('')Shared token for webhook verification.

Slack

ID slack · Lookup ID SLACK

Workspace messaging with explicit bot or user authorization.

FieldValue
iconfa-brands fa-slack
address_fieldusername
auth_modeoauth
start_handlerbloomerp.communication.builtins.instant_messaging.selection.start_external
internalFalse
transport_readyFalse

SlackConnectionConfiguration

Typed setup fields for the slack connection wizard.

SettingTypeDefaultDescription
namestrRequiredMinimum length: 1Maximum length: 255
workspace_idstrRequiredMinimum length: 1Maximum length: 255
bot_tokenpydantic.types.SecretStrRequiredMinimum length: 1
signing_secretpydantic.types.SecretStrSecretStr('')—

Phone

ID phone · Lookup ID PHONE

FieldValue
iconfa-solid fa-phone
address_fieldphone
auth_modeinternal
internalTrue
transport_readyTrue

IMConnectionConfiguration

Describe provider setup fields used by the shared connection wizard.

SettingTypeDefaultDescription
namestrRequiredMinimum length: 1Maximum length: 255