I would like to use the subscription to send a message to a channel in Microsoft Teams when there’s a deployment on a specific environment but it’s failed.
Here’s the logs:
16:21:44 Error | Failed to send webhook request. | Webhook https://outlook.office.com/webhook/xxxxxxxxx (Events-298412) failed, with a status of BadRequest. | Octopus.Shared.ControlledFailureException: Webhook https://outlook.office.com/webhook/xxxxxxxxx (Events-298412) failed, with a status of BadRequest. | at Octopus.Server.Schedules.EventNotifications.NotificationCreator.<SendWebhookNotificationsAsync>d__16.MoveNext() | Octopus.Server version 2018.11.1 (2018.11.1+Branch.master.Sha.dc87e38f1845c3a998f63ea6c9ed5d0778df4135)
I just put the webhook url in the subscription.
Do I miss something?
Thanks for getting in touch! The error message suggests a bad request, which is most likely relating to the Payload that Octopus will send to the webhook.
I do not believe that our Subscription feature directly supports Microsoft Teams. We do however have a community made step which can hit a Microsoft Teams Webhook.
The following blog post I found online has details on using this step in Octopus.
If you are set on using our Subscription feature to achieve this, then you will need a way to transform the JSON payload from Octopus into a JSON object that Microsoft Teams can consume.
You can achieve this with something like an Azure or Lambda function. You will need to write a function which can take the payload from Octopus, transform the data so it can be posted to your Microsoft Team, and then perform the post. Unfortunately, we have no examples or documentation on this process.
Let me know if this helps, or if you have any further questions here.
I was aware of the community step but I want to know all the state of the deployment.
I’m going to look about the Json transformation.
Am I the first to try use the subscription to send it to a Teams Webhook ?
You may not be the first, but you are the first case I have heard of trying this. There may be alternative options to achieve this easier, but from what we can see, the method I suggested seems to be the way to go.
Feel free to let me know if you have any further questions.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.