bitfocus / companion-module-microsoft-teams

MIT License
4 stars 2 forks source link

Not working with New Teams API - new install #8

Closed daveontherun closed 2 months ago

daveontherun commented 2 months ago

I am unable to get the API token populated using companion. Manage API is enabled in Teams settings. In companion, the API Version is 2.0.0 and the IP address is correct.

I attempt to press button presets for MS Teams but not seeing the Allow or Block request from Teams. Error: "Disconnected Teams not running"

Microsoft Teams version 24231.512.3106.6573 Companion version v3.4.0

Jarec-au commented 2 months ago

Hi @daveontherun, There's a few things to check and a few limitations. If you could confirm the following that would be good:

  1. Confirm that the IP address is 127.0.0.1 - it MUST be localhost; MS Teams only accepts local connections and will not respond to queries from a computer on the network. (sorry if this is misleading; the 1.0 API allowed remote calls if I recall correctly).
  2. Confirm that you have turned on third party API within Teams. Settings -> Privacy -> Third Party API {FA0322F5-A918-4007-B1BD-1071A871E284}
dseehof commented 2 months ago

Just adding to that, I use some port forwarding rules both on Windows and Mac to overcome that useless Microsoft limitation of only listening on localhost.

For Mac I use socat (I listen to my whole subnet, but you could make the range a single host):

socat -d TCP4-LISTEN:8124,range=192.168.0.0/24,reuseaddr,fork TCP:127.0.0.1:8124

On Windows 11 I achieve the same result using those two commands (in this case I only listen to one specific host):

netsh advfirewall firewall add rule name="Companion to Teams" protocol=TCP dir=in localip=192.168.0.118 localport=8124 action=allow
netsh interface portproxy add v4tov4 listenport=8124 listenaddress=192.168.0.118 connectport=8124 connectaddress=127.0.0.1 protocol=tcp

Hope that helps!

daveontherun commented 2 months ago

The issue was I was trying to remote call from another PC. The firewall and port forwarding worked like a charm. Thank you both!

I suggest maybe adding a note in the help section to mention 2.0 API only allows localhost