Updates

Introducing Apps

Introducing Apps

We are excited to announce the launch of Apps in Midday. You can now easily connect your favorite tools to streamline your workflow. Starting with Slack, we will continue to expand to other tools that you love.


Install Apps

Apps overview


There is a new Apps menu in the sidebar. Here you can find all the apps available to you.

To install an app, you can either click the "Install" button, or click the "Details" button to learn more about the app.


App Details

App details


You can read more about the specific app in the details page, in this example we are looking at the Slack app that will enable you to connect your Slack workspace to Midday and get notifications about new transactions and give you Midday Assistant right in your Slack workspace.


Slack Assistant

Slack Assistant


In the example above we are using the Slack Assistant to send a message to the channel. You can use the Slack Assistant to know your burn rate, track your expenses, and get insights about your transactions.

You can also upload receipts and invoices to Midday right from Slack and we will extract the data and match it to your transactions.


While this is just the beginning, we are excited to bring more apps to you.



Sign up for an account and start using Midday today.

Updates

Building the Midday Slack Assistant

Building the Midday Slack Assistant

In this technical deep dive, we’ll explore how we built the Midday Slack Assistant by leveraging the Vercel AI SDK, Trigger.dev, and Supabase. Our goal was to create an AI-powered assistant that helps users gain financial insights, upload receipts, and manage invoices—all seamlessly from within their Slack workspace.

Background

Midday already has an assistant available on both web and desktop via Electron, but we haven’t yet built a dedicated mobile app. As we continue iterating on our web app, we plan to eventually create a mobile version using Expo. In the meantime, we wanted to give our users a way to interact with Midday on the go. With that in mind, we turned to Slack, where users can quickly upload receipts and invoices without leaving the app they’re already using for work.


Goals

We aimed to enable our users to:

  • Upload receipts and invoices, and match them to transactions.
  • Query their financial status (e.g., burn rate, cash flow).
  • Receive notifications about transactions.

Slack Assistant

Slack recently introduced a new messaging experience for app agents and assistants, making them more discoverable and accessible in user workflows. This update allows developers to build AI assistants based on their own APIs, seamlessly integrated into the Slack interface.


When users install our Slack app from the Apps section within Midday, we obtain the necessary permissions to interact with the Slack API, send messages, and listen to events.


Authentication

To connect the Slack app to a user’s workspace, we utilize Slack’s OAuth flow to retrieve an access token with the required scopes. These scopes include:

  • assistant_thread_context_changed: Detects changes in the assistant thread context.
  • assistant_thread_started: Tracks when an assistant thread starts.
  • file_created: Monitors file uploads.
  • message.channel: Captures messages posted in public channels.
  • message.im: Captures direct messages.

Once authenticated, we store this data in our apps table along with the team ID and access token, structured as a JSONB column for flexibility.


Event Subscriptions

Here’s where the magic happens: We use a Next.js route to handle incoming Slack events and route them to our internal handler. This handler checks the event payload to determine the appropriate action. If it detects a file upload, it triggers a background job via Trigger.dev. If it’s a message, we forward it to our Assistant logic.


File Upload Handling

When a file upload event occurs, we send the file to a background job and save it in our Supabase database. Using OCR, we extract key details such as amount, currency, date, and merchant from the receipt. Then, we attempt to match the data with existing transactions in our system using Azure Document Intelligence Models.


Here’s a quick demo of how the file upload works in Slack:



Slack Assistant Features

When you open the Slack Assistant, you’re greeted with a welcome message and a set of suggested actions. This welcome message is triggered by the assistant_thread_started event and looks like this:

import type { AssistantThreadStartedEvent, WebClient } from "@slack/web-api";



export async function assistantThreadStarted(

  event: AssistantThreadStartedEvent,

  client: WebClient,

) {

  const prompts = [

    { title: "What’s my runway?", message: "What's my runway?" },

    // Additional prompts...

  ];



  try {

    await client.chat.postMessage({

      channel: event.assistant_thread.channel_id,

      thread_ts: event.assistant_thread.thread_ts,

      text: "Welcome! I'm your financial assistant. Here are some suggestions:",

    });



    await client.assistant.threads.setSuggestedPrompts({

      channel_id: event.assistant_thread.channel_id,

      thread_ts: event.assistant_thread.thread_ts,

      prompts: prompts.sort(() => 0.5 - Math.random()).slice(0, 4),

    });

  } catch (error) {

    console.error("Error in assistant thread:", error);

    await client.assistant.threads.setStatus({

      channel_id: event.assistant_thread.channel_id,

      thread_ts: event.assistant_thread.thread_ts,

      status: "Something went wrong",

    });

  }

}

When the user selects one of the suggested prompts, we trigger the assistant_thread_message event. Based on the message, we then use the appropriate tool with the Vercel AI SDK.


To generate the response, we use the generateText function with the OpenAI model. This approach makes it easy to switch between different models and frameworks as needed.


It's crucial to use the thread_ts parameter to ensure the response is sent back to the same thread, rather than creating a new one.


We also handle the request using waitUntil to ensure Slack receives a 200 response within 3 seconds. This prevents Slack from retrying the request, which we want to avoid.


Here is the code for the assistant thread message:

import { openai } from "@ai-sdk/openai";

import { createClient } from "@midday/supabase/server";

import { generateText } from "ai";

import { startOfMonth, subMonths } from "date-fns";

import { getRunwayTool, systemPrompt } from "../../tools";



export async function assistantThreadMessage(

  event: AssistantThreadStartedEvent,

  client: WebClient,

  { teamId }: { teamId: string },

) {

  const supabase = createClient({ admin: true });



  await client.assistant.threads.setStatus({

    channel_id: event.channel,

    thread_ts: event.thread_ts,

    status: "Is thinking...",

  });



  const threadHistory = await client.conversations.replies({

    channel: event.channel,

    ts: event.thread_ts,

    limit: 5,

    inclusive: true,

  });



  const lastTwoMessages = threadHistory.messages

    ?.map((msg) => ({ role: msg.bot_id ? "assistant" : "user", content: msg.text || "" }))

    .reverse();



  const { text } = await generateText({

    model: openai("gpt-4o-mini"),

    maxToolRoundtrips: 5,

    system: systemPrompt,

    messages: [

      ...(lastTwoMessages ?? []),

      { role: "user", content: event.text },

    ],

    tools: { getRunway: getRunwayTool({ defaultValues, supabase, teamId }) },

  });



  if (text) {

    await client.chat.postMessage({

      channel: event.channel,

      thread_ts: event.thread_ts,

      blocks: [{ type: "section", text: { type: "mrkdwn", text } }],

    });

  } else {

    await client.chat.postMessage({

      channel: event.channel,

      thread_ts: event.thread_ts,

      text: "Sorry, I couldn't find an answer to that.",

    });



    await client.assistant.threads.setStatus({

      channel_id: event.channel,

      thread_ts: event.thread_ts,

      status: "",

    });

  }

}

Demo of the Slack Assistant


Midday is fully open-source, and you can find the pull request for the Slack Assistant and Apps here.


You can also try Midday for your own business by signing up here.

Updates

August Product Update

In this release, we're introducing three major updates along with a few helpful additions. You'll enjoy a much better vault experience with search and filters, document classifications, and significantly improved speed. Plus, we've added AI filters for transactions and a much better import feature.


Vault

Vault


We have rebuilt our Vault to be much faster, added a search where you can search for content within your documents, plus we have added the option for you to enable classifications of documents, for example invoices and receipts, so it's easy to filter.

Search and filters

We extract information and make your documents easy to find by simply searching for what you are looking for.

Classifications (off by default)

With the help of AI, we can classify your documents for an even easier way to find and identify them. You can enable this feature in your Vault settings.



Import transactions

Import transactions


We have updated our import solution to support CSV, PDF, and screenshots of transactions to help as many users as possible get started with Midday.

AI Mapping

We have updated our UI to support manual override on mapping fields when we can't figure them out for you.

Screenshots and PDFs

We added support for uploading images of transactions to assist users whose banks don't have CSV files available.

Create Transaction

You can also manually create transactions from the transactions page.



Filters for transactions

Filters


It's now easier than ever to find the transaction you are looking for, or filter based on a specific date range. For example, you can search for: "Transactions from Q1 this year without receipts". You get what I mean - give it a try and let us know what you think.


Updated filters

A much cleaner look, context-based filters, and the ability to navigate them using your keyboard for fast access.

Bulk actions

Sometimes, you want to change many transactions at the same time. We have now updated the UI to be much better for this purpose.



What's coming next

Time Tracker


Time Tracker

Our time tracker is getting a much-needed UI update that's much easier to understand and navigate. Along with that, our native app will also get a timer and command menu.



Invoicing


Invoicing

Viktor is working hard on the design and prototyping extensively to create the best possible experience with creating invoices. We will update you all along the way, and we are really excited to deliver this feature to all of you soon!


Give these a try and let us know what you think get started here.