Blueprints

Send an email every morning containing a daily digest of the weather and train times.

Source

yaml
id: ai-daily-digest-email
namespace: company.team

inputs:
  - id: location
    type: STRING
    defaults: London

tasks:
  - id: get_weather
    type: io.kestra.plugin.core.http.Request
    uri: "https://api.openweathermap.org/data/2.5/weather?q={{inputs.location}}&app\
      id={{kv('OPENWEATHERMAP_API_KEY')}}&units=metric"

  - id: get_digest
    type: io.kestra.plugin.anthropic.ChatCompletion
    system: "You're a helpful assistant who is going to help plan the day ahead. I'm
      going to ask a number of questions but I want the final response to be a
      morning summary of the day in a friendly manner. Add new lines between
      context changes as this response will be used in an email."
    messages:
      - type: USER
        content: "What is the weather like in London? I fetched weather data from
          OpenWeatherMap Weather API. Use the data from that JSON response to
          summarise the weather for my morning summary to help me decide what I
          should wear for the day. The response is {{ outputs.get_weather.body
          }}"
      - type: USER
        content: "I need to commute from Cambridge train station to 10 Downing Street in
          London for 9am arrival. What train should I catch?"

  - id: turn_into_html
    type: io.kestra.plugin.anthropic.ChatCompletion
    system: "You are going to turn any user message into a nicely formatted HTML
      email. It will contain information about the weather as well as a commute.
      Break these into 2 separate sections that are clear summaries for the user
      to help them plan their day. These sections will be centred to the middle
      of the email but the text inside will remain left aligned. They will
      receive this first thing in the morning. This is only the body of the
      email so no need to add a subject. Add 'Good morning! Here is your daily
      digest:' at the start. At the bottom, just put Daily Digest."
    messages:
      - type: USER
        content: "{{ outputs.get_digest.outputText }}"

  - id: send_digest
    type: io.kestra.plugin.notifications.mail.MailSend
    from: "{{ kv('EMAIL') }}"
    to: "{{ kv('EMAIL') }}"
    username: "{{ kv('EMAIL') }}"
    password: "{{ kv('EMAIL_PASSWORD') }}"
    host: smtp.gmail.com
    port: 465
    subject: "Daily Digest"
    htmlTextContent: "{{ outputs.turn_into_html.outputText }}"

triggers:
  - id: schedule
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 6 * * *"

pluginDefaults:
  - forced: false
    type: io.kestra.plugin.anthropic.ChatCompletion
    values:
      apiKey: "{{ kv('ANTHROPIC_API_KEY') }}"
      model: "claude-3-5-sonnet-20241022"
      maxTokens: 1024

About this blueprint

AI Kestra

This Kestra flow delivers a personalized AI-powered daily digest email every morning at 06:00 UTC with the Anthropic plugin.
It combines real-time weather updates, commute planning, and AI-generated summaries into a friendly, well-formatted HTML email.

Configuration:

  • Provide secrets for the OpenWeatherMap API key (OPENWEATHERMAP_API_KEY)
  • Configure email credentials (EMAIL, EMAIL_PASSWORD) for SMTP delivery
  • Add an Anthropic API key (ANTHROPIC_API_KEY) to run the AI completions
  • Optionally adjust the default location input to tailor the weather summary

This flow can be adapted for different cities, commutes, or content. You can expand prompts to include additional context (e.g., calendar events, reminders, or tasks) to create a more personalized assistant.

Request

Chat Completion

Mail Send

Schedule

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra