@honcho/messages-gateway
v1.0.23
Published
Teams Integration gateway that runs behind the client firewall and filters messages, only sending to Honcho messages of monitored users
Downloads
27
Readme
Overview
Teams Messages Gateway it's a NodeJs Server that runs behind the client firewall. The Gateway subscribes to MS Graph Notifications, requesting ALL Teams Messages, and filters those notifications sending to Honcho only those from specified Monitored Users
Requirements
Install & Configure
- Run
npm init
- Install the gateway integration running
npm install @honcho/messages-gateway
- Edit the
config/.env
, adding the right values and configuration for the messages gateway
# App Configs
SERVER_URL='server.client.com' # The internet exposed URL used by MS Graph to send notifications
PORT=3000 # The HTTP port (only needed if HTTP_ENABLED)
HTTPS_PORT=8443 # The HTTPS port (only needed if HTTPS_ENABLED)
# Endpoints
ENDPOINT_GRAPH_LOGIN_BASE='https://login.microsoftonline.com' # Do not change
ENDPOINT_GRAPH_BASE="https://graph.microsoft.com" # Do not change
ENDPOINT_GRAPH_LOGIN="/oauth2/v2.0/token" # Do not change
ENDPOINT_GRAPH_SCOPE=".default" # Do not change
ENDPOINT_GRAPH="v1.0/teams" # Do not change
ENDPOINT_GRAPH_SUBSCRIPTIONS='beta/subscriptions' # Do not change
ENDPOINT_HONCHO_BASE="https://teams.getwhistler.io" # Do not change
MEMBERS_ENDPOINT="members" # Do not change
HONCHO_MONITORED_USERS_ENDPOINT="" # Do not change
HONCHO_NOTIFICATIONS_ENDPOINT="" # Do not change
# Other configs
HTTPS_CERT="" # The path to the Cert
HTTPS_KEY="" # The path to the Key
HTTPS_ENABLED=false # Set to true to run HTTPS Server
HTTP_ENABLED=true # Set to true to run HTTP Server
CLIENT_ID="<ms_graph_app_id>" # MS Graph App Id (can be retrieved on Azure)
TENANT_ID="<ms_graph_tenant_id>" # MS Graph Tenant Id (can be retrieved on Azure)
- Create a
config/.env.private
file, adding decreption key and app secret (look atconfig.env.private.example
)
DECRYPTION_KEY=123123123abcdefg # Base64 Private Key used to decrypt notifications
CLIENT_PUBLIC_KEY=00000000 # Base64 Public Key or Certificate used to encrypt notification by MS Graph
CLIENT_SECRET=123123123 # MS Graph Secret (can be retrieved on Azure)
- Populate
config/monitored_users.json
with a list of users that are supposed to be monitored. The list is a JSON Array of Object. The only mandatory field, at the moment, is theteamsId
.
[
{
"teamsId": "123123123"
},
{
"teamsId": "abcdefghi"
}
]
- Run command
npm run restart
NOTE: Any configuration changes must be followed by an app restart. ( Step 5 above )
HTTPS
The notification URL ( HONCHO_NOTIFICATIONS_ENDPOINT ), in .env is required to be under HTTPS. How this will be implemented depends on client infrastructure and it is a configurable / editable value by the client. The Gateway could be started as an HTTP or HTTPS server (look at the config/.env
configuration file). In the latter case it would require for key and cert path to be specified inside the config/.env
file.
Troubleshooting
Logs
Run npm run log
to navigate through the gateway logs. Is possible to run npm run monit
to get more details about the process running.
Debug
You can run npm run debug
to zip the entire folder (excluding .env.private
file) and the gateway logs. Then you can send the zip file to Honcho's Customer Support via email, in order to receive a better and quicker support.