EvotecIT / PSTeams

PSTeams is a PowerShell Module working on Windows / Linux and Mac. It allows sending notifications to Microsoft Teams via WebHook Notifications. It's pretty flexible and provides a bunch of options. Initially, it only supported one sort of Team Cards but since version 2.X.X it supports Adaptive Cards, Hero Cards, List Cards, and Thumbnail Cards. All those new cards have their own cmdlets and the old version of creating Teams Cards stays as-is for compatibility reasons.
MIT License
409 stars 41 forks source link

Error 405 #47

Closed mvit777 closed 2 years ago

mvit777 commented 2 years ago

Hi, thanx for releasing this module. However I have an issue. I set up a channel on my "personal" teams client. then with this code I got a 405 error. Seems I'm not allowd to post the channel but I did not set any authentication. What am I missing?

Import-Module -Name '..\common.ranx.org\common-import.psm1'
$teamid = "https://teams.microsoft.com/l/channel/19%3aBLEVr8ZdN6hozld9B0TWkJkix3s7AcOzQIFvNGmv5CU1%40thread.tacv2/General?groupId=a14a3b75-72e5-4ed4-9663-b06f09066921&tenantId=e6de4fa2-b6b0-4830-bc05-d7f9b0d226c6"

New-ThumbnailCard -Title 'Bender' -SubTitle "tale of a robot who dared to love" -Text "Bender Bending Rodríguez is a main character in the animated television series Futurama. He was created by series creators Matt Groening and David X. Cohen, and is voiced by John DiMaggio" {
    New-ThumbnailImage -Url 'https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png' -AltText "Bender Rodríguez"
} -Uri $teamid

Error message

WARNING: Send-TeamsMessageBody - Couldn't send message. Error: Response status code does not indicate success: 405 (Method Not Allowed).

it seems I'm not sending the correct headers either

PrzemyslawKlys commented 2 years ago

It's not about TeamID. You need to add a connector: