PixieBrix is great for fetching information and making it accessible anywhere you need it. A great example of this is message templates or text snippets. If you find yourself constantly typing similar messages, why not save them in a Google Sheet and fetch them to display on a sidebar on any page?
This tutorial shows you how to customize a Snippet Manager to fit your specific use case and use your own templates and data.
In this post, we'll cover core ways you can change the mod.
Before making any customizations, you'll need to create a copy of the Google Sheet AND copy the mod. Read these prereqs for more instructions.
You'll need a Google Sheet with your snippets defined. It's easiest to copy our Google Sheet template to your Google Drive.
Then customize the text in the Text column. Each row is a snippet.
⛔ Do not edit:
Editing any of the bulleted items above will break the template and require customization inside the Page Editor to fix.
🏁 Before you can do any customizations, you'll need to get the template in editable format.
In the Page Editor, click the three dot menu next to the activated template. In the menu, select Make a Copy
You might be asked to create an alias if this is your first time copying a mod.
Optional: You can change the Mod ID, Name, and Description fields in the modal that appears
One of the first things you may want to customize is where your templates come from. In the template example, the templates are defined in a Google Sheet, and we use the Lookup Google Sheet row brick (renamed Fetch data from Google Sheet) to query a Google Sheet. The Snippet Template Manager is perfect for:
You might need to modify the query if your Google Sheet is set up differently than our template. Click the Fetch data from Google Sheet brick and check out the Brick Configuration Panel in the middle of the Page Editor.
To change the Google Sheet you configured, click the @ at the end of the row and choose Sheet, which will open a file picker to select your Google Sheet. You can then change the Tab Nam and Column Headers from ABC to a|b|c Select..., creating a dropdown of options from the Google Sheet.
If you're using some other column to get every row, you can change the Query text to match. For instance, you might have a * or Include in your row.
You also might want to fetch data from other tools entirely, such as:
First, add an Airtable integration configuration. Use the Get Airtable Data brick to fetch all data from an Airtable database. If you want to extract only specific data, you'll need to add a jq - JSON processor brick afterward and use JQ to filter the data returned.
You can store your templates in a PixieBrix database and use the List All Records brick to return all records in a specific database or use the Get data from PixieBrix database to return a specific record. PixieBrix databases have access control, allowing you to specify which team members should have access.
If you want to use another tool, you can search for an existing brick by clicking the + button under any brick in the Brick Actions Pipeline.
If the tool you're searching for isn't available as a brick, use the HTTP Request brick to fetch data from any API.
If you want to make edits to the style of your sidebar, click the Display Sidebar brick to view a preview of your Sidebar in the far right panel of the Page Editor (1). There's a lot you can customize, so let's look at the common actions.
Here's an example of changing the content of a text element.
As configured out of the box, this template copies the text to your clipboard when you click the button in the Sidebar Panel. But perhaps you find yourself always using these templates on a specific site, and you'd like to set the input value of a field on the page with your selected template.
To do this, click the + below the Confirmation Message brick in the Brick Actions Panel, and search for the Set Input Value brick and click Add to add it as an action to your button.
This brick allows you to find an input selector and set the text to any value you'd like, in this case, your template message.
Here are a few examples of selectors you could use to set the text on common websites.
🧚 If you want to set the input on multiple sites, you can add a Set Input Value brick for each site and go to Condition field in the Advanced Options to specify when a brick should run. For example, if you only want a brick to run on gmail, you might set the Condition field to {{ true if 'mail.google' in @input.url}}.
🎉 Congrats! You've successfully modified a message template sidebar. But this is just the start. You can build anything else on top of this, like additional actions such as setting input value on the current page or asking AI to rewrite the template. You can also fetch template messages from another tool (like Airtable, your own API, or something else).
The last step is save your mod. PixieBrix will keep unsaved changes in the Page Editor, but for the changes to take affect when using the mod, you'll need to save. Click the save icon next to your mod to save the changes.
🧚 We can't wait to see what you build! Join the PixieBrix Slack Community if you need help or want to show off your latest creation.