Skip to content
Browse files

docs(Message): add adaptive cards message post guide

  • Loading branch information
srinidhr committed Oct 22, 2019
1 parent aa79b61 commit b56bd8151dff1488f40921919a4783036b1fb1ab
Showing with 29 additions and 0 deletions.
  1. +29 −0
@@ -83,6 +83,35 @@ message.setRoomId(room.getId());
// Share an adaptive card with the room
message = new Message();
message.setText("Mandatory fallback text");
JsonArray attachmentsArry = Json.createArrayBuilder() // Create an array to contain all the adaptive card JSONs
.add(Json.createObjectBuilder() // Add the required key "contentType" which points to the fact that this attachment is of type adatpive card
.add("contentType", "application/") // The content key will contain the actual card JSON generated from the adaptive cards designer
.add("content", Json.createObjectBuilder()
.add("$schema", "")
.add("type", "AdaptiveCard")
.add("version", "1.0")
.add("body", Json.createArrayBuilder() // Create the initital body object of the card
.add(Json.createObjectBuilder() // Create an object/element inside the body
.add("type", "TextBlock") // This is an example of TextBlock element
.add("text", "Here is a ninja cat")
.build() // Build the object
.add("type", "Image") // This is an example of Image element
.add("url", "")
.build() // Build the image element
.build() // Build the body object
.build() // Build the card JSON
.build(); // Build the entire attachments array
message.setAttachments(attachmentsArry); // Set the attachments field on the message payload which has to be an array of JSON
// Get person details
Person person=new Person();

0 comments on commit b56bd81

Please sign in to comment.
You can’t perform that action at this time.