-
-
Save Gernene/a1db6dcadf579d00a2acbb5013264810 to your computer and use it in GitHub Desktop.
"MS Teams: Automating Manifest Generation" code snipppet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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