When a spinnaker pipeline fails, we can see the following:
Spinnaker Alerts Bot APP [3:24 PM]
Stage failed for APP_NAME
Stage STAGE_NAME for APP_NAME's PIPELINE_NAME has failed
OTHER STUFF FROM NOTIFICATION CONFIG PANEL OF STAGE
Spinnaker Today at 3:24 PM
It's easy to configure the "OTHER STUFF", but what about the first 3 lines, not seeing a place in Spinnaker UI to do this, perhaps in the configuration files on server?
Here is an update for more recent version of spinnaker, 1.16.5: the custom message is editable for each notification type (start, fail, done). Doesn't seem that you can put html in it, but you can put markup. I don't know at what version of spinnaker the contents of this post got implemented, I just know it holds for 1.16.5.
Also once you have configured one of your pipelines to use Notification, you can copy the JSON for the notification to other pipelines to easily configure them identically (or as a starting point).
So I have the following JSON for our Slack notifications, notice the pipeline parameters used and their bold markup:
"notifications": [
{
"address": "spinnaker-notifications",
"level": "pipeline",
"message": {
"pipeline.failed": {
"text": "SERVICE_NAME: *${ parameters['SERVICE_NAME'] }*\nSERVICE_VERSION: *${ parameters['SERVICE_VERSION'] }*"
},
"pipeline.starting": {
"text": "SERVICE_NAME: *${ parameters['SERVICE_NAME'] }*\nSERVICE_VERSION: ${ parameters['SERVICE_VERSION'] }"
}
},
"type": "slack",
"when": [
"pipeline.failed"
]
}
],
The message text is easy to configure via the Notifications dialog, just the JSON contains the embedded \n etc.
It's not documented, but if you edit the JSON of the notification, you can add a customMessage field, and that will override the default three-line message.
For example, change the notifications field in your stage JSON to:
"notifications": [
{
"address": "my-slack-channel",
"customMessage": "this will replace all three of the standard message lines, and can contain HTML",
"level": "stage",
"type": "slack",
"when": [
"stage.failed"
]
}
]
and you'll see:
Spinnaker Alerts Bot APP [3:24 PM]
this will replace all three of the standard message lines, and can contain HTML
Spinnaker Today at 3:24 PM
Related
I'm trying to post a direct message to a specific Slack user. I'm using chat.postMethod method. The below example works fine when channel is a channel ID. But when I change it to a users ID (as described in this documentation), I get back a messages_tab_disabled error.
POST URL: https://slack.com/api/chat.postMessage
{
"channel": "U02F7EXXXXX",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello"
}
}
]
}
I get back...
{
"ok": false,
"error": "messages_tab_disabled"
}
I can't find much on this other than a description on the documentation page that just says "Messages tab for the app is disabled.".
Where is it and how do I enable it?
I stumbled upon how to fix this when I was poking around settings for my app. In case this helps anyone else in the future...
In your apps configuration page, under Features > App Home, scroll down to the Show Tabs section and there is an option called Messages Tab that is off by default. I turned it on and now I can message users directly.
I'm trying to implement the dynamic typeahead search as was shown on the below resources:
https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/dynamic-search?tabs=desktop%2Ccsharp
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-type-ahead-search-adaptive-cards/csharp
I'm having the following Adaptive Card returned from the OnTeamsMessagingExtensionFetchTaskAsync (from message action):
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"id": "choiceSelect",
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Choice 1",
"value": "Choice 1"
},
{
"title": "Choice 2",
"value": "Choice 2"
}
],
"placeholder": "Placeholder text",
"style": "filtered",
"choices.data": {
"type": "Data.Query",
"dataset": "cases"
}
}
]
}
Card is rendered correctly, but when I start typing, I'm getting the following results:
No request is being made. I was trying to debug the JS, but it is troublesome for me - I couldn't pinpoint the exact place it fails, but got these symbols to lookup: executeSearchInvoke, enableAppPermissionEnforcement and enableTenantSettingsForBots in 3.2-app.min.js.
Can anyone point me in the right direction? Is there some kind of dependency or permission I should add to the bot? Some setting in Teams Admin Center? I can add that static typeahead works flawlessly, but I need the dynamic one (big data collection to query).
EDIT:
I have confirmed that the app is added to the team (it is visible on the list of apps in team settings); I've removed and added it again just in case. I am still getting the same results.
List of permissions visible from the App details page:
This app will have permission to:
Receive messages and data that I provide to it.
Send me messages and notifications.
Access my profile information such as my name, email address, company name, and preferred language.
Receive messages and data that team members provide to it in a channel.
Send messages and notifications in a channel.
Access this team's information such as team name, channel list and roster (including team member's names and email addresses) - and use this to contact them​.
When a message is sent from Discord using the slash command, I can also send text along with the command. My issue is that when I pull the body of the message event in AWS Lambda, I don't see the message I sent with it. So if I send /getInfo "Simon" I want to be able to send stats stored on a DB for the character Simon.
When I try to get the JSON body, it doesn't have any information on the message text that was sent with the slash command. All I see is who sent it, what the command was, channel_id, etc.
Do you know if I can get the message text info when a slash command is sent? I didn't see anything in the Discord Developer docs on this.
When registering a slash command with Discord, you need to specify what options are available for the command, otherwise they won't be passed to you.
You do that as part of the options block
{
"name": "mycommand",
"description": "My command does my thing",
"options": [
{
"name": "myoption",
"description": "My option",
"type": 3,
"required": True
}
]
}
Once you do that, the argument that the user passed on the command will be available under data
{
// ...
"data": {
"options": [{
"name": "myoption",
"value": "User value"
}],
// ...
},
}
I have a Microsoft Teams webhook which will alert me when a TeamCity build has failed. I am wondering how I would be able to get the URL of the current TeamCity build so I can pass this information to my webhook.
Only using parameters at hand, you could build the uri back to the build log:
%teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%
If you're using a MessageCard, this would make the potentialAction field of the payload to something like:
"potentialAction": [
{
"#type": "OpenUri",
"name": "View in TeamCity",
"targets": [
{
"os": "default",
"uri": "%teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%"
}
]
}
]
Anything fancier would require a call to the TeamCity REST API
I am developing a bot which uses the email channel to communicate and is replying to email threads.
I could not find any documentation about automatic reply formatting or replying to threads at all. It seems like most of the use cases are just one shot emails out to users.
The way the currently implementation is working is that it casts the incoming message to a model (which has all of the relevant info, ToRecipients, Body [html of the email], Text body[plain text of email], ect).
Using that, the header is split from the Body, add the bots reply with a manually created header, and attach the rest of the email to the end of it. The code then either replaces of removes text artifacts from the html response. And then down the line calls SendActivityAsync to send the message.
There are multiple problems with this approach. Some of which include, text artifacts like carriage returns (\r\n) others like (><o:p> ) which are added to the response automatically through some blackbox formatting function and not removed. Outlook formatting like having emails addresses encased in < and > in the incoming message but not formatting them properly for out going.
Is there any way to make replying to threads easier, or any official support for it?
If not is there at least any documentation about how emails are parsed in or out that could help make parsing these responses a little easier/clearner?
The Bot Framework has an email channel that can be used like any other channel. The JSON format for the emails is this:
{
"type": "message",
"locale": "en-Us",
"channelID": "email",
"from": { "id": "mybot#mydomain.com", "name": "My bot"},
"recipient": { "id": "joe#otherdomain.com", "name": "Joe Doe"},
"conversation": { "id": "123123123123", "topic": "awesome chat" },
"channelData":
{
"htmlBody": "<html><body style = /"font-family: Calibri; font-size: 11pt;/" >This is more than awesome.</body></html>",
"subject": "Super awesome message subject",
"importance": "high",
"ccRecipients": "Yasemin#adatum.com;Temel#adventure-works.com"
}
}
This is changed in the channelData, accessed through turnContext.Activity.ChannelData
The official doc for this is here, and an example implementation of how to work with channelData (though it's Facebook channel, not email) is here.