Skip to content

Instantly share code, notes, and snippets.

@jcallaghan
Created February 5, 2019 12:23
Show Gist options
  • Save jcallaghan/1aeedfcda9fb52ced512198f2361d02c to your computer and use it in GitHub Desktop.
Save jcallaghan/1aeedfcda9fb52ced512198f2361d02c to your computer and use it in GitHub Desktop.
# Yammer app developer token
$token = ""
# Base Yammer API url
$yammerBaseUrl = "https://www.yammer.com/api/v1"
# Reference - Yammer Group
#$createGroupUri = "https://www.yammer.com/api/v1/groups.json?name=Example&private=True"
function Get-BaererToken() {
$headers = @{ Authorization=("Bearer " + $token) }
return $headers
}
# New group properties
$groupBody = @{ `
name="New Yammer Group";`
private=$true;`
show_in_directory=$false;`
description="A description about the group."
}
# Post new group
$headers = Get-BaererToken
$groupsApi = "$($yammerBaseUrl)/groups"
Invoke-WebRequest –Uri $groupsApi –Method Post -Headers $headers -Body $groupBody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment