Hi Team,
I’m working on automating Teams provisioning and sending messages that include Loop components using the Microsoft Graph SDK. I’m trying to embed a Loop component in a Teams message using the application/vnd.microsoft.card.fluidEmbedCard content type.
Is this the correct and supported format for embedding Loop components (Fluid Framework) into a Teams channel message using the Graph API?
If not, is there an updated or recommended way to achieve this?
Also is there any workaround to support loop through message?
Here’s the snippet of my current implementation:
String attachmentId = UUID.randomUUID().toString();
Map
loopContent.put("id", "your-loop-id");loopContent.put("type", "fluid");loopContent.put("url", "https://fluid.microsoft.com/embed/your-loop-id");loopContent.put("name", "Loop Demo");loopContent.put("description", "A test Loop component");
ObjectMapper objectMapper = new ObjectMapper();String loopJson = objectMapper.writeValueAsString(loopContent);
ChatMessageAttachment attachment = new ChatMessageAttachment();attachment.setId(attachmentId);attachment.setContentType("application/vnd.microsoft.card.fluidEmbedCard");attachment.setContent(loopJson);
ChatMessage chatMessage = new ChatMessage();ItemBody body = new ItemBody();body.setContent("Here's a Loop component: ");chatMessage.setBody(body);chatMessage.setAttachments(Collections.singletonList(attachment));
ChatMessage result = graphClient.teams().byTeamId(metadata.teamId()).channels().byChannelId(channelInfo.channelId()).messages().post(chatMessage);