Microsoft Teams webhook from gitlab.
Hello,
My team is trying to set up Gitlab event webhooks to be sent to a Microsoft Teams channel. This was previously working until we updated to the new Microsoft Teams.
We created the webhook by going to channel->workflows->Post to a channel when a webhook request is received->selected a team and channel we want->add workflow->copied the webhook url
We then posted it into the gitlab integrations menu, following this guide: https://docs.gitlab.com/ee/user/project/integrations/microsoft_teams.html#configure-your-gitlab-project
We also tested the webhook with the following command and received a message in our chat:
curl -X POST $WEBHOOK_URL --header "Content-Type: application/json" --data '{ "type":"message", "attachments":[ { "contentType":"application/vnd.microsoft.card.adaptive", "contentUrl":null, "content":{ "$schema":"http://adaptivecards.io/schemas/adaptive-card.json", "type":"AdaptiveCard", "version":"1.2", "body":[ { "type": "TextBlock", "text": "For Samples and Templates, see https://adaptivecards.io/samples" }, { "type": "Image", "url": "https://adaptivecards.io/content/cats/1.png" } ] } } ] }'
However, when we get a webhook request from Gitlab we get the following error:
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['attachments']' is of type 'Null'. The result must be a valid array.
What can we do to resolve this error?