Skip to content

Instantly share code, notes, and snippets.

@frsechet
Created May 3, 2020 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frsechet/ad0f371cef0f27ae26efd28de87a8436 to your computer and use it in GitHub Desktop.
Save frsechet/ad0f371cef0f27ae26efd28de87a8436 to your computer and use it in GitHub Desktop.
Messenger/workplace chat coverage of CSML components
start:
say "His palms are sweaty, knees weak, arms are heavy"
say Text("There's vomit on his sweater already, mom's spaghetti")
say "He's _nervous_, but **on the surface** he looks ~calm and ready~"
say Typing(2000)
say Question("Hi! My name is:", buttons=[Button("What?"), Button("Who?")])
say Question(
"Hi! My name is:",
button_type="quick_reply",
buttons=[
Button("What?", payload="btn1"),
Button("Who?", payload="btn2"),
]
)
say Image("https://images.unsplash.com/photo-1560114928-40f1f1eb26a0")
say Video("https://cdn.csml.dev/customers/93bfb0df-fb6b-4ed2-87b0-8d93a09b0ad8/files/cbaa0959-fe58-4a2a-89c3-c414a1f38748/big_buck_bunny.mp4")
say Audio("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
say File("https://cdn.csml.dev/customers/93bfb0df-fb6b-4ed2-87b0-8d93a09b0ad8/files/9671b178-834e-4f5e-9b39-3a9483049822/nuclearcodes.pdf")
say Url("https://www.wikipedia.org/")
do card1 = Card(
"The Marshall Mathers LP",
subtitle="Release date: May 23, 2000",
image_url="https://upload.wikimedia.org/wikipedia/en/a/ae/The_Marshall_Mathers_LP.jpg",
default_action=Url("https://www.eminem.com/"),
buttons=[
Button("Listen to this album", payload="marshallmatherslp1"),
Url("https://www.eminem.com/", text="Visit eminem.com"),
]
)
do card2 = Card(
"The Slim Shady LP",
subtitle="Release date: February 23, 1999",
image_url="https://upload.wikimedia.org/wikipedia/en/3/35/Eminem_-_The_Slim_Shady_LP_CD_cover.jpg",
default_action=Url("https://www.eminem.com/"),
buttons=[
Button("Listen to this album", payload="theslimshadylp"),
Url("https://www.eminem.com/", text="Visit eminem.com"),
]
)
do card3 = Card(
"The Marshall Mathers LP 2",
subtitle="Release date: November 5, 2013",
image_url="https://upload.wikimedia.org/wikipedia/en/8/87/The_Marshall_Mathers_LP_2.png",
default_action=Url("https://www.eminem.com/"),
buttons=[
Button("Listen to this album", payload="marshallmatherslp2"),
Url("https://www.eminem.com/", text="Visit eminem.com"),
]
)
say Carousel(cards=[card1, card2, card3])
say {
"attachment":{
"type":"template",
"payload":{
"template_type":"receipt",
"recipient_name":"Stephane Crozatier",
"order_number":"12345678902",
"currency":"USD",
"payment_method":"Visa 2345",
"order_url":"http://petersapparel.parseapp.com/order?order_id=123456",
"timestamp":"1428444852",
"address":{
"street_1":"1 Hacker Way",
"street_2":"",
"city":"Menlo Park",
"postal_code":"94025",
"state":"CA",
"country":"US"
},
"summary":{
"subtotal":75.00,
"shipping_cost":4.95,
"total_tax":6.19,
"total_cost":56.14
},
"adjustments":[
{
"name":"New Customer Discount",
"amount":20
},
{
"name":"$10 Off Coupon",
"amount":10
}
],
"elements":[
{
"title":"Classic White T-Shirt",
"subtitle":"100% Soft and Luxurious Cotton",
"quantity":2,
"price":50,
"currency":"USD",
"image_url":"http://petersapparel.parseapp.com/img/whiteshirt.png"
},
{
"title":"Classic Gray T-Shirt",
"subtitle":"100% Soft and Luxurious Cotton",
"quantity":1,
"price":25,
"currency":"USD",
"image_url":"http://petersapparel.parseapp.com/img/grayshirt.png"
}
]
}
}
}
goto end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment