Skip to content

Teams API Reference

Access Microsoft Teams through the notifications namespace:

from fabias.notifications import teams

teams.client(team_id="...", channel_id="...", auth=my_auth)
teams.send("Pipeline completed!")

Module Functions

fabias.notifications.teams.client

Microsoft Teams (Graph API) client.

Classes

TeamsClient

Bases: BaseClient

HTTP client for Microsoft Teams via Graph API.

Configured for a specific team with a default channel.

Source code in src/fabias/notifications/teams/client.py
class TeamsClient(BaseClient):
    """
    HTTP client for Microsoft Teams via Graph API.

    Configured for a specific team with a default channel.
    """

    GRAPH_SCOPE = "https://graph.microsoft.com/.default"
    GRAPH_API_URL = "https://graph.microsoft.com/v1.0"

    def __init__(
        self,
        team_id: str,
        channel_id: str,
        auth: Optional[AuthProvider] = None,
        tenant_id: Optional[str] = None,
        client_id: Optional[str] = None,
        client_secret: Optional[str] = None,
    ):
        """
        Initialize the Teams client.

        Args:
            team_id: Microsoft Teams team ID
            channel_id: Default channel ID
            auth: Optional pre-configured AuthProvider
            tenant_id: Azure AD tenant ID
            client_id: Application client ID
            client_secret: Client secret
        """
        # Determine authentication method
        if auth:
            auth_provider = auth
        elif tenant_id and client_id and client_secret:
            auth_provider = ServicePrincipalAuth(
                tenant_id=tenant_id, client_id=client_id, client_secret=client_secret
            )
        elif runtime.isFabric:
            auth_provider = FabricAuth()
        else:
            auth_provider = AutoAuth(
                tenant_id=tenant_id, client_id=client_id, client_secret=client_secret
            )

        super().__init__(auth_provider)

        self._team_id = team_id
        self._channel_id = channel_id
        self._scope = self.GRAPH_SCOPE
        self._base_uri = self.GRAPH_API_URL

    @property
    def teamId(self) -> str:
        """Get the configured team ID."""
        return self._team_id

    @property
    def channelId(self) -> str:
        """Get the default channel ID."""
        return self._channel_id

    def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
        """
        Send a message to the default channel.

        Args:
            content: Message text or Adaptive Card
            subject: Optional message subject

        Returns:
            dict: API response
        """
        return self.channel(self._channel_id).send(content, subject)

    def channel(self, channel_id: str) -> Channel:
        """
        Get a Channel object for a specific channel.

        Args:
            channel_id: Channel ID

        Returns:
            Channel: Channel for sending messages
        """
        return Channel(self, self._team_id, channel_id)

    def listChannels(self) -> List[Dict[str, Any]]:
        """
        List all channels in the team.

        Returns:
            list: List of channel metadata
        """
        response = self.get(f"/teams/{self._team_id}/channels")
        return response.json().get("value", [])

    def getResource(self, resource_type: str, **kwargs) -> Any:
        """
        Generic resource access for dynamic __getattr__ fallback.

        Args:
            resource_type: Resource type/path

        Returns:
            API response data
        """
        endpoint = f"/teams/{self._team_id}/{resource_type}"
        response = self.get(endpoint)
        data = response.json()

        if "value" in data:
            return data["value"]
        return data
Attributes
channelId property

Get the default channel ID.

teamId property

Get the configured team ID.

Functions
__init__(team_id, channel_id, auth=None, tenant_id=None, client_id=None, client_secret=None)

Initialize the Teams client.

Parameters:

Name Type Description Default
team_id str

Microsoft Teams team ID

required
channel_id str

Default channel ID

required
auth Optional[AuthProvider]

Optional pre-configured AuthProvider

None
tenant_id Optional[str]

Azure AD tenant ID

None
client_id Optional[str]

Application client ID

None
client_secret Optional[str]

Client secret

None
Source code in src/fabias/notifications/teams/client.py
def __init__(
    self,
    team_id: str,
    channel_id: str,
    auth: Optional[AuthProvider] = None,
    tenant_id: Optional[str] = None,
    client_id: Optional[str] = None,
    client_secret: Optional[str] = None,
):
    """
    Initialize the Teams client.

    Args:
        team_id: Microsoft Teams team ID
        channel_id: Default channel ID
        auth: Optional pre-configured AuthProvider
        tenant_id: Azure AD tenant ID
        client_id: Application client ID
        client_secret: Client secret
    """
    # Determine authentication method
    if auth:
        auth_provider = auth
    elif tenant_id and client_id and client_secret:
        auth_provider = ServicePrincipalAuth(
            tenant_id=tenant_id, client_id=client_id, client_secret=client_secret
        )
    elif runtime.isFabric:
        auth_provider = FabricAuth()
    else:
        auth_provider = AutoAuth(
            tenant_id=tenant_id, client_id=client_id, client_secret=client_secret
        )

    super().__init__(auth_provider)

    self._team_id = team_id
    self._channel_id = channel_id
    self._scope = self.GRAPH_SCOPE
    self._base_uri = self.GRAPH_API_URL
channel(channel_id)

Get a Channel object for a specific channel.

Parameters:

Name Type Description Default
channel_id str

Channel ID

required

Returns:

Name Type Description
Channel Channel

Channel for sending messages

Source code in src/fabias/notifications/teams/client.py
def channel(self, channel_id: str) -> Channel:
    """
    Get a Channel object for a specific channel.

    Args:
        channel_id: Channel ID

    Returns:
        Channel: Channel for sending messages
    """
    return Channel(self, self._team_id, channel_id)
getResource(resource_type, **kwargs)

Generic resource access for dynamic getattr fallback.

Parameters:

Name Type Description Default
resource_type str

Resource type/path

required

Returns:

Type Description
Any

API response data

Source code in src/fabias/notifications/teams/client.py
def getResource(self, resource_type: str, **kwargs) -> Any:
    """
    Generic resource access for dynamic __getattr__ fallback.

    Args:
        resource_type: Resource type/path

    Returns:
        API response data
    """
    endpoint = f"/teams/{self._team_id}/{resource_type}"
    response = self.get(endpoint)
    data = response.json()

    if "value" in data:
        return data["value"]
    return data
listChannels()

List all channels in the team.

Returns:

Name Type Description
list List[Dict[str, Any]]

List of channel metadata

Source code in src/fabias/notifications/teams/client.py
def listChannels(self) -> List[Dict[str, Any]]:
    """
    List all channels in the team.

    Returns:
        list: List of channel metadata
    """
    response = self.get(f"/teams/{self._team_id}/channels")
    return response.json().get("value", [])
