Skip to main content

Integrating with Microsoft Teams

This page explains how to set up a Kuroco Agent as a Microsoft Teams Bot.

Once the setup is complete, any message sent to the Bot in a Teams chat will be processed by the Managed Agent registered in Kuroco and replied to automatically.

info

Prerequisites

  • Kuroco admin permissions
  • An Azure subscription with permission to create Bot resources
  • Microsoft 365 tenant admin permissions (required when installing the Teams app organization-wide)

Overview

① Register an app in Azure (obtain App ID and client secret)

② Create an Azure Bot resource

③ Enable Teams integration in Kuroco (enter App ID, etc., and create the Teams app package)

④ Set the Kuroco URL as the Messaging endpoint in Azure Bot

⑤ Add the Teams channel to the Azure Bot

⑥ Install the Bot app in Teams

⑦ Verify and configure the MCP server and teams_send endpoint in the Kuroco API

⑧ Create a Managed Agent in Kuroco

⑨ Create a Content Definition and configure Teams + AI Auto-Processing

Message flow:

Teams user sends a message
→ Azure Bot (Messaging endpoint: Kuroco URL)
→ Kuroco receives the message and saves it to the Content Definition
→ AI Auto-Processing triggers (automatically calls Managed Agent)
→ Managed Agent processes the message
→ teams_send (Kuroco MCP) replies in Teams

1. Register an app in Azure

Go to Azure Portal and sign in.

Type "App registrations" in the top search bar and select it.

Image from Gyazo

Click "+ New registration".

Image from Gyazo

Fill in the following fields and click "Register".

FieldValue
NameAny name (e.g., KurocoBot)
Supported account typesSee below
Redirect URILeave blank

Select "Supported account types" based on your use case.

OptionDescriptionRecommended scenario
Single tenant onlyOnly users in your own tenant can use itInternal Bot (most common)
Multiple Entra ID tenantsCan be used across multiple organizationsProviding to multiple companies
Any Entra ID tenant + personal Microsoft accountsSupports both organizational and personal accountsIncluding external users
Personal accounts onlyPersonal Microsoft accounts onlyConsumer-facing scenarios

Image from Gyazo

After registration, note the following values shown on the "Overview" screen. You will need them in Step 3 (creating the Azure Bot) and Step 4 (configuring Kuroco).

Value to noteLocationUsed in step
Application (client) IDTop of the Overview pageSteps 3 and 4
Directory (tenant) IDTop of the Overview pageSteps 3 and 4

Image from Gyazo

2. Create a client secret

Click "Certificates & secrets" in the left menu.

Image from Gyazo

Click "+ New client secret".

Enter a description (e.g., kuroco-teams-bot), select an expiration period, and click "Add".

Image from Gyazo

caution

The default expiration is 180 days (6 months). When the secret expires, the Bot will stop working. For production use, set a longer expiration or establish a renewal process before it expires.

Copy the string in the "Value" column of the generated secret and store it in a safe place (e.g., a password manager or your organization's secret storage).

Image from Gyazo

caution

This secret value will not be displayed again once you close this screen. Copy it now.

3. Create an Azure Bot resource

Type "Azure Bot" in the Azure Portal search bar. Select "Azure Bot" from the "Marketplace" section of the search results.

Image from Gyazo

Click "+ Create".

On the "Basics" tab, fill in the following fields.

FieldValue
Bot handleAny name (e.g., KurocoBot)
SubscriptionSelect the subscription to use
Resource groupSelect an existing one or click "Create new"
Data residencyGlobal (default)
Type of AppSingle Tenant
Creation typeUse existing app registration
App IDApplication (client) ID noted in Step 1
App tenant IDDirectory (tenant) ID noted in Step 1

Image from Gyazo

The pricing tier defaults to Standard. For testing or development, switch to F0 (Free): ① click "Change plan", ② select "F0 Free", then ③ click "Select".

Image from Gyazo

Click "Review + create""Create".

Once deployment is complete, click "Go to resource".

Image from Gyazo

4. Enable Teams integration in Kuroco

Log in to the Kuroco admin panel and click [External System Integration] → [Microsoft Teams].

Image from Gyazo

Switch the "Enable" toggle to ON.

Fill in the following fields.

FieldValue
Microsoft App IDApplication (client) ID noted in Step 1
App Password (client secret)Secret value noted in Step 2
App typeSingleTenant
Tenant IDDirectory (tenant) ID noted in Step 1

Image from Gyazo

Also fill in the "Manifest settings" section.

FieldValue
Bot nameThe name displayed in Teams (e.g., KurocoBot)
Bot descriptionAny description (e.g., A chat bot powered by Kuroco)

Click "Update".

Note the URL shown in the "Messaging endpoint URL" field on the settings screen.

https://{your-site}.g.kuroco.app/direct/topics/teams/
tip

You will register this URL in Azure Bot in the next step.

Next, while still on the same screen, click "Download manifest.json" in the "manifest.json" section.

Image from Gyazo

Prepare two icon images of the following sizes.

File nameSize
outline.png32×32 pixels, transparent PNG
color.png192×192 pixels

Bundle the following three files into a ZIP file. Do not create any subfolders — include the three files directly in the ZIP.

teams-app.zip
├── manifest.json
├── outline.png
└── color.png
tip

You will use this ZIP file when installing the Bot in Teams (Step 7). Go ahead and create it now while you are on this screen.

5. Set the Messaging endpoint in Azure Bot

Open the Azure Bot resource you created in the Azure Portal and click [Configuration].

Enter the URL noted in Step 4 in the "Messaging endpoint" field.

Image from Gyazo

Click "Apply".

6. Add the Teams channel to the Azure Bot

In the left menu of the Azure Bot resource, click [Channels].

Select "Microsoft Teams".

Image from Gyazo

Confirm that "Microsoft Teams Commercial (most common)" is selected, then click "Apply".

Image from Gyazo

The "Terms of Service" dialog appears. Check the checkbox and click "Agree".

Image from Gyazo

7. Install the Bot app in Teams

Installing organization-wide (for admins)

Go to the Microsoft Teams admin center.

Open [Teams apps] → [Manage apps].

Click "+ Upload" → "Upload a custom app" and select the ZIP file created in Step 4.

info

This operation requires Microsoft 365 tenant admin permissions. If you do not have permissions, ask your organization's Teams admin.

Sideloading for testing or development

Open the Microsoft Teams desktop app.

Click "Apps" at the bottom of the left menu.

Click [Manage your apps] → [Upload a custom app] and select the ZIP file.

Image from Gyazo

caution

If "Upload a custom app" is not displayed, ask your organization's Teams admin to enable custom app upload permissions.

Search for and add the Bot

After uploading, type the Bot name in the Teams "Apps" search box and select it.

Image from Gyazo

Click "Add".

Image from Gyazo

When "Successfully added" is displayed, click "Open".

Image from Gyazo

8. Verify the MCP server in the Kuroco API

In the Kuroco admin panel, click the gear icon (Settings) and open the API that contains Teams integration tools such as teams_send.

Image from Gyazo

Confirm that "MCP server" is set to "Enabled". The URL displayed is the MCP endpoint you will configure in the Agent in the next step.

https://{your-site}.g.kuroco.app/rcms-api/{id}/mcp
info

If the MCP server is not enabled, enable it from the "Settings" button. For security, select "Dynamic access token".

Also confirm that teams_send exists in the endpoint list. If it does not, click the "+" button to add it.

Image from Gyazo

FieldValue
Pathteams_send
CategoryIntegrations
ModelTeams
Operationsend
StatusSwitch "Enable" to ON

Open the "Basic settings" tab from the left menu. Leave the following parameters blank.

Image from Gyazo

ParameterDescriptionValue
conversation_idTeams conversation IDBlank (passed dynamically at runtime)
service_urlTeams serviceUrlBlank (passed dynamically at runtime)
reply_to_idTeams reply-to Activity IDBlank (passed dynamically at runtime)

Open the "MCP settings" tab from the left menu and configure the following.

Image from Gyazo

FieldValue
Tool nameteams_send
Input data definitionSwitch "Use default schema" to ON (auto-generated from the API definition)
Output data definitionNone
StatusSwitch "Enable" to ON

Click "Update".

9. Create a Managed Agent in Kuroco

In the Kuroco admin panel, click the brain icon and select "AI Agents".

Image from Gyazo

Click "+ Add" to create a new Agent.

Image from Gyazo

Configure the following fields.

FieldValue
NameAny name (e.g., Teams Agent)
ModelSelect the Claude model to use (e.g., claude-sonnet-4-6)
System promptSee the example below
StatusSwitch "Enable" to ON

Example system prompt:

You are an assistant that searches internal knowledge and answers questions in Teams.

## Instructions (follow in order)

### Step 1: Classify intent

Classify the incoming message into one of the following three categories:

- reply: A message that requires a response — questions, consultations, requests, etc.
- knowledge_add: An explicit intent to add or update internal knowledge
(e.g., "I'd like to share this", "Please add this" — messages that clearly intend to provide information. Messages that sound like questions should be classified as reply.)
- both: Both reply and knowledge_add are needed

When in doubt, default to reply.

---

### Step 2: For reply / both

1. Search for relevant knowledge using the knowledge_search tool
- Always specify cnt=10
- Always use vector_search
- Break the question into 2–3 search queries
- If the first search is insufficient, search again with different keywords

2. Reply using teams_send (see Teams reply format below)

For both, also execute Step 3 afterward.

---

### Step 3: For knowledge_add / both

1. Duplicate check
Search for similar documents using knowledge_search (cnt=5, use vector_search)
- If the content is already sufficiently covered → result = "Existing document found: {title}" → go to 5
- If adding content to an existing document is appropriate → note the file path → go to 2

2. Check for existing PRs
Check for existing update PRs for the same content or target file
- If one exists → result = "Existing PR found: {PR link}" → go to 5
- If none → go to 3

3. Determine the file path
Choose the save location based on the following directory structure:
- Support/ — Support and inquiry responses
- Kuroco/ — Kuroco CMS usage, settings, API
- Diverta Inc./ — Internal rules and company information
- General Q&A/ — Catch-all for questions not covered by other categories
Use a concise slug for the filename (e.g., email-auto-reply-settings.md)

4. Create Markdown and open a GitHub PR

# Title

## Overview
(1–2 sentences describing the content)

## Details
(Steps, explanations, code examples, etc.)

## Related
(Related documents and links, if any)

- Branch name: knowledge/update/{YYYYMMDD-HHMMSS}
- Create or update the file at the determined path
- Open a PR (title: docs: {summary of content}; include the source in the body)
- PR requires review (do not auto-merge)
- result = "PR created: {PR URL}" → go to 5

5. Report the result using teams_send

---

### Step 4: Record a query_log (required for all intents)

Pass only the following fields (do not include topics_id):
{
"subject": "Key point of the message (within 200 characters)",
"source": "teams",
"maxDense": "0.9",
"hitCount": 5
}
- Pass maxDense as a string (e.g., "0.9")
- maxDense criteria:
- "0.9"–"1.0": A clear answer was found in the knowledge base
- "0.5"–"0.8": Partially answered but information was incomplete
- "0.0"–"0.4": No relevant knowledge was found
- hitCount is the total number of hits from knowledge_search (integer)
- For knowledge_add only: hitCount=0, maxDense="0.0" is acceptable

---

## Teams reply format (important)

In the message field of teams_send, enter text that will be displayed as-is in Teams.

Do not use:
- Markdown syntax
- Bullet list markers "-" or "*"
- Heading markers "##" or "###"
- Bold, italic, code blocks, or tables
- Markdown link syntax [label](URL)

Reply format:
{Answer based on search results. Use numbered lists for steps and bullet points for key items.}

Reference sources:
・{subject}: {URL}

## How to write reference sources (important)
- Always use the following URL template:
https://{your-site}.g.kuroco-mng.app/management/topics/topics_edit/?topics_id=TOPICS_ID
Replace TOPICS_ID with the topics_id (number) from the search result
- Use the subject field from the search result as the display text
- Do not use GitHub URLs (github.com/...) or ext_2 file paths as reference sources
- Use only {your-site}.g.kuroco-mng.app

## Notes
- If the information is not in the search results, honestly say "No relevant knowledge found"
- Do not supplement with assumptions or external knowledge. Use only search results.

Image from Gyazo

In the "Permitted Agent actions" section, configure the following.

Image from Gyazo

Setting
① MCP server (Kuroco API)Select the API confirmed in Step 8 (the one containing Teams integration tools such as teams_send)
② MCP permission policySelect "Always allow" (required for the Agent to execute tools autonomously)
③ MCP auth member IDEnter your Kuroco member ID
④ UpdateClick to save

Click "Update" to save.

10. Create a Content Definition and configure Teams and AI Auto-Processing

In the Kuroco admin panel, click "Content" and select "Content Definitions". Click "+ Add" to create a new Content Definition.

Image from Gyazo

On the "General" tab, configure the following.

FieldValue
Content Definition nameAny name (e.g., Teams)

Image from Gyazo

Open the "Microsoft Teams" tab from the left menu and configure the following.

Image from Gyazo

FieldValue
Enable Teams message historyON
Auto-reply on receiptON
Reply messageAny message (e.g., Your inquiry has been received. Please note that processing may take 1–3 minutes.)
Teams conversation IDLeave blank (targets all channels)

Open the "AI Auto-Processing" tab from the left menu and configure the following.

Image from Gyazo

Switch "AI Auto Post-Processing" to "Enable".

Click "+ Add" in the "Conversion rules" section and configure the following.

FieldValue
PromptPlease reply to this text: conversation_id='$conversation_id' service_url='$service_url' text='$text'
Execution timingOn new creation
Creation statusPublished
Input fieldsAll selected
Use AI AgentSelect
AI AgentSelect the Agent created in Step 9 (e.g., Teams Agent)
info

Once you select "Use AI Agent", no more rules can be added. Selecting an Agent completes the rule chain.

Click "Update" to save.

Verification

The Bot chat screen opens. Send a message and confirm that the Agent replies.

Image from Gyazo

Troubleshooting

SymptomWhat to check
Bot does not reply to messagesVerify that the Azure Bot Messaging endpoint is correct and check the Kuroco trigger settings
Authentication errorVerify that the Kuroco App ID and App Password are correct
App not found in TeamsCheck the ZIP file structure (no subfolders; three files at the root)
Agent does not startCheck the AI Auto-Processing (conversion rules) settings on the Kuroco side

Support

If you have any other questions, please contact us or check out Our Slack Community.