| 1 | import type { WebhookFormat } from './index.js'; |
| 2 | |
| 3 | /** Microsoft Teams, through a Workflows webhook or a legacy incoming webhook connector; both take an Adaptive Card: https://learn.microsoft.com/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook */ |
| 4 | export const teams: |
| 5 | // A Workflows URL on logic.azure.com is left out: any Azure Logic App has one, and it may want Ghost's JSON. |
| 6 | matches: (url) |
| 7 | url.hostname.endsWith |
| 8 | (url.hostname.endsWith |
| 9 | url.pathname.includes |
| 10 | render: ({ context |
| 11 | type: 'message', |
| 12 | attachments: [ |
| 13 | { |
| 14 | contentType: 'application/vnd.microsoft.card.adaptive', |
| 15 | content: { |
| 16 | $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', |
| 17 | type: 'AdaptiveCard', |
| 18 | version: '1.4', |
| 19 | body: [ |
| 20 | { type: 'TextBlock', |
| 21 | { type: 'TextBlock', |
| 22 | ...(excerpt |
| 23 | ? [{ type: ' |
| 24 | : []), |
| 25 | ], |
| 26 | actions: url ? |
| 27 | }, |
| 28 | }, |
| 29 | ], |
| 30 | }), |
| 31 | }; |