Home > Net >  How do I mention user in teams channel incoming webhook?
How do I mention user in teams channel incoming webhook?

Time:09-17

I am unable to find any documentation available where I can mention a user for every message sent in a teams channel. I have to use an incoming webhook to send messages to the channel. The messages will be sent from an azure function. This is the code I have tried so far.

axios
    .post(
      'https://name.webhook.office.com/webhookb2/xxx@xyz/IncomingWebhook/xxx/xxxb',
      {
        '@type': 'MessageCard',
        '@context': 'http://schema.org/extensions',
        themeColor: '0072C6', // light blue
        summary: 'Summary description',
        sections: [
          {
            activityTitle: title,
            text: message
          }
        ]
      }
    )
    .then(
      (resolvedValue) => {
        resolve(`Sent message to teams ${resolvedValue}`);
      },
      (error) => {
        reject(error);
      }
    );

I want to mention a user so that they get alerted when the message arrives.

CodePudding user response:

Please go through User mention in Incoming Webhook with Adaptive Cards which talks about adding @mentions within an Adaptive Card body for incoming webhooks.

Please check Format cards with Markdown to add formatting in cards.

  • Related