Created
September 4, 2024 10:51
-
-
Save AlexanderHolmeset/e34cea58bd63a3bfae350bb5520ae5fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$bearerToken = "Enter Token" | |
$Headers = @{ Authorization=("Bearer " + $bearerToken) } | |
$CommunityName = "Demo" | |
$Private = "false" | |
$CreateCommunity = Invoke-RestMethod –Uri "https://www.yammer.com/api/v1/groups.json?name=$CommunityName&private=$Private" –Method Post -Headers $headers | |
$body = @" | |
{ | |
"body": "Original message posted by Kari Nordmann - 19.062023 16:45 | |
This is the old message. Im just testing the Yammer API to see whats possible.", | |
"group_id" : $($CreateCommunity.id) | |
} | |
"@ | |
$CreateMessage = Invoke-RestMethod –Uri "https://www.yammer.com/api/v1/messages.json" –Method Post -Headers $headers -Body $body -ContentType "application/json" | |
$body = @" | |
{ | |
"body": "Original message posted by Ola Nordmann - 20.06.2023 08:45 | |
This is a reply.", | |
"replied_to_id": "$($CreateMessage.messages.id)" | |
} | |
"@ | |
$CreateReply = Invoke-RestMethod –Uri "https://www.yammer.com/api/v1/messages.json" –Method Post -Headers $headers -Body $body -ContentType "application/json" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment