Skip to content

Latest commit

 

History

History
97 lines (71 loc) · 2.71 KB

File metadata and controls

97 lines (71 loc) · 2.71 KB

Local Development 🖥

Prerequisites

  • Node (>=10.14)
  • Docker
  • Bot Framework Emulator (>=4.3.0); you can obtain it from here
  1. Install modules
npm install
  1. write .env file; you may start using .env.template for local development
cp .env.template local-development/.env
  1. (OPTIONAL) write config.yaml file; you may use config.example.yaml as reference.
cp config.example.yaml local-development/config.yaml
  1. Configure the mysql database
cd local-development
docker-compose up -d
docker-compose exec mpm-db bash
# inside container
--> mysql -h 127.0.0.1 -u root -e "create database msteamsbot;"
docker-compose exec mpm-server bash
# inside container
--> npx sequelize-cli db:migrate
  1. Start the database and server
docker-compose up -d

Run on the Emulator

  1. Connect to the bot endpoint using Bot Framework Emulator
    • Add "172.17.0.1" to the setting "localhost override" in the Emulator
    • Bot URL would be http://localhost:3978/api/v1/messages
    • Leave app id and password empty for local development
    • Uncheck "Bypass ngrod for local addresses"
      • Probably, it requires to press "Restart Conversation - New User ID" in the Live Chat tab.

local-bot-emulator Bot Emulator connected to local service

  1. Once everything is running, you can insert into the database some data:
    • to add some topics:
      bash scripts/populate-topics.sh
    • to add some users and subscriptions (it requires the topics created above):
      bash scripts/populate-users-and-subscriptions.sh

Run on Teams app

prerequisites

  • ngrok or equivalent tunneling solution
  • M365 developer account or access to a Teams account with the appropriate permissions to install an app.
  1. ngrok: Your app will be run from a localhost server. You will need to setup ngrok in order to tunnel from the Teams client to localhost.
    Run ngrok point to port 3978:
ngrok http -host-header=rewrite 3978

You may test that everything is up requesting server info:

 $» curl -s https://{subdomain}.ngrok.io/ | jq
"msteams-private-messages@x.y.z"
  1. Make sure you've checked the Azure ☁️ section. At settings, change the Messaging endpoint pointing to your ngrok subdomain
Messaging endpoint:
https://{subdomain}.ngrok.io/api/v1/messages
  1. Click on Channels, then click on Try on Microsoft Teams