Skip to main content

Actionable messages

Project description

Actionable messages

github pypi python django license

  1. Base informations
  2. Installation
  3. Requirements
  4. Usage
  5. AdaptiveCard
  6. MessageCard
  7. HeroCard
  8. ThumbnailCard

Base informations

Playground V2

Send an actionable message via email in Office 365

Outlook version requirements for actionable messages

Installation

pip install git+https://github.com/utsurius/django-actionable-messages

pip install django-actionable-messages

Add "django_actionable_messages" to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django_actionable_messages",
]

SETTINGS

ACTIONABLE_MESSAGES = {
    "JSON_ENCODER": None,
    "LANGUAGE_CODE": "en"
}

"JSON_ENCODER" - doted path to custom json encoder (default: BaseEncoder).

"LANGUAGE_CODE" - language code used for translations (defaults to project settings.LANGUAGE_CODE). Each element of adaptive_card/message_card can set individual "lang_code".

Requirements

Name Version
python 3.6 - 3.10
django 3.2 - 4.2

Usage

examples/message_card/github.py

from django_actionable_messages.message_card.actions import OpenUri, HttpPOST, ActionCard
from django_actionable_messages.message_card.cards import MessageCard
from django_actionable_messages.message_card.elements import Fact, ActionTarget
from django_actionable_messages.message_card.inputs import TextInput
from django_actionable_messages.message_card.sections import Section
from django_actionable_messages.message_card.utils import OSType


issue_opened = MessageCard(title="Issue opened: \"Push notifications not working\"", summary="Issue 176715375",
                           theme_color="0078D7")
issue_opened.add_sections(
    Section(
        activity_title="Miguel Garcie",
        activity_subtitle="9/13/2016, 11:46am",
        activity_image="https://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
        text="There is a problem with Push notifications, they don't seem to be picked up by the connector.",
        facts=[
            Fact("Repository:", "mgarcia\\test"),
            Fact("Issue #:", "176715375")
        ]
    )
)
issue_opened.add_actions([
    ActionCard(
        name="Add a comment",
        inputs=[
            TextInput(input_id="comment", title="Enter a comment", is_multiline=True)
        ],
        actions=[
            HttpPOST("OK", target="http://...")
        ]
    ),
    HttpPOST("Close", target="http://..."),
    OpenUri(name="View in Github", targets=[
        ActionTarget(OSType.DEFAULT, "http://...")
    ])
])

examples/adaptive_card/calendar_reminder.py

from django_actionable_messages.adaptive_card.actions import Submit
from django_actionable_messages.adaptive_card.cards import AdaptiveCard
from django_actionable_messages.adaptive_card.elements import TextBlock
from django_actionable_messages.adaptive_card.inputs import InputChoice, ChoiceSetInput
from django_actionable_messages.adaptive_card.utils import SCHEMA, FontSize, FontWeight, SpacingStyle, ChoiceInputStyle


calendar_reminder = AdaptiveCard(version="1.0", schema=SCHEMA)
calendar_reminder.set_speak("Your  meeting about \"Adaptive Card design session\" is starting at 12:30pm"
                            "Do you want to snooze  or do you want to send a late notification to the attendees?")
calendar_reminder.add_elements(TextBlock("Adaptive Card design session", size=FontSize.LARGE, weight=FontWeight.BOLDER))
calendar_reminder.add_elements([
    TextBlock("Conf Room 112/3377 (10)", is_subtle=True),
    TextBlock("12:30 PM - 1:30 PM", is_subtle=True, spacing=SpacingStyle.NONE),
    TextBlock("Snooze for")
])
calendar_reminder.add_elements(ChoiceSetInput(
    item_id="snooze", style=ChoiceInputStyle.COMPACT, value="5", choices=[
        InputChoice("5 minutes", "5"),
        InputChoice("15 minutes", "15"),
        InputChoice("30 minutes", "30")
    ]
))
calendar_reminder.add_actions([
    Submit(title="Snooze", data={
        "x": "snooze"
    }),
    Submit(title="I'll be late", data={
        "x": "late"
    })
])

For more view examples folder

To get dictionary, json or html payload from card use:

Property Type
.payload dict (raw data)
.json_payload json string
.html_payload html string - can be used to send card via email (docs)
.signed_html_payload html string1 - can be used to send card via email (docs)

[1] you must overwrite get_signed_payload() in AdaptiveCard/MessageCard to sign the payload!

Problem: '... is not JSON serializable' - probably invalid argument type was used. Default json serializer can handle translated strings and everything that DjangoJSONEncoder can handle.

Solution: Better Python Object Serialization. Remember to ALWAYS inherit from EncoderMixin or BaseEncoder (django_actionable_messages.encoders import EncoderMixin, BaseEncoder)

You can set JSON_ENCODER (globally) in SETTINGS(ACTIONABLE_MESSAGES) or set it by card(json_encoder):

from django_actionable_messages.adaptive_card.cards import AdaptiveCard


class MyAdaptiveCard(AdaptiveCard):
    json_encoder = "path.to.my.encoder"

or

from django_actionable_messages.adaptive_card.cards import AdaptiveCard


class MyAdaptiveCard(AdaptiveCard):
    json_encoder = MyJSONEncoder

To customize json dump you can overwrite get_json_dump_kwargs() in card (AdaptiveCard/MessageCard)

from django_actionable_messages.adaptive_card.cards import AdaptiveCard


class MyAdaptiveCard(AdaptiveCard):
    def get_json_dump_kwargs(self):
        return {
            'ensure_ascii': False,
            'indent': 2
        }

Send MessageCard to msteams using webhooks and requests library:

import requests


requests.post(
    webhook_url,
    data=card.json_payload,
    headers={
        "Content-Type": "application/json; charset=utf-8"
    }
)

To get/add webhook_url see here: Get the Microsoft Teams webhook URL, Create and add an outgoing webhook in Teams

AdaptiveCard

Supported versions: 1.0 - 1.6

Schema Explorer

Elements

src: from django_actionable_messages.adaptive_card.elements import ...

TextBlock docs

Argument name Function Property Type
text - text str, trans3
color set_color() color Color1
font_type set_font_type() fontType FontType1
horizontal_alignment set_horizontal_alignment() horizontalAlignment HorizontalAlignment1
is_subtle set_is_subtle() isSubtle bool
max_lines set_max_lines() maxLines int
size set_size() size FontSize1
weight set_weight() weight FontWeight1
wrap set_wrap() wrap bool
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Image docs

Argument name Function Property Type
url set_url() url str
alternate_text set_alternate_text() altText str
background_color set_background_color() backgroundColor str
height set_height() height str or BlockElementHeight1
horizontal_alignment set_horizontal_alignment() horizontalAlignment HorizontalAlignment1
select_action set_select_action() selectAction see docs
size set_size() size ImageSize1
style set_style() style ImageStyle1
width set_width() width str
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

MediaSource docs

Argument name Property Type
mime_type mimeType str
url url str

CaptionSource docs

Argument name Property Type
mime_type mimeType str
url url str
label label str

Media docs

Argument name Function Property Type
sources - sources list of MediaSource(s)1
poster set_poster() poster str
alternate_text set_alternate_text() altText str
fallback set_fallback() fallback FallbackOption2 or card element1
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2
lang_code - - str

Other functions

Name Property Type
add_sources() sources MediaSource1
add_source() sources MediaSource1
set_caption_sources() captionSources CaptionSource2
add_caption_sources() captionSources CaptionSource2
add_caption_source() captionSources CaptionSource2

[1] from django_actionable_messages.adaptive_cards.elements import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

TextRun docs

Argument name Function Property Type
text - text str, trans 2
color set_color() color Color1
font_type set_font_type() fontType FontType1
highlight set_highlight() highlight bool
is_subtle set_is_subtle() isSubtle bool
italic set_italic() italic bool
select_action set_select_action() selectAction see docs
size set_size() fontSize FontSize1
strike_through set_strike_through() strikethrough bool
weight set_weight() fontWeight FontWeight1
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] any translation like from django.utils.translation import gettext, gettext_lazy, ...

RichTextBlock docs

Argument name Function Property Type
inlines - inlines str, TextRun1, trans4
horizontal_alignment set_horizontal_alignment() horizontalAlignment HorizontalAlignment2
fallback set_fallback() fallback FallbackOption2 or card element1
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2

[1] from django_actionable_messages.adaptive_cards.elements import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[4] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Inputs

src: from django_actionable_messages.adaptive_card.inputs import ...

TextInput docs

Argument name Function Property Type
is_multiline set_is_multiline() isMultiline bool
max_length set_max_length() maxLength int
placeholder set_placeholder() placeholder str, trans3
style set_style() style TextInputStyle1
inline_action set_inline_action() inlineAction see docs
value set_value() value str, trans3
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
label set_label() label str, TextBlock4, RichTextBlock4
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[4] from django_actionable_messages.adaptive_cards.elements import ...

NumberInput docs

Argument name Function Property Type
max_value set_max_value() maxValue int
min_value set_min_value() minValue int
placeholder set_placeholder() placeholder str, trans3
value set_value() value int
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
label set_label() label str, TextBlock4, RichTextBlock4
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[4] from django_actionable_messages.adaptive_cards.elements import ...

DateInput docs

Argument name Function Property Type
max_value set_max_value() maxValue str
min_value set_min_value() minValue str
placeholder set_placeholder() placeholder str, trans3
value set_value() value str
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
label set_label() label str, TextBlock4, RichTextBlock4
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[4] from django_actionable_messages.adaptive_cards.elements import ...

TimeInput docs

Argument name Function Property Type
max_value set_max_value() maxValue str
min_value set_min_value() minValue str
placeholder set_placeholder() placeholder str, trans3
value set_value() value str
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
label set_label() label str, TextBlock4, RichTextBlock4
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[4] from django_actionable_messages.adaptive_cards.elements import ...

ToggleInput docs

Argument name Function Property Type
title - title str, trans3
value set_value() value str
value_off set_value_off() valueOff str
value_on set_value_on() valueOn str
wrap set_wrap() wrap bool
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
label set_label() label str, TextBlock4, RichTextBlock4
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[4] from django_actionable_messages.adaptive_cards.elements import ...

InputChoice docs

Argument name Property Type
title title str, trans1
value value str, int
lang_code - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

ChoiceSetInput docs

Argument name Function Property Type
choices - choices list of InputChoice(s)1
is_multi_select set_is_multi_select() isMultiSelect bool
style set_style() style ChoiceInputStyle2
value set_value() value str
wrap set_wrap() wrap bool
fallback set_fallback() fallback FallbackOption2 or card element3
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2
label set_label() label str, TextBlock4, RichTextBlock4
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.inputs import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

[4] from django_actionable_messages.adaptive_cards.elements import ...

DataQuery docs

Argument name Function Property Type
dataset set_dataset() dataset str
count set_count() count int
skip set_skip() skip int

Actions

src: from django_actionable_messages.adaptive_card.actions import ...

OpenUrl docs

Argument name Function Property Type
url - url str
title set_title() title str, trans3
icon_url set_icon_url() iconUrl str
style set_style() style ActionStyle2
item_id set_id() id str
fallback set_fallback() fallback FallbackOption2 or action1(except TargetElement1)
tooltip set_tooltip() tooltip str
is_enabled set_is_enabled() isEnabled bool
mode set_mode() mode ActionMode2
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.actions import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Submit docs

Argument name Function Property Type
data set_data() data str, dict
title set_title() title str, trans3
icon_url set_icon_url() iconUrl str
style set_style() style ActionStyle2
item_id set_id() id str
fallback set_fallback() fallback FallbackOption2 or action1(except TargetElement1)
tooltip set_tooltip() tooltip str
is_enabled set_is_enabled() isEnabled bool
mode set_mode() mode ActionMode2
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.actions import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

ShowCard docs

Argument name Function Property Type
card set_card() card AdaptiveCard2
title set_title() title str, trans4
icon_url set_icon_url() iconUrl str
style set_style() style ActionStyle3
item_id set_id() id str
fallback set_fallback() fallback FallbackOption3 or action1(except TargetElement1)
tooltip set_tooltip() tooltip str
is_enabled set_is_enabled() isEnabled bool
mode set_mode() mode ActionMode3
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.actions import ...

[2] from django_actionable_messages.adaptive_cards.cards import ...

[3] from django_actionable_messages.adaptive_cards.utils import ...

[4] any translation like from django.utils.translation import gettext, gettext_lazy, ...

TargetElement docs

Argument name Function Property Type
element_id - elementId str
is_visible set_is_visible() isVisible bool

ToggleVisibility docs

Argument name Function Property Type
target_elements set_target_elements() targetElements list of TargetElement1/str/trans3 (can be mixed)
title set_title() title str
icon_url set_icon_url() iconUrl str
style set_style() style ActionStyle2
item_id set_id() id str
fallback set_fallback() fallback FallbackOption1 or action1(except TargetElement1)
tooltip set_tooltip() tooltip str
is_enabled set_is_enabled() isEnabled bool
mode set_mode() mode ActionMode2
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.actions import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Execute docs

Argument name Function Property Type
verb set_verb() verb str
data set_data() data str, object
associated_inputs set_associated_inputs() associatedInputs AssociatedInputs1
title set_title() title str
icon_url set_icon_url() iconUrl str
style set_style() style ActionStyle1
fallback set_fallback() fallback FallbackOption1 or action2(except TargetElement2)
tooltip set_tooltip() tooltip str
is_enabled set_is_enabled() isEnabled bool
mode set_mode() mode ActionMode1
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_card.utils import ...

[2] from django_actionable_messages.adaptive_card.actions import ...

Containers

src: from django_actionable_messages.adaptive_card.containers import ...

ActionSet docs

Argument name Function Property Type
actions add_actions() actions action or list of actions(see docs)
fallback set_fallback() fallback FallbackOption1 or card element2
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle1
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight1
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

Container docs

Argument name Function Property Type
items add_items() items item or list of items(see docs)
select_action set_select_action() selectAction any action(see docs)
style set_style() style Style2
vertical_content_alignment set_vertical_content_alignment() verticalContentAlignment VerticalAlignment2
bleed set_bleed() bleed bool
background_image set_background_image() backgroundImage BackgroundImage1
min_height set_min_height() minHeight str
rtl set_rtl() rtl bool
fallback set_fallback() fallback FallbackOption2 or card element3
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.types import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

Column docs

Argument name Function Property Type
items add_items() items item or list of items(see docs)
background_image set_background_image() backgroundImage str, BackgroundImage2
bleed set_bleed() bleed bool
fallback set_fallback() fallback FallbackOption3 or Column1
min_height set_min_height() minHeight str
rtl set_rtl() rtl bool
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle3
select_action set_select_action() selectAction see docs
style set_style() style Style3
vertical_content_alignment set_vertical_content_alignment() verticalContentAlignment VerticalAlignment3
width set_width() width str, int, Width3
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.containers import ...

[2] from django_actionable_messages.adaptive_cards.types import ...

[3] from django_actionable_messages.adaptive_cards.utils import ...

ColumnSet docs

Argument name Function Property Type
columns add_columns() columns Column1 or list of Column(s)1
select_action set_select_action() selectAction see docs
style set_style() style Style2
bleed set_bleed() bleed bool
min_height set_min_height() minHeight str
fallback set_fallback() fallback FallbackOption2 or card element3
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.containers import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