send(content, subject=None)

Send a message to the default channel.

Parameters:

Name Type Description Default
content Union[str, Any]

Message text or Adaptive Card

required
subject Optional[str]

Optional message subject

None

Returns:

Name Type Description
dict dict

API response

Source code in src/fabias/notifications/teams/client.py
def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
    """
    Send a message to the default channel.

    Args:
        content: Message text or Adaptive Card
        subject: Optional message subject

    Returns:
        dict: API response
    """
    return self.channel(self._channel_id).send(content, subject)

fabias.notifications.teams.send(content, subject=None)

Send a message to the default channel.

Parameters:

Name Type Description Default
content Union[str, Any]

Message text or Adaptive Card

required
subject Optional[str]

Optional message subject

None

Returns:

Name Type Description
dict dict

API response with message ID

Examples:

>>> teams.send("Hello world!")
>>> teams.send("Alert", subject="Important")
>>> teams.send(my_adaptive_card)
Source code in src/fabias/notifications/teams/__init__.py
def send(content: Union[str, Any], subject: Optional[str] = None) -> dict:
    """
    Send a message to the default channel.

    Args:
        content: Message text or Adaptive Card
        subject: Optional message subject

    Returns:
        dict: API response with message ID

    Examples:
        >>> teams.send("Hello world!")
        >>> teams.send("Alert", subject="Important")
        >>> teams.send(my_adaptive_card)
    """
    return _get_client().send(content, subject)

fabias.notifications.teams.channel

Microsoft Teams Channel model.

Classes

Channel

Represents a Microsoft Teams channel.

Provides methods to send messages, including Adaptive Cards.

Examples:

>>> import fabias.teams as teams
>>> teams.client(team_id="...", channel_id="...", auth=auth)
>>> teams.send("Hello!")  # Default channel
>>> teams.channel("other-id").send("Hello other channel!")
Source code in src/fabias/notifications/teams/channel.py
class Channel:
    """
    Represents a Microsoft Teams channel.

    Provides methods to send messages, including Adaptive Cards.

    Examples:
        >>> import fabias.teams as teams
        >>> teams.client(team_id="...", channel_id="...", auth=auth)
        >>> teams.send("Hello!")  # Default channel
        >>> teams.channel("other-id").send("Hello other channel!")
    """

    def __init__(self, client: "TeamsClient", team_id: str, channel_id: str):
        """
        Initialize channel.

        Args:
            client: Configured TeamsClient
            team_id: Parent team ID
            channel_id: Channel ID
        """
        self._client = client
        self.teamId = team_id
        self.id = channel_id

    def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
        """
        Send a message to this channel.

        Args:
            content: Message text or Adaptive Card
            subject: Optional message subject

        Returns:
            dict: API response with message ID

        Examples:
            >>> channel.send("Hello world!")
            >>> channel.send("Alert message", subject="Important")
            >>> channel.send(my_adaptive_card)
        """
        endpoint = f"/teams/{self.teamId}/channels/{self.id}/messages"

        # Build message body
        body: Dict[str, Any] = {
            "subject": subject,
            "body": {"contentType": "html", "content": content if isinstance(content, str) else ""},
        }

        # Check for Adaptive Card
        try:
            from ..cards import Adaptive

            if isinstance(content, Adaptive):
                attachment_id = GUID.hex()
                body_content: Dict[str, str] = body["body"]  # Type annotation for nested dict
                body_content["content"] = f'<attachment id="{attachment_id}"></attachment>'
                body["attachments"] = [
                    {
                        "id": attachment_id,
                        "contentType": "application/vnd.microsoft.card.adaptive",
                        "contentUrl": None,
                        "content": content.content(),
                        "name": None,
                        "thumbnailUrl": None,
                    }
                ]
        except ImportError:
            pass

        response = self._client.post(endpoint, data=body)
        return response.json()

    def __repr__(self) -> str:
        return f"Channel(id={self.id}, teamId={self.teamId})"
Functions
__init__(client, team_id, channel_id)

Initialize channel.

Parameters:

Name Type Description Default
client TeamsClient

Configured TeamsClient

required
team_id str

Parent team ID

required
channel_id str

Channel ID

required
Source code in src/fabias/notifications/teams/channel.py
def __init__(self, client: "TeamsClient", team_id: str, channel_id: str):
    """
    Initialize channel.

    Args:
        client: Configured TeamsClient
        team_id: Parent team ID
        channel_id: Channel ID
    """
    self._client = client
    self.teamId = team_id
    self.id = channel_id
send(content, subject=None)

Send a message to this channel.

Parameters:

Name Type Description Default
content Union[str, Any]

Message text or Adaptive Card

required
subject Optional[str]

Optional message subject

None

Returns:

Name Type Description
dict dict

API response with message ID

Examples:

>>> channel.send("Hello world!")
>>> channel.send("Alert message", subject="Important")
>>> channel.send(my_adaptive_card)
Source code in src/fabias/notifications/teams/channel.py
def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
    """
    Send a message to this channel.

    Args:
        content: Message text or Adaptive Card
        subject: Optional message subject

    Returns:
        dict: API response with message ID

    Examples:
        >>> channel.send("Hello world!")
        >>> channel.send("Alert message", subject="Important")
        >>> channel.send(my_adaptive_card)
    """
    endpoint = f"/teams/{self.teamId}/channels/{self.id}/messages"

    # Build message body
    body: Dict[str, Any] = {
        "subject": subject,
        "body": {"contentType": "html", "content": content if isinstance(content, str) else ""},
    }

    # Check for Adaptive Card
    try:
        from ..cards import Adaptive

        if isinstance(content, Adaptive):
            attachment_id = GUID.hex()
            body_content: Dict[str, str] = body["body"]  # Type annotation for nested dict
            body_content["content"] = f'<attachment id="{attachment_id}"></attachment>'
            body["attachments"] = [
                {
                    "id": attachment_id,
                    "contentType": "application/vnd.microsoft.card.adaptive",
                    "contentUrl": None,
                    "content": content.content(),
                    "name": None,
                    "thumbnailUrl": None,
                }
            ]
    except ImportError:
        pass

    response = self._client.post(endpoint, data=body)
    return response.json()

Classes

fabias.notifications.teams.Channel

Represents a Microsoft Teams channel.

Provides methods to send messages, including Adaptive Cards.

Examples:

>>> import fabias.teams as teams
>>> teams.client(team_id="...", channel_id="...", auth=auth)
>>> teams.send("Hello!")  # Default channel
>>> teams.channel("other-id").send("Hello other channel!")
Source code in src/fabias/notifications/teams/channel.py
class Channel:
    """
    Represents a Microsoft Teams channel.

    Provides methods to send messages, including Adaptive Cards.

    Examples:
        >>> import fabias.teams as teams
        >>> teams.client(team_id="...", channel_id="...", auth=auth)
        >>> teams.send("Hello!")  # Default channel
        >>> teams.channel("other-id").send("Hello other channel!")
    """

    def __init__(self, client: "TeamsClient", team_id: str, channel_id: str):
        """
        Initialize channel.

        Args:
            client: Configured TeamsClient
            team_id: Parent team ID
            channel_id: Channel ID
        """
        self._client = client
        self.teamId = team_id
        self.id = channel_id

    def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
        """
        Send a message to this channel.

        Args:
            content: Message text or Adaptive Card
            subject: Optional message subject

        Returns:
            dict: API response with message ID

        Examples:
            >>> channel.send("Hello world!")
            >>> channel.send("Alert message", subject="Important")
            >>> channel.send(my_adaptive_card)
        """
        endpoint = f"/teams/{self.teamId}/channels/{self.id}/messages"

        # Build message body
        body: Dict[str, Any] = {
            "subject": subject,
            "body": {"contentType": "html", "content": content if isinstance(content, str) else ""},
        }

        # Check for Adaptive Card
        try:
            from ..cards import Adaptive

            if isinstance(content, Adaptive):
                attachment_id = GUID.hex()
                body_content: Dict[str, str] = body["body"]  # Type annotation for nested dict
                body_content["content"] = f'<attachment id="{attachment_id}"></attachment>'
                body["attachments"] = [
                    {
                        "id": attachment_id,
                        "contentType": "application/vnd.microsoft.card.adaptive",
                        "contentUrl": None,
                        "content": content.content(),
                        "name": None,
                        "thumbnailUrl": None,
                    }
                ]
        except ImportError:
            pass

        response = self._client.post(endpoint, data=body)
        return response.json()

    def __repr__(self) -> str:
        return f"Channel(id={self.id}, teamId={self.teamId})"

Attributes

teamId = team_id instance-attribute

Functions

send(content, subject=None)

Send a message to this channel.

Parameters:

Name Type Description Default
content Union[str, Any]

Message text or Adaptive Card

required
subject Optional[str]

Optional message subject

None

Returns:

Name Type Description
dict dict

API response with message ID

Examples:

>>> channel.send("Hello world!")
>>> channel.send("Alert message", subject="Important")
>>> channel.send(my_adaptive_card)
Source code in src/fabias/notifications/teams/channel.py
def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
    """
    Send a message to this channel.

    Args:
        content: Message text or Adaptive Card
        subject: Optional message subject

    Returns:
        dict: API response with message ID

    Examples:
        >>> channel.send("Hello world!")
        >>> channel.send("Alert message", subject="Important")
        >>> channel.send(my_adaptive_card)
    """
    endpoint = f"/teams/{self.teamId}/channels/{self.id}/messages"

    # Build message body
    body: Dict[str, Any] = {
        "subject": subject,
        "body": {"contentType": "html", "content": content if isinstance(content, str) else ""},
    }

    # Check for Adaptive Card
    try:
        from ..cards import Adaptive

        if isinstance(content, Adaptive):
            attachment_id = GUID.hex()
            body_content: Dict[str, str] = body["body"]  # Type annotation for nested dict
            body_content["content"] = f'<attachment id="{attachment_id}"></attachment>'
            body["attachments"] = [
                {
                    "id": attachment_id,
                    "contentType": "application/vnd.microsoft.card.adaptive",
                    "contentUrl": None,
                    "content": content.content(),
                    "name": None,
                    "thumbnailUrl": None,
                }
            ]
    except ImportError:
        pass

    response = self._client.post(endpoint, data=body)
    return response.json()

fabias.notifications.teams.TeamsClient

Bases: BaseClient

HTTP client for Microsoft Teams via Graph API.

Configured for a specific team with a default channel.

Source code in src/fabias/notifications/teams/client.py
class TeamsClient(BaseClient):
    """
    HTTP client for Microsoft Teams via Graph API.

    Configured for a specific team with a default channel.
    """

    GRAPH_SCOPE = "https://graph.microsoft.com/.default"
    GRAPH_API_URL = "https://graph.microsoft.com/v1.0"

    def __init__(
        self,
        team_id: str,
        channel_id: str,
        auth: Optional[AuthProvider] = None,
        tenant_id: Optional[str] = None,
        client_id: Optional[str] = None,
        client_secret: Optional[str] = None,
    ):
        """
        Initialize the Teams client.

        Args:
            team_id: Microsoft Teams team ID
            channel_id: Default channel ID
            auth: Optional pre-configured AuthProvider
            tenant_id: Azure AD tenant ID
            client_id: Application client ID
            client_secret: Client secret
        """
        # Determine authentication method
        if auth:
            auth_provider = auth
        elif tenant_id and client_id and client_secret:
            auth_provider = ServicePrincipalAuth(
                tenant_id=tenant_id, client_id=client_id, client_secret=client_secret
            )
        elif runtime.isFabric:
            auth_provider = FabricAuth()
        else:
            auth_provider = AutoAuth(
                tenant_id=tenant_id, client_id=client_id, client_secret=client_secret
            )

        super().__init__(auth_provider)

        self._team_id = team_id
        self._channel_id = channel_id
        self._scope = self.GRAPH_SCOPE
        self._base_uri = self.GRAPH_API_URL

    @property
    def teamId(self) -> str:
        """Get the configured team ID."""
        return self._team_id

    @property
    def channelId(self) -> str:
        """Get the default channel ID."""
        return self._channel_id

    def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
        """
        Send a message to the default channel.

        Args:
            content: Message text or Adaptive Card
            subject: Optional message subject

        Returns:
            dict: API response
        """
        return self.channel(self._channel_id).send(content, subject)

    def channel(self, channel_id: str) -> Channel:
        """
        Get a Channel object for a specific channel.

        Args:
            channel_id: Channel ID

        Returns:
            Channel: Channel for sending messages
        """
        return Channel(self, self._team_id, channel_id)

    def listChannels(self) -> List[Dict[str, Any]]:
        """
        List all channels in the team.

        Returns:
            list: List of channel metadata
        """
        response = self.get(f"/teams/{self._team_id}/channels")
        return response.json().get("value", [])

    def getResource(self, resource_type: str, **kwargs) -> Any:
        """
        Generic resource access for dynamic __getattr__ fallback.

        Args:
            resource_type: Resource type/path

        Returns:
            API response data
        """
        endpoint = f"/teams/{self._team_id}/{resource_type}"
        response = self.get(endpoint)
        data = response.json()

        if "value" in data:
            return data["value"]
        return data

Attributes

teamId property

Get the configured team ID.

channelId property

Get the default channel ID.

Functions

send(content, subject=None)

Send a message to the default channel.

Parameters:

Name Type Description Default
content Union[str, Any]

Message text or Adaptive Card

required
subject Optional[str]

Optional message subject

None

Returns:

Name Type Description
dict dict

API response

Source code in src/fabias/notifications/teams/client.py
def send(self, content: Union[str, Any], subject: Optional[str] = None) -> dict:
    """
    Send a message to the default channel.

    Args:
        content: Message text or Adaptive Card
        subject: Optional message subject

    Returns:
        dict: API response
    """
    return self.channel(self._channel_id).send(content, subject)

channel(channel_id)

Get a Channel object for a specific channel.

Parameters:

Name Type Description Default
channel_id str

Channel ID

required

Returns:

Name Type Description
Channel Channel

Channel for sending messages

Source code in src/fabias/notifications/teams/client.py
def channel(self, channel_id: str) -> Channel:
    """
    Get a Channel object for a specific channel.

    Args:
        channel_id: Channel ID

    Returns:
        Channel: Channel for sending messages
    """
    return Channel(self, self._team_id, channel_id)

listChannels()

List all channels in the team.

Returns:

Name Type Description
list List[Dict[str, Any]]

List of channel metadata

Source code in src/fabias/notifications/teams/client.py
def listChannels(self) -> List[Dict[str, Any]]:
    """
    List all channels in the team.

    Returns:
        list: List of channel metadata
    """
    response = self.get(f"/teams/{self._team_id}/channels")
    return response.json().get("value", [])

getResource(resource_type, **kwargs)

Generic resource access for dynamic getattr fallback.

Parameters:

Name Type Description Default
resource_type str

Resource type/path

required

Returns:

Type Description
Any

API response data

Source code in src/fabias/notifications/teams/client.py
def getResource(self, resource_type: str, **kwargs) -> Any:
    """
    Generic resource access for dynamic __getattr__ fallback.

    Args:
        resource_type: Resource type/path

    Returns:
        API response data
    """
    endpoint = f"/teams/{self._team_id}/{resource_type}"
    response = self.get(endpoint)
    data = response.json()

    if "value" in data:
        return data["value"]
    return data

Cards Module

fabias.notifications.cards.Adaptive

Bases: CardElement

Represents a Microsoft Adaptive Card.

Adaptive Cards are platform-agnostic UI snippets that can be rendered in Microsoft Teams, Outlook, and other Microsoft 365 apps.

Attributes:

Name Type Description
type str

Always "AdaptiveCard"

version str

Adaptive Card schema version

body list

List of card elements to display

actions list

List of interactive actions

speak str

Text-to-speech content for accessibility

Examples:

Simple card:

>>> from fabias.cards import Adaptive, TextBlock
>>> card = Adaptive(body=[
...     TextBlock("Hello!", weight="Bolder", size="Large"),
...     TextBlock("Welcome to fabias!")
... ])

Card with actions:

>>> from fabias.cards import Adaptive, TextBlock, ActionOpenUrl
>>> card = Adaptive(
...     body=[TextBlock("Check out our docs")],
...     actions=[ActionOpenUrl("icon:Book", "Docs", "https://docs.example.com")]
... )

Send via Teams:

>>> client = GraphClient()
>>> channel = client.team().channel()
>>> channel.message(card)
Source code in src/fabias/notifications/cards/cards.py
class Adaptive(CardElement):
    """
    Represents a Microsoft Adaptive Card.

    Adaptive Cards are platform-agnostic UI snippets that can be
    rendered in Microsoft Teams, Outlook, and other Microsoft 365 apps.

    Attributes:
        type (str): Always "AdaptiveCard"
        version (str): Adaptive Card schema version
        body (list): List of card elements to display
        actions (list): List of interactive actions
        speak (str): Text-to-speech content for accessibility

    Examples:
        Simple card:

        >>> from fabias.cards import Adaptive, TextBlock
        >>> card = Adaptive(body=[
        ...     TextBlock("Hello!", weight="Bolder", size="Large"),
        ...     TextBlock("Welcome to fabias!")
        ... ])

        Card with actions:

        >>> from fabias.cards import Adaptive, TextBlock, ActionOpenUrl
        >>> card = Adaptive(
        ...     body=[TextBlock("Check out our docs")],
        ...     actions=[ActionOpenUrl("icon:Book", "Docs", "https://docs.example.com")]
        ... )

        Send via Teams:

        >>> client = GraphClient()
        >>> channel = client.team().channel()
        >>> channel.message(card)
    """

    def __init__(
        self,
        body: Optional[List] = None,
        actions: Optional[List] = None,
        speak: Optional[str] = None,
        version: str = "1.5",
    ):
        """
        Initialize an Adaptive Card.

        Args:
            body: List of card elements to display
            actions: List of actions available on the card
            speak: Text to be spoken for accessibility
            version: Adaptive Card schema version (default "1.5")
        """
        self.type = "AdaptiveCard"
        self.version = version
        self.body = body if body is not None else []
        self.actions = actions if actions is not None else []
        if speak:
            self.speak = speak

    def to_dict(self) -> Dict[str, Any]:
        """
        Convert card to dictionary, adding the $schema field.

        Returns:
            dict: Dictionary representation with schema URL
        """
        result = super().to_dict()
        result["$schema"] = "https://adaptivecards.io/schemas/adaptive-card.json"
        return result

    def content(self) -> str:
        """
        Return JSON string representation of the card.

        This is used when sending cards via the Graph API, which
        expects the card content as a JSON string.

        Returns:
            str: JSON-serialized card content
        """
        return json.dumps(self.toDict())

    def addElement(self, element: CardElement) -> "Adaptive":
        """
        Add an element to the card body.

        Args:
            element: Card element to add

        Returns:
            Adaptive: Self for method chaining
        """
        self.body.append(element)
        return self

    def addAction(self, action: CardElement) -> "Adaptive":
        """
        Add an action to the card.

        Args:
            action: Action element to add

        Returns:
            Adaptive: Self for method chaining
        """
        self.actions.append(action)
        return self

    def __repr__(self) -> str:
        return f"Adaptive(body={len(self.body)} elements, actions={len(self.actions)})"

Functions

