Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on May 5, 2023 11:59AM
Likes: 0
Replies: 3
Hey!
Right now I'm using Reporters + Teams Adaptive cards to mention people inside messages. Is there a way to mention people via Python API messaging? Something like
message_sender = scenario.get_message_sender("LS_data_ingestions_channel") # some HTML-formatted text html_message = "<p style='color:orange'>Your scenario is running!@NameSurname</p>" message_sender.send(subject="The scenario is doing well", message=html_message, sendAsHTML=True)
The second possible solution is sending adaptive cards jsons via message_sender. There are no examples/docs on that subject, unfortunately. Does anyone know if it is possible to do so?
A similar approach could work to send you can create a team channel in Administration -Settings - Notifications & Integrations.
from dataiku.scenario import Scenario json_payload = """{ "@type": "MessageCard", "@context": "https://schema.org/extensions", "themeColor": "${if(outcome == 'SUCCESS', '29AF5D', '')}${if(outcome == 'FAILED', 'F44336', '')}${if(outcome == '', '28A9DD', '')}", "summary": "${scenarioName} run report", "sections": [ { "text": "${if(outcome == 'SUCCESS', '✅', '')}${if(outcome == 'FAILED', '🔴', '')}${if(outcome == '', '🔔', '')} [${scenarioName}](${scenarioRunURL}): **${outcome}**", "facts": [ { "name": "Project", "value": "${scenarioProjectKey}" }, { "name": "Triggered by", "value": "${triggerName}" } ] } ], "potentialAction": [ { "@type": "OpenUri", "name": "View in DSS", "targets": [ { "os": "default", "uri": "${scenarioRunURL}" } ] } ] }""" scenario = Scenario() sender = scenario.get_message_sender("msft-teams") sender.send(message=json_payload)
I don't have a Microsoft team account to test, but it worked with a webhook endpoint the payload was received accordingly.
Thanks
Hi,
You should be able to use "@username" or @channel_name within a message or message card.
You can find an example of message card here :
https://doc.dataiku.com/dss/latest/scenarios/reporters.html#microsoft-teams-integration-setup
Thanks
Hey, it is only possible to mention someone using Adaptive cards. Here is an example link.
However, I'm only able to configure the Adaptive card json in scenario UI, there is no documented way on how json might be passed into Python sender API. And that's what my question is about - is there any way to mention people within Teams messages via Python API?