Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
How do I pass data into an Adaptive Card?

I have a Microsoft Teams bot that sends out Adaptive Cards. I want to dynamically fill those with data (for example pictures). To do so I have 2 different JSON files. One with the layout of the card and one with the data. How can I link those 2 files? How does the layout file know where to get the data from? I'm new to this and a bit lost ^^'

This is the layout code:

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "text": "Hello ${name}!"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4"
}

This is my code for the data JSON:

{
     "name": "Cute Name"
}

This is how I render the card:

const rawDynamicGalleryCard = require("./adaptiveCards/dynamicGallery.json");

//show dynamic gallery card
switch (txt) {
   case "dynamic": {
   const card = cardTools.AdaptiveCards.declare(rawDynamicGalleryCard).render();
   await context.sendActivity({
     attachments: [CardFactory.adaptiveCard(card)],
   });
}

If I run the bot and type the keyword I get this: Bot Answer

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The documentation suggests the adaptivecards-templating package:

const ACData = require("adaptivecards-templating");

const dynamicGalleryTemplate = require("./adaptiveCards/dynamicGallery.json");
const dynamicGalleryData = require("./adaptiveCards/data.json");

const template = new ACData.Template(dynamicGalleryTemplate);

const card = template.expand({
    $root: dynamicGalleryData
});

// Now you have an AdaptiveCard ready to render!

(This assumes that dynamicGallery.json is your "layout code" above, and I made a total guess as to where your data json is.)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda