Skip to main content

Saved files in transaction messages (AI-assisted coding)

Let users save files they send in transaction messages and reuse them in later messages without uploading them again.

Written by Sharetribe Team

In Sharetribe, you let users attach files to transaction messages. In the no-code version, if they want to send the same file in several transactions, they have to upload it each time.

By adding a saved files feature, your users can star a file after uploading it, and it shows up in a Saved files list below the message field in a transaction. For example, a provider can save a price list, travel guide, location instructions once and easily send it to every new customer.

Adding this requires custom code, but you don't need to be a developer to do it. With AI-assisted coding, an AI tool like Claude writes the code from a plain-language description.

This article gives you a ready-made prompt to add saved files to transaction messages. You customize a few details, paste it into your AI tool, and work from there. The AI may still ask you clarifying questions, and getting the result you want often takes a few rounds of feedback.

If you're new to AI-assisted coding (or vibecoding), start with these:

Before you start

This article assumes you've already completed the setup in How to start AI-assisted coding on top of Sharetribe for non-developers. You should have, at minimum:

  • A development environment in Console

  • A local copy of the Sharetribe Web Template running on your computer

  • The Claude desktop app (or another AI coding tool) with the Sharetribe Development Plugin installed

  • At least one test transaction in your development environment, so you can send messages with files

The steps below use the Claude desktop app, but the same prompt should work in other AI coding tools as well.

Step 1: Decide the details

Before you prompt, decide how the feature should work in your marketplace. Answering these up front saves you a round or two of questions later.

  • What should saved files be called? For example "Saved files", "Favorites", or "My files". This is the label users see in the message composer.

  • Who can save files? All users, or only one user type, for example providers who send the same documents to every customer.

  • Is there a limit? Decide whether users can save as many files as they like, or only a set number, for example 10.

Not sure yet? You can leave a detail out and the AI will ask you about it.

Step 2: Copy and customize the prompt

Copy the prompt below and replace the parts in [square brackets] with your answers to the questions above.

You can leave the rest as it is or modify it to better match your needs. The feature and technical sections tell the AI how saved files should behave and where to store them, so you don't have to work that out yourself.

I want [user type, e.g. all users / providers] to be able to star a file after uploading it to a transaction message, so it's saved for reuse in future messages without re-uploading.

The feature has two parts:

1. Star button on uploaded files — appears while the file is scanning or after it’s verified. Clicking it saves a reference to the file
(name, size, file ID) in the user’s privateData under a key like savedMessageFileIds. Clicking again removes it.
2. Saved files picker in the message composer — a “Saved files” link appears next to the attach button when the user has saved files. Clicking it opens an inline list where the user can add a saved file to the current message draft or remove it from their favorites.Users can save up to [limit, e.g. 10 files / no limit].

Context for files in Sharetribe:
https://www.sharetribe.com/docs/concepts/files/files-in-sharetribe/

Ask clarifying questions to improve the prompt if needed.

If you’ve built others features that use private file attachments, add this to your prompt:

Important: this feature should be completely separate from any existing use of privateFileAttachments (e.g. private profile files). Store references in privateData, not privateFileAttachments.

Step 3: Work through it with the AI

When you send the prompt, expect a conversation rather than a finished feature on the first try. A few pointers:

  • Even with a detailed prompt, the AI may ask things like where exactly to place the star button or what to show when a saved file can't be loaded. Answer in plain language. If you don't know, ask it to suggest a sensible default and explain why.

  • With Ask permissions mode on, Claude shows each change before making it. You don't need to understand every line of code, but check that the changes match what you asked for.

  • Once the AI has built the first version, open your local development marketplace and look at the result.

Step 4: Test the feature

AI output is never exactly the same twice. Even though this prompt has worked for us, your result may not work as expected on the first try. If you run into problems, tell the AI what's not working, share any errors you get, and it will try again. If you want to start over, you can also ask it to undo its changes.

As you test, tell the AI what to change, one thing at a time. For example:

  • "The star is hard to see. Make it larger and use the marketplace color when a file is saved."

  • "Move the Saved files link so it sits right next to the attach button."

  • "Close the saved files list after I add a file to the message."

Here's a suggested testing checklist:

  • Open a transaction, upload a file to a message, and star it. Check that the star appears while the file is scanning and after it's verified.

  • Click the star again and check that the file is no longer saved.

  • Save a file, send the message, then open a different transaction. Check that the Saved files link appears and lists the file.

  • Add a saved file to the message and send it. Check that the file arrives without uploading it again.

  • Send a message with a saved file and a newly uploaded file together.

  • Remove a file from your saved files. Check that it disappears from the list in every transaction, and that messages you already sent still show the file.

  • Log in as a user with no saved files and check that the Saved files link doesn't appear.

  • If you limited saving to one user type, log in as another user type and check that the star doesn't appear.

  • Log in as another user and check that you can't see the first user's saved files.

  • Repeat the checks on a mobile screen.

If you plan to go live with this feature, consider having a Sharetribe Expert review the code. Features that handle users' files are a good case for a professional review.

What to build next

Once you're comfortable with this feature, you can use private files and protected transaction files for other workflows too. Here are a couple of tutorials for custom features that use files:

  • Add a private file upload feature with AI

  • Let users replace transaction files, for example to swap a file delivered by mistake

Or create something different, like ask a provider for proof of delivery before payout, or ask a customer to sign a contract before a transaction moves forward.

For the technical details behind these features, learn more about files in our developer documentation.

Did this answer your question?