Creating Zinc Message Cards
To create Message Cards, you send a JSON payload to the Messaging API endpoint, and specify the content in the template field.
Example
{
"template": {
"link": "https://www.example.com/external/record/page",
"preview": {
"header": {
"title": "Message Card Title",
"subtitle": "Text that supports the title",
"image_url": "https://api.example.com/photo.jpeg"
},
"sections": [
{
"type": "paragraph",
"text": "A few sentences of text that will appear on the card in the timeline. You can addanything you like."
}
],
"actions": [
{
"url": "https://api.example.com/some/action",
"type": "postback",
"text": "Click Here",
"payload": "random=information"
}
]
},
"details": {
"header": {
"title": "Message Card Title",
"subtitle": "Supporting text, which can be different from preview header",
"image_url": "https://api.example.com/photo.jpeg"
},
"sections": [
{
"type": "paragraph",
"text": "A few sentences of text that will appear on the card in the timeline. You can add
anything you like."
},
{
"type": "key_value",
"values": [
{
"label": "Name",
"value": "Foobert Bar"
},
{
"label": "Occupation",
"value": "Example Message Card"
},
{
"label": "Date of Birth",
"value": "December 10th 2019"
}
]
}
],
"actions": [
{
"url": "https://api.example.com/some/action",
"type": "postback",
"text": "Click Here",
"payload": "random=information"
},
{
"url": "https://www.example.com",
"type": "web_url",
"text": "Go to Example"
}
]
}
}
}
Top-Level Message Card Attributes
Attribute
Description
preview
Object that describes Preview Card content. Required.
details
Object that describes Detail Card content. Optional.
link
URL to be opened directly from Preview Cards or via the External Link icon on Detail Cards.
Preview and Details Attributes
The preview and details objects have the same attributes, but can describe different data. There is no need for the same data to be used in both objects.
Attribute
Description
header
Object that contains fields that appear at the top of Message Cards.
sections
Array of section objects.
Header Attributes
The header object in both Preview Cards and Detail Cards has the same attributes.
Attribute
Description
title
Title content for Preview Cards.
subtitle
Subtitle content for Preview Cards.
image_url
Image URLs for Preview Cards.
Section Object Attributes
These attributes for the section array can be used in both Preview Cards and Detail Cards.
Attribute
Description
type
The section type. Valid values are paragraph or key_value.
text
Text in paragraphs. Valid only for paragraph-type section objects. Markdown is supported in this field.
values
Values in key-value arrays. Valid only for key_value-type section objects.
Key-Value Object Attributes
Attribute
Description
label
The field label (the key).
value
The field value (the value).
Action Object Attributes
Action objects can be used in both Preview Cards and Detail Cards. You can specify different actions in each Message Card type.
Attribute
Description
type
The action type. Acceptable values are:
postback: Triggers an HTTP POST request, optionally with a specified data payload.
web_url: Triggers an HTTP GET request to open the specified URL in a web browser.
url
The URL associated with the action.
text
Button text.
payload
Form keys and values to send along with HTTP POST requests. Valid only for postback-type action objects.
For more information:
Was this helpful?