Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Gernene
Last active June 12, 2019 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gernene/a1db6dcadf579d00a2acbb5013264810 to your computer and use it in GitHub Desktop.
Save Gernene/a1db6dcadf579d00a2acbb5013264810 to your computer and use it in GitHub Desktop.
"MS Teams: Automating Manifest Generation" code snipppet
'use strict';
const fs = require('fs');
require("dotenv").config();
// Environment variables used by manifest
var appId = process.env.APP_ID;
var botId = process.env.BOT_ID;
var domain = process.env.DOMAIN; // Local tunnel address
var strippedDomain = domain.replace("https://", "");
var version = process.env.MANIFEST_VERSION;
var tabIdRequesterTicket = process.env.TAB_ENTITY_ID_REQUESTER_TICKET;
// Default manifest configuration
var manifest = {
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
"manifestVersion": "1.5",
"version": version,
"id": appId,
"packageName": "com.microsoft.yourapp",
"developer": {
"name": "Your App",
"mpnId": "",
"websiteUrl": "https://yourapp.com",
"privacyUrl": "https://yourapp.com/privacy",
"termsOfUseUrl": "https://yourapp.com/termsofservice"
},
"icons": {
"color": "logo.png",
"outline": "logo.png"
},
"name": {
"short": "Your App",
"full": "Your App"
},
"description": {
"short": "Short description",
"full": "Full description"
},
"accentColor": "#FFFFFF",
"configurableTabs": [
{
"configurationUrl": domain + "/configure",
"canUpdateConfiguration": true,
"scopes": [ "team", "groupchat" ]
}
],
"bots": [
{
"botId": botId,
"scopes": [
"personal",
"team"
],
"commandLists": [],
"supportsFiles": false,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
strippedDomain
]
}
// Generate manifest.json if not in production
if (process.env.NODE_ENV != 'production') {
let data = JSON.stringify(manifest, null, 2);
fs.writeFile('manifest.json', data, (err) => {
if (err) throw err;
console.log('Manifest generated!');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment