rveachkc / pymsteams

Format messages and post to Microsoft Teams.
https://pypi.org/project/pymsteams/
Apache License 2.0
422 stars 78 forks source link

'body' for addAction #66

Closed Gregster66 closed 2 years ago

Gregster66 commented 4 years ago

From the documentation I can see that we have the option to add action buttons which when clicked can then perform an HttpPOST. My questions are:

  1. where can you specify the value of the 'data' payload in the HTTP POST , or as MS Teams documentations lists it as , the 'body' value?
  2. how can I take the value of what is entered in the TextInput and place it into the body of the HTTP POST action.
  3. I have been working on composing a webhooks message with action buttons and HTTP POST actions (this is just using curl and not this python module). Teams receives and displays the message but the HTTP POST behind the action button never works. I've tested it extensively. Could it be that this option no longer works as there is mention that using the Connector Messages with Teams is depreciated? Has anyone encountered this problem?
CaseGuide commented 4 years ago

I have a related issue where I can't figure out how to pass an auth/API key from pymsteams so that when I make the POST.

It looks like this should be possible by passing header per the MS docs on HttpPOST, maybe just need to modify .addAction to pass kwargs or make a dedicated HttpPost action in /pymsteams/init.py

Possibly related: #44

mikebywater commented 3 years ago

I have a similar problem, the body of the httpPost action is empty.

buttnomaan9 commented 3 years ago

If it is not possible to call an authenticated POST API then it is quite useless.

craigers521 commented 3 years ago

jumping on this band wagon here... does anyone know how to add headers (so i can add an auth token) to the HttpPOST action?

buttnomaan9 commented 3 years ago

jumping on this band wagon here... does anyone know how to add headers (so i can add an auth token) to the HttpPOST action?

I tried to figure out this, in order to pass API key in the header but seems like it is not possible. This API is based on MessageCard type and not AdapterCard type, which supports headers. But note AdapterCard submit action is not supported with MS Teams. In the end, I changed my API call from post to a pre-signed get API call. It served well for my use case as I do not need to pass API key any more, but your use case may be different.

rveachkc commented 2 years ago

Resolved in #103