pub struct Message<'a> { /* private fields */ }Expand description
Main object representing a teams message.
Implementations§
Source§impl<'a> Message<'a>
impl<'a> Message<'a>
Sourcepub fn new() -> Message<'a>
pub fn new() -> Message<'a>
Create a new, empty message.
The message @type and @context are automatically set upon creation, since these always have the same values.
Sourcepub fn summary(self, s: impl ToString) -> Self
pub fn summary(self, s: impl ToString) -> Self
Required if the card does not contain a text property, otherwise optional.
The summary property is typically displayed in the list view in Outlook,
as a way to quickly determine what the card is all about.
Do always include a summary.
Don’t include details in the summary. For example, for a Twitter post, a summary might simply read “New tweet from @someuser” without mentioning the content of the tweet itself.
Sourcepub fn theme_color(self, c: impl ToString) -> Self
pub fn theme_color(self, c: impl ToString) -> Self
Specifies a custom brand color for the card. The color will be displayed in a non-obtrusive manner.
Sourcepub fn correlation_id(self, id: usize) -> Self
pub fn correlation_id(self, id: usize) -> Self
The correlationId property simplifies the process of locating logs for
troubleshooting issues. We recommend that when sending an actionable card,
your service should set and log a unique UUID in this property.
When the user invokes an action on the card, Office 365 sends the Card-Correlation-Id
and Action-Request-Id headers in the POST request to your service.
Card-Correlation-Id contains the same value as the correlationId
property in the card. Action-Request-Id is a unique UUID generated by
Office 365 to help locate specific action performed by a user. Your
service should log both of these values when receiving action POST requests.
Sourcepub fn expected_actors<I>(self, v: I) -> Self
pub fn expected_actors<I>(self, v: I) -> Self
Optional. This contains a list of expected email addresses of the recipient for the action endpoint.
A user can have multiple email addresses and the action endpoint might
not be expecting the particular email address presented in the sub claim
of the bearer token. For example, a user could have both the john.doe@contoso.com
or john@contoso.com email address, but the action endpoint expects to receive
john@contoso.com in the sub claim of the bearer token. By setting
this field to ["john@contoso.com"], the sub claim will have the
expected email address.
Sourcepub fn originator(self, s: impl ToString) -> Self
pub fn originator(self, s: impl ToString) -> Self
Required when sent via email, not applicable when sent via connector. For actionable email, MUST be set to the provider ID generated by the Actionable Email Developer Dashboard.
Sourcepub fn hide_original_body(self, b: bool) -> Self
pub fn hide_original_body(self, b: bool) -> Self
Only applies to cards in email messages
When set to true, causes the HTML body of the message to be hidden. This is very useful in scenarios where the card is a better or more useful representation of the content than the HTML body itself, which is especially true when the card contains actions (see below.)
Consider hiding the original HTML body:
- If the card itself contains all the information a user would need
- If the content of the card is redundant with the content of the body
Do always include a nice HTML body, even if it is going to be hidden. The HTML body is the only thing an email client that doesn’t support cards will be able to display. Furthermore, cards are not included when replying to or forwarding emails, only the HTML body.
Don’t hide the body when it is complementary to the information presented in the card. For example, the body of an expense report approval might describe the report in great details while the card just presents a quick summary along with approve/decline actions.
Sourcepub fn title(self, s: impl ToString) -> Self
pub fn title(self, s: impl ToString) -> Self
The title property is meant to be rendered in a prominent way, at the
very top of the card. Use it to introduce the content of the card in such
a way users will immediately know what to expect.
Examples:
- Daily news
- New bug opened
- Task
assigned
Do keep title short, don’t make it a long sentence.
Do mention the name of the entity being referenced in the title.
Don’t use hyperlinks (via Markdown) in the title.
Sourcepub fn text(self, s: impl ToString) -> Self
pub fn text(self, s: impl ToString) -> Self
Required if the card does not contain a summary property, otherwise optional.
The text property is meant to be displayed in a normal font below the card’s
title. Use it to display content, such as the description of the entity
being referenced, or an abstract of a news article.
Do use simple Markdown, such as bold or italics to emphasize words, and links to external resources.
Don’t include any call to action in the text property. Users should be able to not read it and still understand what the card is all about.