### Liquid: Dynamic For Loops with Blocks Source: https://dreamlit.ai/docs/steps/send-slack This example shows how to use Liquid's `{% for %}` loop to dynamically generate a list of blocks based on an array of input data. This is useful for creating repetitive message structures, such as listing items in an order. ```liquid { "blocks": [ {% for item in orders %} { "type": "section", "text": { "type": "mrkdwn", "text": "• *{{ item.name }}*: ${{ item.price }}" } }{% if forloop.last == false %},{% endif %} {% endfor %} ] } ``` -------------------------------- ### Personalize Email Subject with Liquid Source: https://dreamlit.ai/docs/steps/send-email This example demonstrates how to use Liquid templating to personalize the email subject line by referencing fields from the input data, such as 'first_name'. This allows for dynamic and relevant email subjects. ```liquid Hi {{ first_name }}, thanks for signing up! ``` -------------------------------- ### Dreamlit Transactional Notification Workflow Source: https://dreamlit.ai/docs/getting-started/use-cases Illustrates a common pattern for transactional notifications using Dreamlit. It involves a trigger, a wait step, a query to filter recipients, and a notification step. This approach simplifies reasoning and testing compared to cron jobs. ```mermaid flowchart LR trigger["Database trigger\nruns on save"] -->|"On row\nsave"| wait["Wait\nuntil specific time\nor for a duration"] wait -->|"After specified\ndelay"| query["Query step\nthat fetches or\nfilters users"] query -->|"For each\nqualified user"| notify["Notification step\n"] ``` -------------------------------- ### SQL Query for Data Enrichment Source: https://dreamlit.ai/docs/steps/query This SQL query demonstrates how to enrich input data by joining it with an organization table. It selects all columns from the input rows and adds the organization name based on a common ID. The `input_rows` table contains data from the previous step, and `organization` is a table in the selected database connection. ```sql SELECT input_row.* org.organization_name FROM input_rows AS input_row JOIN organization AS org ON input_row.organization_id = org.id; ``` -------------------------------- ### Liquid: Simple Variable Substitution Source: https://dreamlit.ai/docs/steps/send-slack This snippet demonstrates how to directly substitute input data fields into a message string using Liquid's `{{ }}` syntax. It's useful for personalizing messages with specific data like customer emails. ```liquid { "text": "New signup: {{ email }}" } ``` -------------------------------- ### Supabase Auth Email Trigger Sequence Diagram Source: https://dreamlit.ai/docs/configuration/data-sources/supabase This Mermaid sequence diagram illustrates the flow of an authentication email trigger, from the user's application making a Supabase API call to Dreamlit sending a custom email to the user. It highlights the roles of the App, Supabase Auth, the Auth Hook, and Dreamlit in the process. ```mermaid sequenceDiagram theme={null} participant App as Your App participant Supabase as Supabase Auth participant Hook as Auth Hook participant Dreamlit as Dreamlit actor User as Your Users App->>Supabase: Call auth API Supabase->>Hook: Trigger auth event Hook->>Dreamlit: Forward event Dreamlit->>User: Send custom email ``` -------------------------------- ### Verify DNS Records with PowerShell (Windows) Source: https://dreamlit.ai/docs/configuration/email This snippet includes PowerShell commands for Windows users to verify DNS records, specifically focusing on MX records. This is useful for confirming that the DNS settings for a custom email domain have been correctly applied and propagated. ```powershell Resolve-DnsRecord -Mx -Name "mail.mydomain.com" ``` -------------------------------- ### Sequence Diagram for Event Lifecycle in Dreamlit AI Source: https://dreamlit.ai/docs/getting-started/how-it-works This Mermaid sequence diagram illustrates the flow of an event through the Dreamlit AI system, from application activity to end-user notification. It depicts interactions between the user's application, database, the `dreamlit.event_log` table, and the Dreamlit Engine. ```mermaid sequenceDiagram box Your Application participant App as Your Application participant DB as Your Database participant EventLog as dreamlit.event_log
in Your Database end participant Dreamlit as Dreamlit Engine actor User as Your End User Note over App: Some activity App->>DB: Insert/update row Note over DB: Row changed DB->>EventLog: Trigger executes Note over EventLog: Event recorded Dreamlit->>EventLog: Monitor changes Note over Dreamlit: Workflow triggered Dreamlit-->>User: Send notification ``` -------------------------------- ### Verify DNS Records with Shell Commands (macOS/Linux) Source: https://dreamlit.ai/docs/configuration/email This snippet provides bash commands for macOS and Linux users to verify DNS records for MX, SPF, DMARC, and DKIM. It helps confirm that DNS changes have propagated correctly after setting up a custom email domain. Users need to replace placeholder domain names with their actual domain. ```bash dig MX mail.mydomain.com ``` ```bash dig TXT mail.mydomain.com ``` ```bash dig TXT _dmarc.mail.mydomain.com ``` ```bash dig CNAME dk1._domainkey.mail.mydomain.com dig CNAME dk2._domainkey.mail.mydomain.com dig CNAME dk3._domainkey.mail.mydomain.com ``` -------------------------------- ### Liquid: Conditional Formatting Source: https://dreamlit.ai/docs/steps/send-slack This snippet illustrates how to use Liquid's conditional statements (`{% if %}`, `{% else %}`, `{% endif %}`) to customize message content based on specific conditions. It allows for dynamic message variations depending on data like customer status. ```liquid { "text": "{% if isPremium %}Premium customer {{ name }} has placed an order!{% else %}Order received from {{ name }}.{% endif %}" } ``` -------------------------------- ### Check MX Records using nslookup Source: https://dreamlit.ai/docs/configuration/email Use this command to verify the Mail Exchanger (MX) records for your domain, which direct email to the correct mail servers. This is crucial for ensuring emails sent to your domain are routed properly. It requires the nslookup utility. ```bash nslookup -type=mx mail.mydomain.com ``` -------------------------------- ### Send Slack Message - Construct JSON Payload Source: https://dreamlit.ai/docs/steps/send-slack This snippet demonstrates how to construct a JSON payload for a Slack message using Block Kit components. It utilizes input data fields like 'customer.name' for dynamic content. The generated payload is sent to Slack's Incoming Webhooks API. ```json { "type": "section", "text": { "type": "mrkdwn", "text": "New order placed by *{{ customer.name }}*." } } ``` -------------------------------- ### Supabase Auth Password Reset Email Source: https://dreamlit.ai/docs/getting-started/faq This snippet demonstrates how Dreamlit intercepts Supabase authentication events, such as a password reset request, to send custom, production-ready emails. It highlights the benefit of using Dreamlit over Supabase's default email service, which is not intended for production use. ```javascript supabase.auth.resetPasswordForEmail("user@example.com"); ```