-
-
Save gislig/5dc6029447a973470fa5fcc892efe955 to your computer and use it in GitHub Desktop.
Powershell script that connects to workplace group and pushes data to it.
This file contains 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
# Here is the API key from the custom integration | |
$apiKey = "THE CUSTOM INTEGRATION API KEY SHOULD BE SET HERE" | |
# Define the header with the API key with Bearer authorization | |
$headers = @{"Authorization" = "Bearer " + $apiKey} | |
# Define the path where you can search for groups | |
$apiGetPath = "https://graph.facebook.com/v2.11/community/groups" | |
# Find the id of the Monitoring Group | |
$GroupName = "MonitoringGroup" | |
$GroupID = ((Invoke-RestMethod -Method Get -Uri $apiGetPath -Headers $headers).data | ? { $_.Name -eq $GroupName }).id | |
# Create the message | |
$Message = "Greetings people of earth." | |
# Build the post method link with the groupid and the message | |
$apiPostPath = "https://graph.facebook.com/$GroupID/feed?message=$Message" | |
# Send the message | |
Invoke-RestMethod -Method Post -Uri $apiPostPath -Headers $headers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment