While there are examples scattered throughout the Plugin API documentation, this page is dedicated to accumulating examples to help plugin authors access functional building blocks.
linkStarter repos
While this documentation of examples will continue to grow & expand over time, there are also some evergreen repos we recommend visiting as the starting point for writing your own Amplenote plugin:
Plugin Embed Starter Project. Build a React-based application that can be rendered in a note, sidebar, or anywhere else
Plugin Template. A barebones plugin with the means to run tests.
AmpleAI and the multitude of existing plugins. There are more than 100 Amplenote plugins, almost all of which can be retrieved to use as examples & context.
linkCreating a new task action initiated by /slash command
If you want to implement a slash command that is conditionally available in tasks, you'll need to use the check method within a string command nested in the appOption section of your plugin definition. That is,
When you retrieve a task, you have access to all of the properties mentioned in the task definition.
linkParsing Rich Footnotes in a task
How to parse the text of a task with Rich Footnotes? Let's look at an example footnote task:
Here's a task with description and image, a link to your favorite website a text-only footenote, a link to a note and a connected task
The task connected
This yields the following content returned in task.content:
Most often, you'll want an LLM to parse this text to
linkCalling an external service from a plugin
In general, you can use the fetch method to retrieve data from any external URL, as seen in the "Calling an LLM" example, below. The main caveat is that some APIs implement CORS restrictions that prevent the plugin's iframe from receiving the response. If you receive a CORS error, we recommend considering signing up for Cloudflare, to set up a Cloudflare Worker that can proxy requests from your plugin users to the target site & back. Here is the Cloudflare worker implementation that Amplenote uses to proxy requests for services with CORS restrictions.
If you are writing an agent, or a long-running plugin that should not prevent the user from working concurrently, consider using the app.openEmbed() call to write your progress to an ephemeral section available to users on desktop or mobile. Here are additional details on updating the contents of your embed as incremental progress occurs.
linkCalling an LLM (OpenAI, Gemini, Anthropic) from a plugin
The AmpleAI plugin offers a live prototype to see how an AI response. The challenges & decisions to make when you're building a plugin that will interface with AI include "will response be streamed?" (usually advisable) and "how will the plugin show streamed progress if so?" Here is the general idea: