Possible to add flow image and wiki as inline email vs attachments?

info-rchitect
info-rchitect Registered Posts: 180 ✭✭✭✭✭✭

Hi,

I would like to add the Project wiki at the top of my scenario email template and add the image of the flow below that. Is this possible?

thx

Operating system used: Windows10

Best Answer

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,993 Neuron
    edited September 30 Answer ✓

    Doable but will need some work. This code snippet will download the flow documentation into a managed folder zip file:

    import dataiku
    client = dataiku.api_client()
    project = client.get_default_project()
    flow = project.get_flow()
    folder = dataiku.Folder("Some_Managed_Folder") flow_documentation = flow.generate_documentation()
    folder.upload_stream("flow_export.zip", flow.download_documentation_stream(flow_documentation.wait_for_result()['exportId']))

    Inside this zip file you will find an image the flow. You can use your own custom flow document generator template to get a simpler export. Wikis can be read via the Dataiku API, sample code:

    project.get_wiki().get_article(article_id_or_name).get_data().article_data
    

    The wiki content will be in markdown format so you will need to export it to pure HTML using something like the Markdown Python package.

    With regards to inline vs attachments you need to encode the image in Base64 to send them in inline HTML in the email.

    Finally since you are going to be heavily customing the email it will be best to use the channel send() method directly rather than a reporter.

Answers

Setup Info
    Tags
      Help me…