How to send adaptive card through outlook with botFramework NodeJs

Angel E Lopez M 5 Reputation points
2024-06-20T20:27:13.87+00:00

I've built a bot that sends adaptive cards through teams. I'm able to successfuly interact with the card. However, I would like to extend the functionality and make it capable to send cards through outlook as well. I have followed this steps and added the channel to the azure bot services. However, I do not know how to start sending the card because its not explained in the documentation. Here is the snipped of how I send the card to teams.


// HTTP trigger to send notification. You need to add authentication / authorization for this API. Refer https://aka.ms/teamsfx-notification for more details.

server.post(

  "/api/notificationByTeams",

  restify.plugins.queryParser(),

  restify.plugins.bodyParser(), // Add more parsers if needed

  async (req, res) => {

    let continuationToken = undefined;

    do {

      const pagedData = await notificationApp.notification.getPagedInstallations();

      let adaptiveCardData = req.body;

      const { MerlinUser, MerlinPassword, Receivers, TemplateType } = adaptiveCardData;

      //Here we get all the users receiving the notification

      const usersReceivingCardInformation = await getNotificationMembersInfoByEmail(Receivers)

      const installations = pagedData.data;

      continuationToken = pagedData.continuationToken;

      //Here we encrypt the data of the admin user

      adaptiveCardData.MerlinUser = encryptData(MerlinUser);

      adaptiveCardData.MerlinPassword = encryptData(MerlinPassword);

      adaptiveCardData.Originator = process.env.Originator;

      console.info("Llegamos a setear el originator ", adaptiveCardData.Originator);

      adaptiveCardData.UserIds = usersReceivingCardInformation.map(x => x.id);

      for (const target of installations) {

       

        if (target.type === "Person" && usersReceivingCardInformation.some(x => x.id === target.conversationReference.user.id)) {

          let selectedTemplate = selectTemplate(TemplateType);

          await target.sendAdaptiveCard(

            AdaptiveCards.declare(selectedTemplate).render({

              ...adaptiveCardData

            })

          );

        }

      }

    } while (continuationToken);

    res.json({});

  }

);

I added the outlook channels to my bot service in azure. here is the link of the Stackoverflow post. https://stackoverflow.com/questions/78649276/how-to-send-adaptive-card-through-outlook-with-botframework-nodejs

Do I need to use graph service to send adaptive cards to outlook?

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,360 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Angel E Lopez M 5 Reputation points
    2024-06-27T00:14:01.94+00:00
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.