rveachkc / pymsteams

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

How to Make HttpPost works #100

Closed igorlucci closed 2 years ago

igorlucci commented 3 years ago

Hi guys, to make the HTTPPOST works we need to add a variable: "BODY"... Let me show you a demo...

NOW When I create a card using the pymsteams it shows me the following:

{ "potentialAction":[ { "@type":"ActionCard", "name":"Comment", "inputs":[ { "@type":"TextInput", "id":"comment", "isMultiline":true, "title":"Input's title property" } ], "actions":[ { "@type":"HttpPOST", "name":"Action's name prop.", "target":"https://" } ] } ] }

HOW IS IT ON MS DOCUMENTATION?

"potentialAction": [ { "@type": "ActionCard", "name": "Set due date", "inputs": [ { "@type": "DateInput", "id": "dueDate", "title": "Select a date" } ], "actions": [ { "@type": "HttpPOST", "name": "OK", "target": "https://webhook.site/161e93cf-4d97-40d1-b0ea-c5855dedd79f", "body": "dueDate={{dueDate.value}}"
} ]

Where is the problem??? If you take a look on the "Actions" you will not see the "BODY" on the pymsteams. So, the teams sends the post request, but empty!!!

So, it's very important to add this default, because it's easy to make it work.

So, what is the default?

"body": "dueDate={{dueDate.value}}" ---> Where, dueDate is the ID of the "INPUTS" section...

It will make the httppost works and it's a very nice feature to make it happen. If you need any more assitance, please let me know and I'll be glad to help. And, sorry for my english... 👍

rveachkc commented 3 years ago

It looks like you're wanting functionality that does not currently exist. You didn't post the code you're using to get there. Are you using pymsteams.potentialAction.addAction()? If so, it might be appropriate to add a optional body parameter to that class method where if it's not None, the body will be created.

Pull requests are always welcome for these kinds of things.

Dritzii commented 3 years ago

This functionality got merged and is working now - documentation on the readme