page_type | description | products | languages | extensions | urlFragment | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
This is an sample tab application which shows how to open purchase dialog and trigger purchase flow using teams-js sdk |
|
|
|
officedev-microsoft-teams-samples-tab-app-monetization-nodejs |
This sample shows how to open purchase dialog and trigger purchase flow using teams-js sdk.
- Tabs
- App Monetization
Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your teams and/or as a personal app. (Sideloading must be enabled for your tenant, see steps here).
App monetization in tab: Manifest
- NodeJS
- ngrok or equivalent tunnelling solution
- Teams Microsoft Teams is installed and you have an account
- Publish an offer to marketplace
- Register a new application in the Azure Active Directory – App Registrations portal.
- Select New Registration and on the register an application page, set following values:
- Set name to your app name.
- Choose the supported account types (any account type will work)
- Leave Redirect URI empty.
- Choose Register.
- On the overview page, copy and save the Application (client) ID. You’ll need this later when updating your Teams application manifest.
- Register a SAAS offer in market place and generate an plan id for it Create SAAS Offer
- Run ngrok - point to port 3978
# ngrok http 3978 --host-header="localhost:3978"
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Install node modules
Inside node js folder, navigate to
samples/tab-app-monetization/nodejs/ClientApp
open your local terminal and run the below command to install node modules. You can do the same in Visual Studio code terminal by opening the project in Visual Studio code.npm install
Note - Navigate to
samples/tab-app-monetization/nodejs/ClientApp/src/components/tab.tsx
and update the planId and term on line 14 and 15 with plan details created in step 2 -
Run the solution from the same path terminal using below command.
npm start
-
Modify the
manifest.json
in the/AppPackage
folder and replace the following details{{App-id}}
with your application id created in step 1.{{Domain-Name}}
with your application's base url domain, e.g. For https://1234.ngrok-free.app the Domain Name will be 1234.ngrok-free.app{{Plan-id}}
with plan id generated in step 2.
-
Zip the contents of
AppPackage
folder into amanifest.zip
, and use themanifest.zip
to deploy in app store or add to Teams. -
Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")
- Go to Microsoft Teams. From the lower left corner, select Apps
- From the lower left corner, choose Apps -> Manage your apps -> Upload an app.
- Go to your project directory, the ./AppPackage folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.
-
Add the tab in personal scope.