Table of Contents
Microfn supports cross-function calls, so your functions can call other functions.
This makes it possible to create reusable functions that you can plug into all kinds of scenarios.
For example, you could have a send-discord-message
function that is responsible for sending a message to Discord and use it across every other function you’d like to hook up to Discord.
Here’s how it works:
1. Create a new function
Head to https://microfn.dev and tap the “+” button to create a new function. Give it a nice name.
export async function main(input) { return { message: "Hello there, I'm a function!", timestamp: new Date().toISOString(), receivedInput: input };}
2. Import the @microfn/fn module
In your function, add our @microfn/fn
module. This is a built-in module provided by microfnhq to facilitate cross-function calls.
import fn from '@microfn/fn'
3. Use fn to send data between your functions
import fn from "@microfn/fn";
export async function main(input) { const res = await fn.executeFunction("david/call-me", "foobar");
return { message: "Hello there, I'm the main function", timestamp: new Date().toISOString(), receivedOutput: res };}
4. Call your function
Calling the function gives us the following output:
{ "message": "Hello there, I'm the main function", "receivedOutput": { "message": "Hello there, I'm a function!", "receivedInput": { "input": "foobar" }, "timestamp": "2025-09-22T08:00:52.972Z" }, "timestamp": "2025-09-22T08:00:53.175Z"}
Caveats
Only cross-calls across your account are currently supported. You will not be able to call functions not owned by you.
Check out the full documentation of the @microfn/fn
module at https://docs.microfn.dev/modules/fn/