按照此页面上的说明进行操作:
https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498
我创建了一个“工作流”。我将通过该过程获得的 URL 复制到变量中URL
。然后,我尝试在 Linux 终端上使用以下命令向此 URL 发送 POST:
export DATA='{"key1": "value1", "key2": "value2"}'
export URL="https://..."
curl -X POST "$URL" -H "Content-Type: application/json" -d "$DATA"
但是我既没有从该命令得到任何输出,也没有在该团队频道上收到任何新消息。当我运行curl
with时-v
,我得到以下输出:
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
我做错了什么?如何向 Teams 频道发送消息?
似乎我需要遵循特定的数据格式,或者我必须使用“azure”创建一个“机器人”,或者使用“应用程序”创建一个“关联”?
我设法找到了一个相关的错误,它是:
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"}}}'
但应用程序似乎已经安装好了。
这是一个私人频道,我将尝试下周在公共频道上重做该频道。