$ProjectId = "abc-prj-np-mdf-001" $TopicName = "MindFlow:publish" $Message = "Vendredi 23 mai à 12:00" $AccessToken = "ya29.a0AW4Xtxhb0o5hP7lkY1kH6ZplZy2hUlfLP1l7QDQlv8tD2T-GSL3fKw65zQGr1ilrBBpgn9lM3B4ZhZTmebQgwPykr6gW_MbhLDr7RWmY5mBZXY3EPz9hYjaWa4qEbJDyp1NHsSCKeYWQ-9n24jMNRjeqzxPH50qQIBV2wH7lgaCgYKAToSARESFQHGX2MiqPoqBQZYeAWTQqbEYyLehA0181" $apiUrl = "https://pubsub.googleapis.com/v1/projects/$ProjectId/topics/$TopicName" $response = $null $headers = @{ "Authorization" = "Bearer $AccessToken" "accept" = "application/json" "Content-Type" = "application/json" } # Define the request body (if needed) $body = @{ messages= @( @{ data = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($message)) attributes = @{ subject = "ABC_202209_029" } } ) } | ConvertTo-Json -Depth 10 # Make the API call using Invoke-RestMethod $response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -Body $body # Output the response $response