Seguindo as instruções encontradas nesta página:
https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498
Criei um "workflow". Copiei a URL que obtive com esse processo para a variável URL
. Então tentei fazer um POST para essa URL usando o seguinte comando em um terminal Linux:
export DATA='{"key1": "value1", "key2": "value2"}'
export URL="https://..."
curl -X POST "$URL" -H "Content-Type: application/json" -d "$DATA"
Mas não obtive nenhuma saída desse comando nem nenhuma mensagem nova no canal do teams. Quando executo o curl
with, -v
obtenho a seguinte saída:
Note: Unnecessary use of -X or --request, POST is already inferred.
* Host prod-237.westeurope.logic.azure.com:443 was resolved.
* IPv6: (none)
* IPv4: 108.142.31.202
* Trying 108.142.31.202:443...
* Connected to prod-237.westeurope.logic.azure.com (109.142.32.202) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / secp521r1 / RSASSA-PSS
* ALPN: server accepted http/1.1
* Server certificate:
* subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=westeurope.logic.azure.com
* start date: Feb 12 21:35:47 2025 GMT
* expire date: Aug 11 21:35:47 2025 GMT
* subjectAltName: host "prod-247.westeurope.logic.azure.com" matched cert's "*.westeurope.logic.azure.com"
* issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 03
* SSL certificate verify ok.
* Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha384WithRSAEncryption
* Certificate level 1: Public key type RSA (4096/152 Bits/secBits), signed using sha384WithRSAEncryption
* Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* using HTTP/1.x
> POST /workflows/ff29670cf3154471a77ae5863370e3f1/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=zFkzcMt8Pf8RnxCOh7jNhal8VKHAzLY5hBhG6KwzoF4 HTTP/1.1
> Host: prod-237.westeurope.logic.azure.com
> User-Agent: curl/8.5.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 36
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/1.1 202 Accepted
< Content-Length: 0
< Date: Fri, 28 Mar 2025 12:05:28 GMT
< Cache-Control: no-cache
< Expires: -1
< Pragma: no-cache
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< x-ms-workflow-run-id: 08584584433564149666102064393CU234
< x-ms-correlation-id: d390446d-0198-455f-ba68-d17988303a72
< x-ms-client-tracking-id: 08584584433564149666102064393CU234
< x-ms-trigger-history-name: 08584584433564149666102064393CU234
< x-ms-execution-location: westeurope
< x-ms-workflow-system-id: /locations/westeurope/scaleunits/prod-237/workflows/ff29670cf4154471a77ae5863340e3f1
< x-ms-workflow-id: ff29670cf4154471a77ae5863340e3f1
< x-ms-workflow-version: 08584584446367016050
< x-ms-workflow-name: 959a5bcf-9475-4ce7-9075-2b54a7898f68
< x-ms-tracking-id: d390446d-0198-455f-ba68-d17988303a72
< x-ms-ratelimit-burst-remaining-workflow-writes: 41
< x-ms-ratelimit-remaining-workflow-download-contentsize: 30678016
< x-ms-ratelimit-remaining-workflow-upload-contentsize: 30677980
< x-ms-ratelimit-time-remaining-directapirequests: 2857065
< x-ms-request-id: westeurope:d390446d-0198-455f-ba68-d17988303a72
O que estou fazendo errado? Como enviar uma mensagem para um canal do Teams?
Parece que pode haver um formato específico que preciso seguir para os dados, ou tenho que criar um "bot" com "azure" ou criar uma "associação" com um "app"?
Consegui encontrar um erro associado, é:
Failed to install the Power Automate app in Microsoft Teams for team with ID 'bdd0d79d-0759-46a9-b8d4-51a51a42a59b'. Please try adding the Power Automate app to this team directly from the Microsoft Teams client. Error details: '{"error":{"code":"Forbidden","message":"Bulk Membership operation PUT failed on user '28:358f0194-6b0e-4dd3-af35-c24fe8a9ec87' with response code 207, status code :'AclCheckFailed', subStatusCode'1'","innerError":{"code":"AccessDenied","message":"Bulk Membership operation PUT failed on user '28:358f0194-6b0e-4dd3-af35-c24fe8a9ec87' with response code 207, status code :'AclCheckFailed', subStatusCode'1'","details":[],"date":"2025-03-28T13:30:26","request-id":"a51d1493-a622-4856-a976-07c48dce87b4","client-request-id":"c773988d-c459-4d2f-9417-b8ffc6eb596d"}}}'
Mas o aplicativo parece estar instalado.
É um canal privado, tentarei refazer isso em um canal público na semana que vem.