Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Looking for options to send attachment from dataiku to teams channel. Anyone setup this before?
What kind of attachment and why? You could send a dataset but they are limits on how much data you can send.
Thanks for quick response. I have good number of users on our platform who are asking for this capability. csv, png, excel, pdf etc. files. My research found I would need to use MS Grapgh API Explorer. That would require more permissions on teams to access teams_id, channel_id etc. Asking around for alternatives.
You can use the MS Graph API but it's much easier to use the built-in scenario reporter functionality. To do that follow the following steps:
import dataiku
from dataiku.scenario import Scenario
โ
# The Scenario object is the main handle from which you initiate steps
scenario = Scenario()
โ
my_dataset_handle = dataiku.Dataset("YOUR DATASET NAME")
my_dataset_df = my_dataset_handle.get_dataframe()
โ
my_dataset_html = ""
my_dataset_html += "Scenario result: ${outcome}<br>"
my_dataset_html += "Scenario URL: ${scenarioRunURL}<br>"
my_dataset_html += "<br><br>"
my_dataset_html += my_dataset_df.to_html(columns=['COLUMN1', 'COLUMN2', 'COLUMN3', 'COLUMN4'],
header=True, index=False, na_rep='', max_rows=20)
โ
message_sender = scenario.get_message_sender(None, "msft-teams-scenario")
message_sender.send(message=my_dataset_html, webhookUrl="Insert Teams webhook URL")
You need to update the following:
YOUR DATASET NAME: Set the name of the dataset you wish you send in the notification
'COLUMN1', 'COLUMN2', 'COLUMN3', 'COLUMN4': Select the names of the columns you wish you send in the notification
Teams webhook URL: The Webhook URL you got from the previous step
Adjust the max_rows to your desired max number of rows. Of course this being a Teams notification you can't send large tables or your will get a notification that says โThis message is too long to display here. Please visit the external source app to view the messageโ. In my tests I was able to send a table that had 12,000 characters so there is plenty of room (within reason) to play with.
With the above code you can send datasets which should be more useful than sending attachments. I don't believe it's possible to send any attachments using this notifications channels functionality. But, as you can see from the above sample, the message can use any valid HTML so if you can store your attachments files somewhere else (like Sharepoint) you can hotlink to them in your Teams message. That's probably a much better solution as it will keep the messages "small" and leave potential heavy attachments for a storage layer than can handle them properly.
Thank you @Turribeach. I have requested for more team permissions so i can see the connector option. Will let you know how it goes.
It worked!! Thank you
We found what works best is sending a notification from Dataiku to MS Teams (via the solution @Turribeach gave) and sending an excel to a Sharepoint site (same MS Team but different channel).
Once in Sharepoint, the teams can link their own Excel files to that file in case they want custom pivot tables. That requires a one-time-hard-to-find-but-easy-to-set-up step.. syncing the users computer with the sharepoint site.
Good luck!