# How to add Microsoft Teams to Epicor Prophet 21

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

## Short answer

Build a Teams bot or Power Automate workflow that listens for Prophet 21 events (credit holds, PO approvals, stockouts), posts adaptive cards to the right channel or person, and sends the approve or reject decision back through the P21 APIs. Sign users in with Entra ID and map them to P21 users so approvals are attributable.

## System

Epicor Prophet 21

## Capability

microsoft-teams

## Intro

Many Prophet 21 shops already live in Microsoft 365. Managers approve things from email, credit holds sit in a P21 window until somebody notices, and buyers learn about a stockout when a customer calls. Teams is where people already are, but P21 does not push into it on its own.

The value is in turning P21 exceptions into actionable cards: an order on credit hold with the customer's balance and an approve button, a purchase order awaiting approval with line detail, or an item that dropped below its minimum at a branch. The decision is recorded in P21, not just in chat.

Because P21 is often on-premises, the main design question is how a cloud-hosted Teams service reaches an internal system safely. This page walks through that, plus the Entra ID and permission mapping that makes approvals defensible.

## Use Cases

### Credit hold release

**Description:** Post an order on credit hold to the credit manager with customer balance, past due amounts and the order total, with approve and decline actions.

### Purchase order approval

**Description:** Send POs above a threshold to the approver as an adaptive card with vendor, lines and total, and write the decision back to the approval workflow.

### Branch stockout alerts

**Description:** Notify the branch buyer channel when an A-class item drops below minimum at a location, with on-hand, allocated and open PO quantities.

### Large order or special order heads-up

**Description:** Alert purchasing and the warehouse when an order contains a non-stock or special-order line so procurement starts before the customer asks.

### Order lookup from a channel

**Description:** Let a salesperson type a command or ask the bot for an order, quote or customer snapshot without opening P21.

### Daily exception digest

**Description:** Post a morning summary of late shipments, unconfirmed POs and past due orders to the operations channel.

## System Surface

- P21 middleware services for reading orders, customers, items and for submitting transactions and notes; version-dependent, so check your installed API docs and the Swagger-style catalog if enabled.
- SQL Server read access for exception queries, for example orders with a hold flag, items below minimum by location, and POs with an approval status. Confirm table names such as oe_hdr, po_hdr and inv_loc in your data dictionary.
- Approval and workflow features inside P21 that already track who must approve what; reuse them instead of inventing a parallel approval chain.
- Business rules or alerts that can call a web service or insert a queue row when a hold is applied or a PO is saved.
- User and role tables in P21 so a Teams identity can be mapped to the correct P21 user and their approval limits.

## How It Works

### Decide bot versus workflow

**Detail:** For a handful of alerts, Power Automate with an on-premises data gateway and a P21 SQL connection is enough. For interactive approvals and commands, build a Teams bot using the Bot Framework or the Teams SDK.

### Register the app in Entra ID

**Detail:** Create the app registration, set the messaging endpoint, and grant only the Graph and Teams permissions needed to post to channels and chats.

### Map identities

**Detail:** Keep a table mapping Entra user principal names to P21 user IDs and approval limits. A card should only be actionable by the person P21 says may approve.

### Detect events in P21

**Detail:** Use a business rule or alert to write to a queue, or poll a view for new holds and pending POs every minute or two.

### Render adaptive cards

**Detail:** Build cards with the key facts and Action.Submit buttons that carry the document key, a nonce and the card version so stale cards cannot be replayed.

### Post decisions back

**Detail:** On button press, validate the user, call the P21 API to release the hold or approve the PO under a service account, and record the Teams user as an audit note.

### Update the card

**Detail:** Replace the original card with a resolved state showing who decided and when, so the channel history stays truthful.

## Example Flows

### Credit hold release

**Trigger:** A sales order is placed on credit hold in P21.

**Steps:**

- The event reaches the bot service via the queue.
- The service reads the customer balance, terms and past due items.
- It sends an adaptive card to the credit manager.
- The manager taps release, the service re-checks authority and calls the P21 API.

**Result:** The order is released in minutes and the decision is logged against the order.

### PO over threshold approval

**Trigger:** A buyer saves a purchase order whose total exceeds their limit.

**Steps:**

- The service finds the next approver from the P21 approval setup.
- A card shows vendor, lines, total and budget context.
- The approver approves or rejects with a comment.
- The result is written to the P21 approval and the buyer is notified in Teams.

**Result:** Approvals no longer wait on someone opening a P21 window.

### Stockout channel alert

**Trigger:** An A-class item falls under minimum at the Dallas branch.

**Steps:**

- A scheduled query finds items below minimum with open demand.
- The service checks whether an open PO already covers it.
- Only uncovered items are posted to the branch buyer channel.

**Result:** Buyers act on real gaps instead of a flood of noise.

## On Prem

Teams is a cloud service while P21 may sit in your data center. Keep the bot logic inside your network and let it call out to Microsoft, with the Bot Framework messaging endpoint exposed through a reverse proxy or an Azure relay that forwards to an internal listener. Power Automate reaches SQL Server through the on-premises data gateway, which makes only outbound connections. Anything posted into Teams is stored in Microsoft 365, so keep cards to the minimum facts needed and link to P21 for detail. If you add an AI assistant to answer questions in Teams, run the model on-premises and send only the resulting answer to Teams.

## Security

- Authenticate with Entra ID and re-verify the approver against P21 limits at the moment of action, not only when the card is sent.
- Use a service account for write-back with narrow rights, and stamp the human approver in a note.
- Give each card action a single-use token and expiry to block replay and forwarded cards.
- Limit channel membership for cards that show customer balances or margins.
- Log all card sends and actions with document keys for audit.

## Options

### Power Automate with data gateway

**Fit:** Quick alerts and simple approvals if you already license Power Automate and can query P21 safely.

**Effort:** Days for alerts, a few weeks for approvals with write-back.

### Custom Teams bot

**Fit:** Best for interactive commands, rich cards and strict approval logic tied to P21 roles.

**Effort:** Roughly three to six weeks including identity mapping and testing.

### Partner such as Netray

**Fit:** Worth it when you also want a private AI assistant in Teams that answers P21 questions without sending data to a public model.

**Effort:** A short pilot, then add approval flows one at a time.

## Pitfalls

- Letting anyone in a channel click approve; always validate the clicker against P21 authority.
- Posting too many alerts causes people to mute the channel; filter to actionable exceptions.
- Duplicating P21 approval rules in the bot creates two sources of truth; read the P21 setup instead.
- Exposing the bot endpoint without signature validation lets anyone post fake decisions.
- Cards that show stale data after the order changed; re-read before acting.

## Faq

### Can Teams approve Prophet 21 purchase orders directly?

**Answer:** Yes through an integration. A Teams card carries the decision to a service that calls the P21 API or updates the approval record. There is no built-in Teams approval in P21 that I know of, so you build or buy the bridge and map approvers carefully.

### Do we need to expose our P21 server to the internet?

**Answer:** No. Keep P21 and the integration service internal. The service makes outbound calls to Microsoft, and only the bot messaging endpoint needs to be reachable, usually through a reverse proxy or relay that does not give access to the P21 database.

### Is Power Automate enough?

**Answer:** For notifications and basic approvals it often is. When you need rich commands, role checks against P21 limits, or conversational lookups, a custom bot gives you more control and a better audit trail than a flow alone.

### Can the bot answer questions about inventory?

**Answer:** Yes. A read-only tool layer can answer on-hand, allocated and on-order by item and location. For free-form questions, add a model that translates the question into those read-only calls and shows its source.

### What about Slack instead of Teams?

**Answer:** The pattern is the same: events out, interactive messages, verified write-back. The differences are in the app model and identity. If your company uses Slack, the same P21 event layer can feed it without redoing the P21 work.

## Search terms

epicor prophet 21 microsoft teams integration, microsoft teams for epicor prophet 21, p21 teams approvals, prophet 21 credit hold teams, epicor p21 teams bot, p21 purchase order approval teams, adaptive cards erp approvals, prophet 21 power automate, teams alerts distribution erp, epicor p21 entra id integration

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