__init__(body=None, actions=None, speak=None, version='1.5')

Initialize an Adaptive Card.

Parameters:

Name Type Description Default
body Optional[List]

List of card elements to display

None
actions Optional[List]

List of actions available on the card

None
speak Optional[str]

Text to be spoken for accessibility

None
version str

Adaptive Card schema version (default "1.5")

'1.5'
Source code in src/fabias/notifications/cards/cards.py
def __init__(
    self,
    body: Optional[List] = None,
    actions: Optional[List] = None,
    speak: Optional[str] = None,
    version: str = "1.5",
):
    """
    Initialize an Adaptive Card.

    Args:
        body: List of card elements to display
        actions: List of actions available on the card
        speak: Text to be spoken for accessibility
        version: Adaptive Card schema version (default "1.5")
    """
    self.type = "AdaptiveCard"
    self.version = version
    self.body = body if body is not None else []
    self.actions = actions if actions is not None else []
    if speak:
        self.speak = speak

addAction(action)

Add an action to the card.

Parameters:

Name Type Description Default
action CardElement

Action element to add

required

Returns:

Name Type Description
Adaptive Adaptive

Self for method chaining

Source code in src/fabias/notifications/cards/cards.py
def addAction(self, action: CardElement) -> "Adaptive":
    """
    Add an action to the card.

    Args:
        action: Action element to add

    Returns:
        Adaptive: Self for method chaining
    """
    self.actions.append(action)
    return self

addElement(element)

Add an element to the card body.

Parameters:

Name Type Description Default
element CardElement

Card element to add

required

Returns:

Name Type Description
Adaptive Adaptive

Self for method chaining

Source code in src/fabias/notifications/cards/cards.py
def addElement(self, element: CardElement) -> "Adaptive":
    """
    Add an element to the card body.

    Args:
        element: Card element to add

    Returns:
        Adaptive: Self for method chaining
    """
    self.body.append(element)
    return self

content()

Return JSON string representation of the card.

This is used when sending cards via the Graph API, which expects the card content as a JSON string.

Returns:

Name Type Description
str str

JSON-serialized card content

Source code in src/fabias/notifications/cards/cards.py
def content(self) -> str:
    """
    Return JSON string representation of the card.

    This is used when sending cards via the Graph API, which
    expects the card content as a JSON string.

    Returns:
        str: JSON-serialized card content
    """
    return json.dumps(self.toDict())

to_dict()

Convert card to dictionary, adding the $schema field.

Returns:

Name Type Description
dict Dict[str, Any]

Dictionary representation with schema URL

Source code in src/fabias/notifications/cards/cards.py
def to_dict(self) -> Dict[str, Any]:
    """
    Convert card to dictionary, adding the $schema field.

    Returns:
        dict: Dictionary representation with schema URL
    """
    result = super().to_dict()
    result["$schema"] = "https://adaptivecards.io/schemas/adaptive-card.json"
    return result

fabias.notifications.cards.TextBlock

Bases: CardElement

Text block element for displaying text in a card.

Supports various text styling options including size, weight, color, and font type.

Attributes:

Name Type Description
type str

Always "TextBlock"

text str

Text content to display

wrap bool

Whether text should wrap

weight str

Font weight (e.g., "Bolder", "Lighter")

size str

Font size (e.g., "Small", "Medium", "Large", "ExtraLarge")

color str

Text color (e.g., "Default", "Warning", "Attention")

style str

Text style (e.g., "default", "heading")

fontType str

Font type (e.g., "Monospace")

Examples:

>>> title = TextBlock("Welcome!", weight="Bolder", size="Large")
>>> subtitle = TextBlock("This is a subtitle", color="Accent")
Source code in src/fabias/notifications/cards/elements.py
class TextBlock(CardElement):
    """
    Text block element for displaying text in a card.

    Supports various text styling options including size, weight,
    color, and font type.

    Attributes:
        type (str): Always "TextBlock"
        text (str): Text content to display
        wrap (bool): Whether text should wrap
        weight (str): Font weight (e.g., "Bolder", "Lighter")
        size (str): Font size (e.g., "Small", "Medium", "Large", "ExtraLarge")
        color (str): Text color (e.g., "Default", "Warning", "Attention")
        style (str): Text style (e.g., "default", "heading")
        fontType (str): Font type (e.g., "Monospace")

    Examples:
        >>> title = TextBlock("Welcome!", weight="Bolder", size="Large")
        >>> subtitle = TextBlock("This is a subtitle", color="Accent")
    """

    def __init__(
        self,
        text: str,
        wrap: bool = True,
        weight: Optional[str] = None,
        size: Optional[str] = None,
        color: Optional[str] = None,
        style: Optional[str] = "default",
        fontType: Optional[str] = None,
    ):
        """
        Initialize a TextBlock element.

        Args:
            text: Text content to display
            wrap: Whether text should wrap (default True)
            weight: Font weight ("Bolder", "Lighter")
            size: Font size ("Small", "Medium", "Large", "ExtraLarge")
            color: Text color ("Default", "Warning", "Attention", "Accent")
            style: Text style ("default", "heading")
            fontType: Font type ("Default", "Monospace")
        """
        self.type = "TextBlock"
        self.text = text
        self.wrap = wrap
        if weight:
            self.weight = weight
        if size:
            self.size = size
        if color:
            self.color = color
        if style:
            self.style = style
        if fontType:
            self.fontType = fontType

Functions

__init__(text, wrap=True, weight=None, size=None, color=None, style='default', fontType=None)

Initialize a TextBlock element.

Parameters:

Name Type Description Default
text str

Text content to display

required
wrap bool

Whether text should wrap (default True)

True
weight Optional[str]

Font weight ("Bolder", "Lighter")

None
size Optional[str]

Font size ("Small", "Medium", "Large", "ExtraLarge")

None
color Optional[str]

Text color ("Default", "Warning", "Attention", "Accent")

None
style Optional[str]

Text style ("default", "heading")

'default'
fontType Optional[str]

Font type ("Default", "Monospace")

None
Source code in src/fabias/notifications/cards/elements.py
def __init__(
    self,
    text: str,
    wrap: bool = True,
    weight: Optional[str] = None,
    size: Optional[str] = None,
    color: Optional[str] = None,
    style: Optional[str] = "default",
    fontType: Optional[str] = None,
):
    """
    Initialize a TextBlock element.

    Args:
        text: Text content to display
        wrap: Whether text should wrap (default True)
        weight: Font weight ("Bolder", "Lighter")
        size: Font size ("Small", "Medium", "Large", "ExtraLarge")
        color: Text color ("Default", "Warning", "Attention", "Accent")
        style: Text style ("default", "heading")
        fontType: Font type ("Default", "Monospace")
    """
    self.type = "TextBlock"
    self.text = text
    self.wrap = wrap
    if weight:
        self.weight = weight
    if size:
        self.size = size
    if color:
        self.color = color
    if style:
        self.style = style
    if fontType:
        self.fontType = fontType

fabias.notifications.cards.ColumnSet

Bases: CardElement

ColumnSet element for multi-column layouts.

Contains one or more Column elements arranged horizontally.

Attributes:

Name Type Description
type str

Always "ColumnSet"

columns list

List of Column elements

style str

Optional style for the column set

Examples:

>>> cols = ColumnSet()
>>> cols.addColumn([TextBlock("Left")], width="1")
>>> cols.addColumn([TextBlock("Right")], width="1")
>>> # Or with columns directly:
>>> cols = ColumnSet(columns=[
...     Column([TextBlock("A")], width="auto"),
...     Column([TextBlock("B")], width="stretch")
... ])
Source code in src/fabias/notifications/cards/elements.py
class ColumnSet(CardElement):
    """
    ColumnSet element for multi-column layouts.

    Contains one or more Column elements arranged horizontally.

    Attributes:
        type (str): Always "ColumnSet"
        columns (list): List of Column elements
        style (str): Optional style for the column set

    Examples:
        >>> cols = ColumnSet()
        >>> cols.addColumn([TextBlock("Left")], width="1")
        >>> cols.addColumn([TextBlock("Right")], width="1")

        >>> # Or with columns directly:
        >>> cols = ColumnSet(columns=[
        ...     Column([TextBlock("A")], width="auto"),
        ...     Column([TextBlock("B")], width="stretch")
        ... ])
    """

    def __init__(self, style: Optional[str] = None, columns: Optional[List] = None):
        """
        Initialize a ColumnSet element.

        Args:
            style: Optional style for the column set
            columns: Optional list of Column elements
        """
        self.type = "ColumnSet"

        # Process columns - convert CardElements to dicts
        if columns:
            self.columns = [
                col.to_dict() if isinstance(col, CardElement) else col for col in columns
            ]
        else:
            self.columns = []

        if style:
            self.style = style

    def addColumn(self, content: List, width: Optional[str] = "stretch") -> None:
        """
        Add a column to this ColumnSet.

        Args:
            content: List of CardElement objects for the column
            width: Column width
        """
        items = [item.to_dict() if isinstance(item, CardElement) else item for item in content]
        self.columns.append({"type": "Column", "width": width, "items": items})

Functions

__init__(style=None, columns=None)

Initialize a ColumnSet element.

Parameters:

Name Type Description Default
style Optional[str]

Optional style for the column set

None
columns Optional[List]

Optional list of Column elements

None
Source code in src/fabias/notifications/cards/elements.py
def __init__(self, style: Optional[str] = None, columns: Optional[List] = None):
    """
    Initialize a ColumnSet element.

    Args:
        style: Optional style for the column set
        columns: Optional list of Column elements
    """
    self.type = "ColumnSet"

    # Process columns - convert CardElements to dicts
    if columns:
        self.columns = [
            col.to_dict() if isinstance(col, CardElement) else col for col in columns
        ]
    else:
        self.columns = []

    if style:
        self.style = style

addColumn(content, width='stretch')

Add a column to this ColumnSet.

Parameters:

Name Type Description Default
content List

List of CardElement objects for the column

required
width Optional[str]

Column width

'stretch'
Source code in src/fabias/notifications/cards/elements.py
def addColumn(self, content: List, width: Optional[str] = "stretch") -> None:
    """
    Add a column to this ColumnSet.

    Args:
        content: List of CardElement objects for the column
        width: Column width
    """
    items = [item.to_dict() if isinstance(item, CardElement) else item for item in content]
    self.columns.append({"type": "Column", "width": width, "items": items})

fabias.notifications.cards.Column

Bases: CardElement

Column element for use within a ColumnSet.

Columns contain a list of items and have configurable width.

Attributes:

Name Type Description
type str

Always "Column"

width str

Column width ("auto", "stretch", or pixel/weight value)

items list

List of card elements in this column

Examples:

>>> col = Column([TextBlock("Title"), TextBlock("Subtitle")], width="stretch")
Source code in src/fabias/notifications/cards/elements.py
class Column(CardElement):
    """
    Column element for use within a ColumnSet.

    Columns contain a list of items and have configurable width.

    Attributes:
        type (str): Always "Column"
        width (str): Column width ("auto", "stretch", or pixel/weight value)
        items (list): List of card elements in this column

    Examples:
        >>> col = Column([TextBlock("Title"), TextBlock("Subtitle")], width="stretch")
    """

    def __init__(self, content: List, width: Optional[str] = "stretch"):
        """
        Initialize a Column element.

        Args:
            content: List of CardElement objects or dicts
            width: Column width ("auto", "stretch", or specific value)
        """
        self.type = "Column"
        self.width = width
        self.items = [item.to_dict() if isinstance(item, CardElement) else item for item in content]

Functions

__init__(content, width='stretch')

Initialize a Column element.

Parameters:

Name Type Description Default
content List

List of CardElement objects or dicts

required
width Optional[str]

Column width ("auto", "stretch", or specific value)

'stretch'
Source code in src/fabias/notifications/cards/elements.py
def __init__(self, content: List, width: Optional[str] = "stretch"):
    """
    Initialize a Column element.

    Args:
        content: List of CardElement objects or dicts
        width: Column width ("auto", "stretch", or specific value)
    """
    self.type = "Column"
    self.width = width
    self.items = [item.to_dict() if isinstance(item, CardElement) else item for item in content]

fabias.notifications.cards.Image

Bases: CardElement

Image element for displaying images in a card.

Attributes:

Name Type Description
type str

Always "Image"

url str

Image URL

size str

Image size ("Auto", "Stretch", "Small", "Medium", "Large")

altText str

Alternative text for accessibility

Examples:

>>> logo = Image("https://example.com/logo.png", size="Medium")
>>> avatar = Image(url, alt_text="User avatar")
Source code in src/fabias/notifications/cards/elements.py
class Image(CardElement):
    """
    Image element for displaying images in a card.

    Attributes:
        type (str): Always "Image"
        url (str): Image URL
        size (str): Image size ("Auto", "Stretch", "Small", "Medium", "Large")
        altText (str): Alternative text for accessibility

    Examples:
        >>> logo = Image("https://example.com/logo.png", size="Medium")
        >>> avatar = Image(url, alt_text="User avatar")
    """

    def __init__(self, url: str, size: Optional[str] = None, alt_text: Optional[str] = None):
        """
        Initialize an Image element.

        Args:
            url: Image URL
            size: Image size ("Auto", "Stretch", "Small", "Medium", "Large")
            alt_text: Alternative text for accessibility
        """
        self.type = "Image"
        self.url = url
        if size:
            self.size = size
        if alt_text:
            self.altText = alt_text

Functions

__init__(url, size=None, alt_text=None)

Initialize an Image element.

Parameters:

Name Type Description Default
url str

Image URL

required
size Optional[str]

Image size ("Auto", "Stretch", "Small", "Medium", "Large")

None
alt_text Optional[str]

Alternative text for accessibility

None
Source code in src/fabias/notifications/cards/elements.py
def __init__(self, url: str, size: Optional[str] = None, alt_text: Optional[str] = None):
    """
    Initialize an Image element.

    Args:
        url: Image URL
        size: Image size ("Auto", "Stretch", "Small", "Medium", "Large")
        alt_text: Alternative text for accessibility
    """
    self.type = "Image"
    self.url = url
    if size:
        self.size = size
    if alt_text:
        self.altText = alt_text

fabias.notifications.cards.Table

Bases: CardElement

Table element for displaying tabular data.

Supports header rows and data rows with configurable column widths.

Attributes:

Name Type Description
type str

Always "Table"

columns list

Column definitions with widths

rows list

Table rows (header + data)

Examples:

>>> table = Table()
>>> table.setHeaders([
...     {"name": "Name", "width": 2},
...     {"name": "Status", "width": 1}
... ])
>>> table.addRow(["Item 1", "Active"])
>>> table.addRow(["Item 2", "Inactive"])
Source code in src/fabias/notifications/cards/elements.py
class Table(CardElement):
    """
    Table element for displaying tabular data.

    Supports header rows and data rows with configurable column widths.

    Attributes:
        type (str): Always "Table"
        columns (list): Column definitions with widths
        rows (list): Table rows (header + data)

    Examples:
        >>> table = Table()
        >>> table.setHeaders([
        ...     {"name": "Name", "width": 2},
        ...     {"name": "Status", "width": 1}
        ... ])
        >>> table.addRow(["Item 1", "Active"])
        >>> table.addRow(["Item 2", "Inactive"])
    """

    def __init__(self):
        """Initialize an empty Table element."""
        self.type = "Table"
        self.columns = []
        self.rows = []

    def setHeaders(self, header_data: List[Dict]) -> None:
        """
        Set the table header row.

        Args:
            header_data: List of header definitions, each containing:
                - width (int): Column width weight (default 1)
                - name (str, optional): Header text

        Examples:
            >>> table.setHeaders([
            ...     {"name": "Name", "width": 2},
            ...     {"name": "Value", "width": 1}
            ... ])
        """
        cells = []
        for header in header_data:
            self.columns.append({"width": header.get("width", 1)})

            name = header.get("name")
            if name:
                text_block = TextBlock(text=name, wrap=False, style="heading")
                cells.append({"type": "TableCell", "items": [text_block.to_dict()]})

        if cells:
            self.rows.append({"type": "TableRow", "cells": cells})

    def addRow(self, row_data: List) -> None:
        """
        Add a data row to the table.

        Args:
            row_data: List of cell values (will be converted to strings)

        Examples:
            >>> table.addRow(["John", "Active"])
            >>> table.addRow(["Jane", "Pending"])
        """
        cells = []

        for col in row_data:
            text_block = TextBlock(text=str(col), wrap=True)
            cells.append({"type": "TableCell", "items": [text_block.to_dict()]})

        self.rows.append({"type": "TableRow", "cells": cells})

Functions

__init__()

Initialize an empty Table element.

Source code in src/fabias/notifications/cards/elements.py
def __init__(self):
    """Initialize an empty Table element."""
    self.type = "Table"
    self.columns = []
    self.rows = []

addRow(row_data)

Add a data row to the table.

Parameters:

Name Type Description Default
row_data List

List of cell values (will be converted to strings)

required

Examples:

>>> table.addRow(["John", "Active"])
>>> table.addRow(["Jane", "Pending"])
Source code in src/fabias/notifications/cards/elements.py
def addRow(self, row_data: List) -> None:
    """
    Add a data row to the table.

    Args:
        row_data: List of cell values (will be converted to strings)

    Examples:
        >>> table.addRow(["John", "Active"])
        >>> table.addRow(["Jane", "Pending"])
    """
    cells = []

    for col in row_data:
        text_block = TextBlock(text=str(col), wrap=True)
        cells.append({"type": "TableCell", "items": [text_block.to_dict()]})

    self.rows.append({"type": "TableRow", "cells": cells})

setHeaders(header_data)

Set the table header row.

Parameters:

Name Type Description Default
header_data List[Dict]

List of header definitions, each containing: - width (int): Column width weight (default 1) - name (str, optional): Header text

required

Examples:

>>> table.setHeaders([
...     {"name": "Name", "width": 2},
...     {"name": "Value", "width": 1}
... ])
Source code in src/fabias/notifications/cards/elements.py
def setHeaders(self, header_data: List[Dict]) -> None:
    """
    Set the table header row.

    Args:
        header_data: List of header definitions, each containing:
            - width (int): Column width weight (default 1)
            - name (str, optional): Header text

    Examples:
        >>> table.setHeaders([
        ...     {"name": "Name", "width": 2},
        ...     {"name": "Value", "width": 1}
        ... ])
    """
    cells = []
    for header in header_data:
        self.columns.append({"width": header.get("width", 1)})

        name = header.get("name")
        if name:
            text_block = TextBlock(text=name, wrap=False, style="heading")
            cells.append({"type": "TableCell", "items": [text_block.to_dict()]})

    if cells:
        self.rows.append({"type": "TableRow", "cells": cells})

fabias.notifications.cards.Badge

Bases: CardElement

Badge element for displaying a badge/tag in a card.

Badges are small labels that can include icons and various styles.

Attributes:

Name Type Description
type str

Always "Badge"

text str

Badge text

size str

Badge size

style str

Badge style ("Accent", "Default", etc.)

icon str

Icon name

iconPosition str

Icon position relative to text

Examples:

>>> status = Badge("Active", style="Accent", icon="CheckMark")
>>> env = Badge("Production", style="Warning")
Source code in src/fabias/notifications/cards/elements.py
class Badge(CardElement):
    """
    Badge element for displaying a badge/tag in a card.

    Badges are small labels that can include icons and various styles.

    Attributes:
        type (str): Always "Badge"
        text (str): Badge text
        size (str): Badge size
        style (str): Badge style ("Accent", "Default", etc.)
        icon (str): Icon name
        iconPosition (str): Icon position relative to text

    Examples:
        >>> status = Badge("Active", style="Accent", icon="CheckMark")
        >>> env = Badge("Production", style="Warning")
    """

    def __init__(
        self,
        text: str,
        spacing: Optional[str] = None,
        horizontalAlignment: Optional[str] = None,
        size: Optional[str] = None,
        style: Optional[str] = "Accent",
        icon: Optional[str] = None,
        position: Optional[str] = None,
    ):
        """
        Initialize a Badge element.

        Args:
            text: Badge text
            spacing: Spacing around the badge
            horizontalAlignment: Horizontal alignment
            size: Badge size
            style: Badge style ("Accent", "Default", "Subtle")
            icon: Icon name
            position: Icon position ("Before", "After")
        """
        self.type = "Badge"
        self.text = text
        if size:
            self.size = size
        if spacing:
            self.spacing = spacing
        if style:
            self.style = style
        if horizontalAlignment:
            self.horizontalAlignment = horizontalAlignment
        if icon:
            self.icon = icon
        if position:
            self.iconPosition = position

Functions

__init__(text, spacing=None, horizontalAlignment=None, size=None, style='Accent', icon=None, position=None)

Initialize a Badge element.

Parameters:

Name Type Description Default
text str

Badge text

required
spacing Optional[str]

Spacing around the badge

None
horizontalAlignment Optional[str]

Horizontal alignment

None
size Optional[str]

Badge size

None
style Optional[str]

Badge style ("Accent", "Default", "Subtle")

'Accent'
icon Optional[str]

Icon name

None
position Optional[str]

Icon position ("Before", "After")

None
Source code in src/fabias/notifications/cards/elements.py
def __init__(
    self,
    text: str,
    spacing: Optional[str] = None,
    horizontalAlignment: Optional[str] = None,
    size: Optional[str] = None,
    style: Optional[str] = "Accent",
    icon: Optional[str] = None,
    position: Optional[str] = None,
):
    """
    Initialize a Badge element.

    Args:
        text: Badge text
        spacing: Spacing around the badge
        horizontalAlignment: Horizontal alignment
        size: Badge size
        style: Badge style ("Accent", "Default", "Subtle")
        icon: Icon name
        position: Icon position ("Before", "After")
    """
    self.type = "Badge"
    self.text = text
    if size:
        self.size = size
    if spacing:
        self.spacing = spacing
    if style:
        self.style = style
    if horizontalAlignment:
        self.horizontalAlignment = horizontalAlignment
    if icon:
        self.icon = icon
    if position:
        self.iconPosition = position

fabias.notifications.cards.ActionShowCard

Bases: ActionElement

Action that shows a nested card when clicked.

Useful for progressive disclosure of information, allowing users to expand additional details on demand.

Examples:

>>> details_card = Adaptive(body=[
...     TextBlock("Additional details here...")
... ])
>>> action = ActionShowCard(
...     icon="icon:Info",
...     title="Show Details",
...     card=details_card
... )
Source code in src/fabias/notifications/cards/actions.py
class ActionShowCard(ActionElement):
    """
    Action that shows a nested card when clicked.

    Useful for progressive disclosure of information, allowing
    users to expand additional details on demand.

    Examples:
        >>> details_card = Adaptive(body=[
        ...     TextBlock("Additional details here...")
        ... ])
        >>> action = ActionShowCard(
        ...     icon="icon:Info",
        ...     title="Show Details",
        ...     card=details_card
        ... )
    """

    def __init__(self, icon: str, title: str, card: Adaptive):
        """
        Initialize a ShowCard action.

        Args:
            icon: Icon URL or icon reference (e.g., "icon:Info")
            title: Action button title
            card: Adaptive card to show when clicked
        """
        super().__init__("Action.ShowCard", icon, title)
        self.card = card

Functions

__init__(icon, title, card)

Initialize a ShowCard action.

Parameters:

Name Type Description Default
icon str

Icon URL or icon reference (e.g., "icon:Info")

required
title str

Action button title

required
card Adaptive

Adaptive card to show when clicked

required
Source code in src/fabias/notifications/cards/actions.py
def __init__(self, icon: str, title: str, card: Adaptive):
    """
    Initialize a ShowCard action.

    Args:
        icon: Icon URL or icon reference (e.g., "icon:Info")
        title: Action button title
        card: Adaptive card to show when clicked
    """
    super().__init__("Action.ShowCard", icon, title)
    self.card = card

fabias.notifications.cards.ActionOpenUrl

Bases: ActionElement

Action that opens a URL when clicked.

Opens the specified URL in a new browser tab or the platform's default handler.

Examples:

>>> action = ActionOpenUrl(
...     icon="icon:Link",
...     title="Learn More",
...     url="https://example.com/docs"
... )
Source code in src/fabias/notifications/cards/actions.py
class ActionOpenUrl(ActionElement):
    """
    Action that opens a URL when clicked.

    Opens the specified URL in a new browser tab or the
    platform's default handler.

    Examples:
        >>> action = ActionOpenUrl(
        ...     icon="icon:Link",
        ...     title="Learn More",
        ...     url="https://example.com/docs"
        ... )
    """

    def __init__(self, icon: str, title: str, url: str, icon_url: Optional[str] = None):
        """
        Initialize an OpenUrl action.

        Args:
            icon: Icon URL or icon reference (e.g., "icon:Link")
            title: Action button title
            url: URL to open when clicked
            icon_url: Deprecated - use icon parameter
        """
        super().__init__("Action.OpenUrl", icon, title)
        self.url = url

Functions

__init__(icon, title, url, icon_url=None)

Initialize an OpenUrl action.

Parameters:

Name Type Description Default
icon str

Icon URL or icon reference (e.g., "icon:Link")

required
title str

Action button title

required
url str

URL to open when clicked

required
icon_url Optional[str]

Deprecated - use icon parameter

None
Source code in src/fabias/notifications/cards/actions.py
def __init__(self, icon: str, title: str, url: str, icon_url: Optional[str] = None):
    """
    Initialize an OpenUrl action.

    Args:
        icon: Icon URL or icon reference (e.g., "icon:Link")
        title: Action button title
        url: URL to open when clicked
        icon_url: Deprecated - use icon parameter
    """
    super().__init__("Action.OpenUrl", icon, title)
    self.url = url