Edits history of script submission #22473 for ' Send a message to MS Teams channel via webhook (msteams)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { IncomingWebhook } from "[email protected]";
    
    // See below for an example card you can pass in
    
    type MsTeamsWebhook = {
      webhook_url: string;
    };
    export async function main(
      ms_teams_webhook: MsTeamsWebhook,
      messageCard: object,
    ) {
      const webhook = new IncomingWebhook(ms_teams_webhook.webhook_url);
      const ret = await webhook.send(messageCard);
      return ret;
    }
    
    const example_card = {
      "@type": "MessageCard",
      "@context": "https://schema.org/extensions",
      summary: "This is a test summary",
      themeColor: "0078D7",
      title: "This is a test title",
      sections: [
        {
          activityTitle: "Windmill Webhook",
          activitySubtitle: "2023-05-25 17:57:55",
          activityImage:
            "https://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
          text: "This is a test text",
        },
      ],
    };
    

    Submitted by hugo989 14 days ago