Fact docs

Argument name Property Type
title title str, trans1
value value str, trans1
lang_code - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

FactSet docs

Argument name Function Property Type
facts add_facts() facts Fact1 or list of Fact(s)1
fallback set_fallback() fallback FallbackOption2 or card element3
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.containers import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

ImageSet docs

Argument name Function Property Type
images add_images() images Image1 or list of Image(s)1
image_size set_image_size() imageSize ImageSize2
fallback set_fallback() fallback FallbackOption2 or card element3
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
height set_height() height BlockElementHeight2
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.elements import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.elements import ...

Type All except Import
containers Fact, Column from django_actionable_messages.adaptive_cards.containers import ...
elements MediaSource, TextRun from django_actionable_messages.adaptive_cards.elements import ...
inputs InputChoice from django_actionable_messages.adaptive_cards.inputs import ...

TableCell docs

Argument name Function Property Type
select_action set_select_action() selectAction Execute1, OpenUrl1, Submit1 or ToggleVisibility1
style set_style() style Style2
vertical_content_alignment set_vertical_content_alignment() verticalContentAlignment VerticalAlignment2
bleed set_bleed() bleed bool
background_image set_background_image() backgroundImage BackgroundImage3 or str
min_height set_min_height() minHeight str
rtl set_rtl() rtl bool
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.actions import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.types import ...

TableRow

Argument name Function Property Type
cells add_cells() cells TableCell1
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.containers import ...

Table docs

Argument name Function Property Type
columns add_columns() columns dict
rows add_rows() rows TableRow1 or list of TableRow1
horizontal_cell_content_alignment set_horizontal_cell_content_alignment() horizontalCellContentAlignment HorizontalAlignment2
vertical_cell_content_alignment set_vertical_cell_content_alignment() verticalCellContentAlignment VerticalAlignment2
first_row_as_header set_first_row_as_header() firstRowAsHeader bool
show_grid_lines set_show_grid_lines() showGridLines bool
grid_style set_grid_style() style Style2
height set_height() height BlockElementHeight2
fallback set_fallback() fallback FallbackOption2 or card element3
separator set_separator() separator bool
spacing set_spacing() spacing SpacingStyle2
item_id set_id() id str
is_visible set_is_visible() isVisible bool
requires set_requires() requires dict
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.containers import ...

[2] from django_actionable_messages.adaptive_cards.utils import ...

[3] from django_actionable_messages.adaptive_cards.elements import ...

Types

src: from django_actionable_messages.adaptive_card.types import ...

BackgroundImage docs

Argument name Function Property Type
url set_url() url str
fill_mode set_fill_mode() fillMode FillMode1
horizontal_alignment set_horizontal_alignment() horizontalAlignment HorizontalAlignment1
vertical_alignment set_vertical_alignment() verticalAlignment VerticalAlignment1

[1] from django_actionable_messages.adaptive_cards.utils import ...

Refresh docs

Argument name Function Property Type
action set_action() action Execute1
expires set_expires() expires str (ISO-8601)
user_ids set_user_ids() list list of str

[1] from django_actionable_messages.adaptive_cards.actions import ...

TokenExchangeResource docs

Argument name Function Property Type
token_id - id str
uri - uri str
provider_id - providerId str

AuthCardButton docs

Argument name Function Property Type
btn_type - type str
value - value str
title set_title() title str
image set_image() image str

Authentication docs

Argument name Function Property Type
text set_text() text str
connection_name set_connection_name() connectionName str
token_exchange_resource set_token_exchange_resource() tokenExchangeResource TokenExchangeResource1
buttons set_buttons() buttons list of AuthCardButton1

[1] from django_actionable_messages.adaptive_cards.types import ...

Metadata docs

Argument name Function Property Type
url set_url() webUrl str

Cards

src: from django_actionable_messages.adaptive_card.cards import ...

AdaptiveCard docs

Argument name Function Property Type
version set_version() version str, SCHEMA1
schema set_schema() $schema str
refresh set_refresh() refresh Refresh3
authentication set_authentication() authentication Authentication3
inputs add_elements() inputs input or list of inputs(see docs)
actions add_actions() actions action or list of actions(see docs)
select_action set_select_action() selectAction see docs
style set_style() style Style1
hide_original_body set_hide_original_body() hideOriginalBody bool
fallback_text set_fallback_text() fallbackText str
background_image set_background_image() backgroundImage str, Image2
metadata set_metadata() metadata Metadata3
min_height set_min_height() minHeight str
speak set_speak() speak str
lang set_lang() lang str
rtl set_rtl() rtl bool
vertical_content_alignment set_vertical_content_alignment() verticalContentAlignment VerticalAlignment1
lang_code - - str

[1] from django_actionable_messages.adaptive_cards.utils import ...

[2] from django_actionable_messages.adaptive_cards.elements import ...

[3] from django_actionable_messages.adaptive_cards.types import ...

MessageCard

Legacy actionable message card reference

Elements

src: from django_actionable_messages.message_card.elements import ...

Header docs

Argument name Property Type
name name str
value value str, int

**Fact**

Argument name Property Type
name name str, trans1
value value str, trans1
lang_code - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

HeroImage docs

Argument name Function Property Type
url - image str
title set_title() title str, trans1
lang_code - - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

InputChoice

Argument name Property Type
name display str, trans1
value value str, int
lang_code - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

ActionTarget

Argument name Property Type
os_type os OSType1
url uri str
lang_code - str

[1] from django_actionable_messages.message_cards.utils import ...

Inputs

src: from django_actionable_messages.message_card.inputs import ...

TextInput docs

Argument name Function Property Type
max_length set_max_length() maxLength int
is_multiline set_is_multiline() isMultiline bool
input_id set_id() id str
title set_title() title str, trans1
value set_value() value str
is_required set_is_required() isRequired bool
lang_code - - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

DateInput docs

Argument name Function Property Type
include_time set_include_time() maxLength bool
input_id set_id() id str
title set_title() title str, trans1
value set_value() value str
is_required set_is_required() isRequired bool
lang_code - - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

MultiChoiceInput docs

Argument name Function Property Type
choices add_choices() choices list of InputChoice(s)1
is_multi_select set_is_multi_select() isMultiSelect bool
style set_style() style ChoiceStyle2
input_id set_id() id str
title set_title() title str, trans3
value set_value() value str
is_required set_is_required() isRequired bool
lang_code - - str

Other functions

Name Property Type
add_choice() choices InputChoice1

[1] from django_actionable_messages.message_cards.inputs import ...

[2] from django_actionable_messages.message_cards.utils import ...

[3] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Actions

src: from django_actionable_messages.message_card.actions import ...

OpenUri docs

Argument name Function Property Type
name - name str, trans2
targets add_targets() targets list of ActionTarget1
lang_code - - str

Other functions

Name Property Type
add_target() targets ActionTarget1
add_targets() targets list of ActionTarget1

[1] from django_actionable_messages.message_cards.elements import ...

[2] any translation like from django.utils.translation import gettext, gettext_lazy, ...

HttpPOST docs

Argument name Function Property Type
name - name str, trans2
target - targets str
headers add_headers() headers Header1 or list of Header(s)1
body set_body() body str
body_content_type set_body_content_type() bodyContentType str
lang_code - - str

[1] from django_actionable_messages.message_cards.elements import ...

[2] any translation like from django.utils.translation import gettext, gettext_lazy, ...

InvokeAddInCommand docs

Argument name Function Property Type
name - name str, trans1
add_in_id set_add_in_id() addInId str
desktop_command_id set_desktop_command_id() desktopCommandId str
initialization_context set_set_initialization_context() initializationContext dict
lang_code - - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

ActionCard docs

Argument name Function Property Type
name - name str, trans1
inputs add_inputs() inputs input or list of inputs(see docs)
actions add_actions() actions action or list of actions(see docs)
lang_code - - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Sections

src: from django_actionable_messages.message_card.sections import ...

Section docs

Argument name Function Property Type
start_group set_start_group() startGroup bool
title set_title() title str, trans2
text set_text() text str, trans2
activity_image set_activity_image() activityImage str
activity_title set_activity_title() activityTitle str, trans2
activity_subtitle set_activity_subtitle() activitySubtitle str, trans2
activity_text set_activity_text() activityText str, trans2
hero_image set_hero_image() heroImage HeroImage2
facts add_facts() facts Fact(s)1 or list of Fact1
actions add_potential_actions() potentialAction action or list of actions(see docs)
lang_code - - str

Other functions:

Name Property Type
set_activity(image, title, subtitle, text) activityImage, activityTitle, activitySubtitle, activityText str

[1] from django_actionable_messages.message_cards.elements import ...

[2] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Cards

src: from django_actionable_messages.message_card.cards import ...

MessageCard

Argument name Function Property Type
title set_title() title str, trans2
text set_text() text str, trans2
originator set_originator() originator str
summary set_summary() summary str, trans2
theme_color set_theme_color() themeColor str
correlation_id set_correlation_id() correlationId str
auto_correlation_id* - correlationId bool (default: True)
expected_actors set_expected_actors() expectedActors list of emails
hide_original_body set_hide_original_body() hideOriginalBody bool
sections add_sections() sections Section1 or list of Sections1
actions add_actions() potentialAction action3 or list of actions3
lang_code - - str

Other functions:

Name Property Type
add_expected_actors() expectedActors str or list of str

[1] from django_actionable_messages.message_cards.sections import ...

[2] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[3] from django_actionable_messages.message_cards.actions import ...

HeroCard

Elements

OpenUrl

Argument name Function Property Type
title - title str, trans1
url - value str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Image

Argument name Function Property Type
url - value str
alt set_alt() alt str, trans1

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

Cards

src: from django_actionable_messages.msteams_cards.cards import HeroCard

HeroCard docs

Argument name Function Property Type
title set_title() title str, trans1
subtitle set_subtitle() subtitle str, trans1
text set_text() text str, trans1
images add_images() images Image2 or list of Images2
buttons add_buttons() buttons OpenUrl3 or list of OpenUrls3
lang_code - - str

[1] any translation like from django.utils.translation import gettext, gettext_lazy, ...

[2] from django_actionable_messages.msteams_cards.elements import Image

[3] from django_actionable_messages.msteams_cards.elements import OpenUrl

ThumbnailCard

Elements

see HeroCard Elements section

Cards

src: from django_actionable_messages.msteams_cards.cards import ThumbnailCard

ThumbnailCard docs

see HeroCard HeroCard section

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_actionable_messages-0.2.7.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

django_actionable_messages-0.2.7-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

Details for the file django_actionable_messages-0.2.7.tar.gz.

File metadata

File hashes

Hashes for django_actionable_messages-0.2.7.tar.gz
Algorithm Hash digest
SHA256 9e7a6bcdf7ced879754780369c8048717e7bdb8ac1896750f9888d9614306a17
MD5 516962fde71e1cc73034bc178923d69c
BLAKE2b-256 22890e8044bfc0378c969489beb6275a52075f5c40f9938ab30a91ced7fa237c

See more details on using hashes here.

File details

Details for the file django_actionable_messages-0.2.7-py3-none-any.whl.

File metadata

File hashes

Hashes for django_actionable_messages-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8d91c2b950dcd7720d48b8d46c44c5ab88e4bb41d7e4bcc0b6a5bb3dfed132fa
MD5 879eb5706d3e68f673c7b50c9664efb4
BLAKE2b-256 7acdf7d27fb5b87ef4d6dcde94090a46daf4c047eafc4b6d71c3887cc0cb1c00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page