Hi Community,
I want to respond to a notification send by DataMiner to Teams to take the ownership of an alarm.
Open some varius link from a button works fine, but using a button with a submit action ends up in a "Sorry, I did not understand that. You can type help to see all my available commands." response of the chatbot, no matter what command I use (here: Show DMS).
Questions:
- Is there any way to run a command directly from a notification via submit action or other ways to achieve it?
- Is it possible to add additional parameters (e.g. alarm id) as a response to the notification or when running a custom command (e.g.: "run command Take Ownership alarmId:12345,agentId:1")?
Notification:
Action Code Part:
Hi,
I am happy to tell you that we added an example on GitHub on how to easily add buttons to Adaptive Cards with the ChatIntegration nuget (version 1.2.1).
ChatIntegration Examples on GitHub: ChatOps-Extensions/ChatIntegrationExamples at main · SkylineCommunications/ChatOps-Extensions (github.com)
Change log: dataminer.services change log | DataMiner Docs
The examples for buttons only cover chat integration right now but it should work in the same way with custom commands.
Wkr
Great Jordy, this solution is much easier to use than the other. Thanks for the quick implementation. Br, Felix
Happy to hear!
It looks like it is possible when I define the following in the DataJson part of the AdaptiveSubmitAction:
// bot command (you can also use the predefined like "GetElementById"):
{ "CustomActionId", "ExecuteAutomationScriptId" },
// name of the command you want to run
{ "AutomationScriptName", "Take Ownership" },
{ "InputMetaData", metaData },
// for each parameter you need (ID, value), ID must match the ones in InputMetaData:
{ "11", chatId },
{ "22", alarmId },
{ "33", dmaId }
And for the metaData List, 3 dictionaries containing the following (for each parameter you need):
1:
{ "ID", "11" } ,
{ "Name", "Chat ID" },
{ "Command", "PARAMETER:1" }
2:
{ "ID", "22" },
{ "Name", "Alarm ID" },
{ "Command", "PARAMETER:2" }
3:{ "ID", "33" },
{ "Name", "Agent ID" },
{ "Command", "PARAMETER:3" }
Correct, I’m working on documenting this and validating the support (if it’s working as well in group chats/channels etc or not). You can also use Adaptive Inputs to let a user fill in/select the inputs that you defined for the automation script/custom command, those will be added to the data object by Teams.
Great, I look forward to reading the documentation when the time comes.
Hi Felix,
Currently we don't support adding Actions (nor functional inputs) in the Adaptive Cards via the DataMiner bot ChatOps.
As you found out there is a way to still add Actions and it indeed does work for URLs. In your use case, for example, a URL to the monitoring app via remote access would allow a user to take Ownership of the alarm or Mask it there: https://<dms>-<organization>.on.dataminer.services/monitoring/alarm/<dmaId>/<rootAlarmId>/<alarmId(optional, redirects to latest alarm if not defined)>
At this moment it's not possible to have a button that behaves like a command issued by the user. But we do agree that this could be a powerful feature and we might consider adding it in the future.
Wkr
Thank you Jordy,
I’ll see if it works for me to take ownership via the URL.
It would be really nice if you could add the reply feature in the future.
Do you have an answer to the 2nd question:
Is it possible to add additional parameters to the query when a custom command is executed (e.g.: “run command Take ownership alarmId:12345,agentId:1”) so that the user doesn’t have to enter it in the run dialog?
Sorry for not answering the second question directly. Unfortunately that is also not possible right now.
It looks like it is already possible to run another command from out of a notification if the syntax is valid.
new AdaptiveSubmitAction()
{
Title = “Change DMS”,
Id = “Action.Submit”,
DataJson = “{“CustomActionId”:”NewChangeDmsId”}”
}
works fine
Yes, we are aware. This is how the buttons work that the DataMiner bot uses in its own adaptive cards. Before, we didn’t have the intention to define this as something we will be backwards compatible with, up until your question came in. This way you would also be possible to add a button to execute a custom command (with inputs or predefined parameters!). If we would document and support this, we will surely let you know here.
Yes, it’s already working with custom commands. I posted it as new answer because I cannot attach pictures to a comment.
Hi, I’ll have a look and come back to you shortly.