$npx -y skills add microsoft/power-platform-skills --skill add-teamsAdds Microsoft Teams connector to a Power Apps code app. Use when sending Teams messages, posting to channels, or integrating with Teams chat.
| 1 | **📋 Shared Instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** - Cross-cutting concerns. |
| 2 | |
| 3 | # Add Teams |
| 4 | |
| 5 | ## Workflow |
| 6 | |
| 7 | 1. Check Memory Bank → 2. Add Connector → 3. Configure → 4. Build → 5. Update Memory Bank |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | ### Step 1: Check Memory Bank |
| 12 | |
| 13 | Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md). |
| 14 | |
| 15 | ### Step 2: Add Connector |
| 16 | |
| 17 | **First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)): |
| 18 | |
| 19 | Run the `/list-connections` skill. Find the Teams connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create. |
| 20 | |
| 21 | ```bash |
| 22 | npx power-apps add-data-source -a teams -c <connection-id> |
| 23 | ``` |
| 24 | |
| 25 | ### Step 3: Configure |
| 26 | |
| 27 | Ask the user what Teams operations they need (send message, post to channel, etc.). |
| 28 | |
| 29 | **PostMessageToConversation** -- sends a chat message via Flow bot: |
| 30 | |
| 31 | ```typescript |
| 32 | await TeamsService.PostMessageToConversation({ |
| 33 | "Post as": "Flow bot", |
| 34 | "Post in": "Chat with Flow bot", |
| 35 | "Post message request": { |
| 36 | recipient: "<recipient-upn-or-id>", // UPN or Entra object ID |
| 37 | messageBody: "<p>HTML message</p>", // HTML format |
| 38 | isAlert: false, |
| 39 | feedbackLoopEnabled: false |
| 40 | } |
| 41 | }); |
| 42 | ``` |
| 43 | |
| 44 | Use `Grep` to find specific methods in `src/generated/services/TeamsService.ts` (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)). |
| 45 | |
| 46 | ### Step 4: Build |
| 47 | |
| 48 | ```bash |
| 49 | npm run build |
| 50 | ``` |
| 51 | |
| 52 | Fix TypeScript errors before proceeding. Do NOT deploy yet. |
| 53 | |
| 54 | ### Step 5: Update Memory Bank |
| 55 | |
| 56 | Update `memory-bank.md` with: connector added, configured operations, build status. |