# How to add Microsoft Teams to ERPNext

> Source: https://netray.co/integrations/erpnext-microsoft-teams
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

ERPNext has no native Teams channel, so you connect it with a Webhook DocType that posts to a Power Automate workflow or a small Bot Framework service. Adaptive Cards carry approve and reject buttons, and the callback hits a whitelisted ERPNext method using a scoped API user.

## System

ERPNext

## Capability

microsoft-teams

## Intro

Companies that run ERPNext often run Microsoft 365 beside it, and the office staff live in Teams all day. The Desk is a browser tab they open when they have to. Approvals pile up there: Material Requests, Purchase Orders over a threshold, Leave Applications, Expense Claims. The Workflow DocType emails the approver, but email is where requests go to be forgotten.

Teams can be the place where the nudge happens and where the decision is taken. The practical question is how much you want to build. A one-way alert into a channel is an afternoon. An interactive card that approves a document in ERPNext on behalf of a named person is a small project, because identity, permissions and audit all have to line up.

## Use Cases

### Purchase Order approval cards

**Description:** When a Purchase Order enters a 'Pending Approval' Workflow state, post an Adaptive Card to the approver with supplier, total and top lines, plus Approve and Reject buttons.

### Low stock and reorder alerts to a purchasing channel

**Description:** ERPNext auto-creates Material Requests from Item reorder levels. Post a summary of new requests to a purchasing channel each morning so buyers start the day on the right list.

### Quality failures to a production channel

**Description:** A failed Quality Inspection or a new Non Conformance record posts a card with item, batch and inspector to the quality channel, with a link straight to the document.

### Sales order won notifications

**Description:** Large Sales Orders submitted trigger a message to the planning channel so production sees demand before the first MRP run, not after.

### Ask-the-ERP in a Teams chat

**Description:** A bot lets staff ask 'which POs are late for supplier X' and replies with read-only data from the API, respecting the asker's own permissions.

## System Surface

Webhook DocType: on_submit, on_update or after_insert events with a condition and a Jinja JSON body, suitable for posting to an HTTPS endpoint such as a Power Automate flow trigger.

Workflow and Workflow Action DocTypes: states, transitions and allowed roles; your callback should move a document with the same transition names instead of editing the state field.

REST endpoints /api/resource/<DocType> and /api/method/<path>, with token authentication for a service user or OAuth through the built-in OAuth Provider settings, depending on version.

Frappe also supports Social Login Key for providers; Microsoft Entra ID via OAuth/OIDC is commonly configured here so staff use the same identity in both places.

Server Scripts and custom app hooks for logic that needs to enrich a card, such as pulling the supplier's open PO count before posting.

## How It Works

### Pick the Teams delivery mechanism

**Detail:** Microsoft has been moving teams away from classic Incoming Webhook connectors toward Workflows built on Power Automate, so check the current guidance for your tenant. For interactive cards that call back, plan for an Azure Bot Framework bot.

### Register the identity

**Detail:** Create an Entra ID app registration for the bot. In ERPNext, create a service User with only the roles the callback needs, and keep its API key in your service's secret store.

### Post from ERPNext

**Detail:** Create a Webhook on the DocType and event, with a condition like grand_total over your threshold. The JSON body carries the document name, approver email and a deep link to the form.

### Build the Adaptive Card

**Detail:** Render summary facts and Action.Submit buttons that include the document name and the transition. Keep the card short; a link to the ERPNext form handles detail.

### Handle the button press

**Detail:** The bot receives the activity, identifies the Teams user, maps their email to the ERPNext User, and checks they are a valid approver for the current Workflow state before acting.

### Apply the transition and update the card

**Detail:** Call a whitelisted method that applies the Workflow action as that user context where possible, then update the original card to show who decided and when.

## Example Flows

### Approve a Material Request from Teams

**Trigger:** Material Request moves to the 'Pending' Workflow state.

**Steps:**

- Webhook posts document name, requester and item lines to the bot service.
- The bot sends the approver an Adaptive Card with Approve and Reject.
- The approver clicks Approve; the bot verifies their ERPNext role for the state.
- The bot calls the ERPNext method to apply the transition and edits the card to a 'decided' view.

**Result:** The request moves on in minutes, and the ERPNext version history shows the transition with the correct user.

### Daily purchasing digest

**Trigger:** A scheduler event at 07:30 each weekday.

**Steps:**

- A scheduled job queries open Material Requests and overdue Purchase Order items through the API.
- It groups them by buyer and builds a card per team.
- The card is posted to the purchasing channel with links to filtered list views.

**Result:** Buyers start with a prioritised list rather than opening five reports.

## On Prem

ERPNext can stay fully on-prem, but Teams is a Microsoft cloud service, so the integration needs an outbound path to Microsoft endpoints and an inbound HTTPS endpoint for bot callbacks. The usual pattern is a small service in a DMZ that holds the bot credentials and talks to ERPNext over an internal address, with ERPNext itself not exposed to the internet. If you add AI to summarise documents or answer questions in chat, run the model on your own hardware and pass only the minimum fields into a card. Sites that cannot allow any cloud messaging should use an on-prem chat tool instead and keep the same webhook pattern.

## Security

- Map the Teams user to an ERPNext User before acting, and enforce Workflow role checks server side, never trust the card payload.
- Use a service account with the narrowest roles and rotate its key; store it in a secret manager, not in the flow definition.
- Sign or verify callback requests, and expire cards so old buttons cannot be replayed.
- Keep cards to identifiers, totals and links; sensitive attachments stay behind ERPNext login.
- Audit approvals in ERPNext as well as Teams, so the system of record has the evidence.

## Options

### Webhook to Power Automate flow

**Fit:** One-way alerts and simple links when your tenant already uses Power Automate and you want no custom code.

**Effort:** A day or two per alert type.

### Custom Teams bot with Adaptive Cards

**Fit:** Interactive approvals and Q&A where identity and role checks must be exact.

**Effort:** Several weeks with Azure registration, testing and tenant approval.

### Partner build with Netray

**Fit:** Teams with approvals plus an AI layer that explains a document before the approver decides, running on local models.

**Effort:** Pilot on a single approval type, then extend.

## Pitfalls

- Letting the card carry the transition and trusting it blindly allows spoofed approvals; always re-validate on the server.
- Using shared channel credentials makes the audit trail say 'bot approved'; carry the human identity through.
- Tenant admin consent for bot apps can take weeks; start the request early.
- Cards cannot hold large tables well; link to the form for anything beyond a few lines.
- Posting on every update floods the channel; limit to state changes.

## Faq

### Is there an official ERPNext Teams connector?

**Answer:** I am not aware of one in the core product. Teams is usually reached by a Webhook DocType posting to a Power Automate workflow, a community Frappe app, or a custom bot. Check the Frappe marketplace for the current state before building.

### Can approvers approve inside Teams?

**Answer:** Yes with a bot and Adaptive Cards, provided the callback maps the Teams user to an ERPNext user and applies the Workflow transition under the right permissions. Simple Power Automate flows can also do approvals using the Approvals connector and then call the ERPNext API.

### Do I need Azure to do this?

**Answer:** For one-way alerts through Power Automate, you mainly need a Microsoft 365 tenant. For an interactive bot you register an app in Entra ID and usually host the bot service somewhere, which can be on your own servers or in Azure.

### Will it work with ERPNext on Frappe Cloud?

**Answer:** Yes. Webhooks and the REST API work the same way. Custom apps may be limited by what the hosting plan allows, so check whether you can install the app you need before committing to a design.

### How do I sign users in with their Microsoft account?

**Answer:** Frappe supports OAuth based sign-in through Social Login Key, and Microsoft Entra ID can be configured as a provider. The exact fields differ by version, so follow the current Frappe documentation and test with a non-admin account first.

## Search terms

erpnext microsoft teams integration, microsoft teams for erpnext, erpnext teams notifications, erpnext teams approval bot, frappe teams integration, erpnext power automate, erpnext adaptive cards, erpnext workflow approval teams, erpnext entra id sso, send erpnext alerts to teams

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
