BatMan22 Posted October 21, 2021 Share Posted October 21, 2021 Hi guys, wondering if anyone know how to tie into Teams. I just need to send a message but have never done anything like that before and autoit is the only programming language I know. Has anyone ever automated sending a message in teams before with the API? I really don't want to use webdriver as it's a relatively messy solution but will go that route if I have to. Link to comment Share on other sites More sharing options...
Danp2 Posted October 22, 2021 Share Posted October 22, 2021 Have you reviewed this thread? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
BatMan22 Posted October 23, 2021 Author Share Posted October 23, 2021 @Danp2 I 'reviewed' that thread but unless I'm missing something, it's just a link to the Microsoft API. I know an API exists, I just have zero clue about how to implement something like that and was hoping someone had done something similar. Link to comment Share on other sites More sharing options...
Danp2 Posted October 23, 2021 Share Posted October 23, 2021 27 minutes ago, BatMan22 said: I know an API exists, I just have zero clue about how to implement something like that and was hoping someone had done something similar. Not to my knowledge. If is just a simple Put operation, you should be able to do it with the WinHTTP UDF from @trancexx. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danyfirex Posted October 23, 2021 Share Posted October 23, 2021 Probably the easier way is to use PowerShell Module because to write it from raw AutoIt you will probably need HTTP request knowledge. Saludos BatMan22 and SkysLastChance 2 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
BatMan22 Posted October 24, 2021 Author Share Posted October 24, 2021 @Danyfirex You're 100% right. SUPER easy! Thanks. Instructions for anyone who searches for this in the future: 1) Activate Webhook by clicking on 'Connectors' in any chat channel.. Add Extension called "Webhooks", copy webhook value. 2) Paste into powershell either direct/via autoit after replacing the "URI" value with your webhook value, hit enter and success: 3) Visit link below for full details / better explanation https://petri.com/how-to-send-a-microsoft-teams-message-using-powershell-7 $JSONBody = [PSCustomObject][Ordered]@{ "@type" = "MessageCard" "@context" = "http://schema.org/extensions" "summary" = "Incoming Alert Test Message!" "themeColor" = '0078D7' "title" = "Incoming Alert Test Message!" "text" = "There was an alert and we should act on it." } $TeamMessageBody = ConvertTo-Json $JSONBody -Depth 100 $parameters = @{ "URI" = 'https://outlook.office.com/webhook/{GUID}@{GUID}/IncomingWebhook/{GUID}/{GUID}' "Method" = 'POST' "Body" = $TeamMessageBody "ContentType" = 'application/json' } Invoke-RestMethod @paramete rs | Out-Null Danyfirex 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now