Jump to content

Send Message in Microsoft Teams


 Share

Recommended Posts

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

Probably the easier way is to use  PowerShell Module because to write it from raw AutoIt you will probably need HTTP request knowledge. 

 

Saludos

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...