Skip to content

Commit

Permalink
Merge pull request #1358 from OfficeDev/dev
Browse files Browse the repository at this point in the history
build:monthly prerelease
  • Loading branch information
MSFT-yiz authored Nov 7, 2024
2 parents 75a9bef + 820e9ab commit b705e0f
Show file tree
Hide file tree
Showing 162 changed files with 1,821 additions and 30,820 deletions.
2 changes: 1 addition & 1 deletion .config/samples-config-v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"onboardDate": "2021-11-09",
"title": "NPM Search Connector",
"shortDescription": "Search and Share an NPM Package in Teams and Outlook (Web)",
"fullDescription": "This is a Microsoft Teams application named \"NPM Search Connector\". It serves as a Message Extension that allows users to perform a quick search to the NPM Registry for a package and insert package details into conversations for sharing with co-workers. The application uses Adaptive Cards to render NPM package details and Azure Bot Service for handling search queries and communication between the server workload and the clients, including Teams and Outlook (Web Client). It relies on external dependencies such as the botbuilder and restify libraries. The application is built using the TeamsFx SDK and leverages cloud services like Azure Active Directory and Azure Bot Service. While it doesn't directly involve Tabs, JS, SSO, or the Graph Toolkit, these could potentially be integrated for enhanced functionality.",
"fullDescription": "This is a Microsoft Teams application named \"NPM Search Connector\". It serves as a Message Extension that allows users to perform a quick search to the NPM Registry for a package and insert package details into conversations for sharing with co-workers. The application uses Adaptive Cards to render NPM package details and Azure Bot Service for handling search queries and communication between the server workload and the clients, including Teams and Outlook (Web Client). It relies on external dependencies such as the botbuilder and express libraries. The application is built using the TeamsFx SDK and leverages cloud services like Azure Active Directory and Azure Bot Service. While it doesn't directly involve Tabs, JS, SSO, or the Graph Toolkit, these could potentially be integrated for enhanced functionality.",
"types": [
"Message Extension"
],
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
steps:
- name: Validate CD branch
if: ${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/release' && github.ref != 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion NPM-search-connector-M365/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"background": {
"activeOnStart": true,
"beginsPattern": "[nodemon] starting",
"endsPattern": "restify listening to|Bot/ME service listening at|[nodemon] app crashed"
"endsPattern": "app listening to|Bot/ME service listening at|[nodemon] app crashed"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions NPM-search-connector-M365/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ NPM Search Connector is a Message Extension that allows you to perform a quick s
- [Node.js](https://nodejs.org/), supported versions: 16, 18
- An [Azure subscription](https://azure.microsoft.com/en-us/free/)
- [Set up your dev environment for extending Teams apps across Microsoft 365](https://aka.ms/teamsfx-m365-apps-prerequisites)
- [Teams Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) version 5.0.0 and higher or [TeamsFx CLI](https://aka.ms/teams-toolkit-cli)
- [Teams Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) version 5.0.0 and higher or [Teams Toolkit CLI](https://aka.ms/teams-toolkit-cli)

## Minimal path to awesome
> Here are the instructions to run the sample in **Visual Studio Code**. You can also try to run the app using TeamsFx CLI tool, refer to [Try the Sample with TeamsFx CLI](cli.md)
> Here are the instructions to run the sample in **Visual Studio Code**. You can also try to run the app using Teams Toolkit CLI tool, refer to [Try the Sample with Teams Toolkit CLI](cli.md)
### Run the app locally
1. Clone the repo to your local workspace or directly download the source code.
Expand Down
2 changes: 1 addition & 1 deletion NPM-search-connector-M365/cli.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Minimal path to awesome
1. Install TeamsFx CLI using the npm package manager:
1. Install Teams Toolkit CLI using the npm package manager:
```
npm install -g @microsoft/teamsapp-cli
```
Expand Down
27 changes: 18 additions & 9 deletions NPM-search-connector-M365/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.js is used to setup and configure your bot

const path = require("path");
const restify = require("restify");
const express = require("express");

// See https://aka.ms/bot-services to learn more about the different parts of a bot.
const {
Expand Down Expand Up @@ -44,21 +44,30 @@ adapter.onTurnError = async (context, error) => {

// Send a message to the user
await context.sendActivity("The bot encountered an error or bug.");
await context.sendActivity("To continue to run this bot, please fix the bot source code.");
await context.sendActivity(
"To continue to run this bot, please fix the bot source code."
);
};

// Create bot handlers
const messageExtensionBot = new MessageExtensionBot();

// Create HTTP server.
const server = restify.createServer();
server.use(restify.plugins.bodyParser());
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log(`\nBot started, ${server.name} listening to ${server.url}`);
});
// Create express application.
const expressApp = express();
expressApp.use(express.json());

const server = expressApp.listen(
process.env.port || process.env.PORT || 3978,
() => {
console.log(
`\nBot started, ${expressApp.name} listening to`,
server.address()
);
}
);

// Listen for incoming requests.
server.post("/api/messages", async (req, res) => {
expressApp.post("/api/messages", async (req, res) => {
await adapter.process(req, res, async (context) => {
// Process bot activity
await messageExtensionBot.run(context);
Expand Down
10 changes: 5 additions & 5 deletions NPM-search-connector-M365/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "teams-messaging-extension",
"version": "1.0.0",
"engines": {
"node": "16 || 18"
"node": "18 || 20"
},
"msteams": {
"teamsAppId": null
Expand All @@ -18,11 +18,11 @@
"watch": "nodemon ./index.js"
},
"dependencies": {
"botbuilder": "^4.18.0",
"restify": "^10.0.0"
"botbuilder": "^4.23.1",
"express": "^5.0.1"
},
"devDependencies": {
"env-cmd": "^10.1.0",
"nodemon": "^2.0.7"
"nodemon": "^3.1.7"
}
}
}
2 changes: 1 addition & 1 deletion NPM-search-message-extension-codespaces/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"background": {
"activeOnStart": true,
"beginsPattern": "[nodemon] starting",
"endsPattern": "restify listening to|Bot/ME service listening at|[nodemon] app crashed"
"endsPattern": "app listening to|Bot/ME service listening at|[nodemon] app crashed"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions NPM-search-message-extension-codespaces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ Search based message extensions allow you to query your service and post that in
1. Sign into Azure by clicking the `Sign in to Azure` under the `ACCOUNTS` section from sidebar.
1. Click `Provision` from `LIFECYCLE` section or open the command palette and select: `Teams: Provision`.
1. Click `Deploy` or open the command palette and select: `Teams: Deploy`.
- From TeamsFx CLI:
- From Teams Toolkit CLI:
1. Run command: `teamsapp auth login azure`.
1. Run command: `teamsapp provision --env dev`.
1. Run command: `teamsapp deploy --env dev`.

### Preview the app in Teams
- From VS Code:
1. Open the `Run and Debug Activity` Panel. Select `Launch Remote (Codespaces)` from the launch configuration drop-down.
- From TeamsFx CLI:
- From Teams Toolkit CLI:
1. Run command: `teamsapp preview --env dev`.

## Version History
Expand Down
44 changes: 32 additions & 12 deletions NPM-search-message-extension-codespaces/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.js is used to setup and configure your bot

// Import required packages
const restify = require("restify");
const express = require("express");

// Import required bot services.
// See https://aka.ms/bot-services to learn more about the different parts of a bot.
Expand All @@ -15,7 +15,9 @@ const config = require("./config");

// Create adapter.
// See https://aka.ms/about-bot-adapter to learn more about adapters.
const credentialsFactory = new ConfigurationServiceClientCredentialFactory(config);
const credentialsFactory = new ConfigurationServiceClientCredentialFactory(
config
);

const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication(
{},
Expand All @@ -32,29 +34,47 @@ adapter.onTurnError = async (context, error) => {
console.error(`\n [onTurnError] unhandled error: ${error}`);

// Send a message to the user
await context.sendActivity(`The bot encountered an unhandled error:\n ${error.message}`);
await context.sendActivity("To continue to run this bot, please fix the bot source code.");
await context.sendActivity(
`The bot encountered an unhandled error:\n ${error.message}`
);
await context.sendActivity(
"To continue to run this bot, please fix the bot source code."
);
};

// Create the bot that will handle incoming messages.
const bot = new TeamsBot();

// Create HTTP server.
const server = restify.createServer();
server.use(restify.plugins.bodyParser());
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log(`\nBot started, ${server.name} listening to ${server.url}`);
});
// Create express application.
const expressApp = express();
expressApp.use(express.json());

const server = expressApp.listen(
process.env.port || process.env.PORT || 3978,
() => {
console.log(
`\nBot Started, ${expressApp.name} listening to`,
server.address()
);
}
);

// Listen for incoming requests.
server.post("/api/messages", async (req, res) => {
expressApp.post("/api/messages", async (req, res) => {
await adapter.process(req, res, async (context) => {
await bot.run(context);
});
});

// Gracefully shutdown HTTP server
["exit", "uncaughtException", "SIGINT", "SIGTERM", "SIGUSR1", "SIGUSR2"].forEach((event) => {
[
"exit",
"uncaughtException",
"SIGINT",
"SIGTERM",
"SIGUSR1",
"SIGUSR2",
].forEach((event) => {
process.on(event, () => {
server.close();
});
Expand Down
8 changes: 4 additions & 4 deletions NPM-search-message-extension-codespaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"description": "Microsoft Teams Toolkit message extension Bot sample",
"engines": {
"node": "16 || 18"
"node": "18 || 20"
},
"author": "Microsoft",
"license": "MIT",
Expand All @@ -19,12 +19,12 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"botbuilder": "^4.18.0",
"botbuilder": "^4.23.1",
"isomorphic-fetch": "^3.0.0",
"restify": "^10.0.0"
"express": "^5.0.1"
},
"devDependencies": {
"env-cmd": "^10.1.0",
"nodemon": "^2.0.7"
"nodemon": "^3.1.7"
}
}
2 changes: 1 addition & 1 deletion README_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ the gif contains only major steps of using the app, keep the gif short.
## Prerequisite to use this sample
- NodeJS version XX
- A Microsoft 365 tenant in which you have permission to upload Teams apps. You can get a free Microsoft 365 developer tenant by joining the [Microsoft 365 developer program](https://developer.microsoft.com/en-us/microsoft-365/dev-program).
- [Teams Toolkit for VS Code](https://aka.ms/teams-toolkit) or [TeamsFx CLI](https://aka.ms/teams-toolkit-cli)
- [Teams Toolkit for VS Code](https://aka.ms/teams-toolkit) or [Teams Toolkit CLI](https://aka.ms/teams-toolkit-cli)

## Minimal path to awesome

Expand Down
Loading

0 comments on commit b705e0f

Please sign in to comment.