Mirra
Get Started

Quickstart

Get started with Mirra in 5 minutes

Mirra enables you to build and deploy serverless scripts, API integrations, and automation workflows. This guide walks you through creating your first script.

Prerequisites

Before you begin, ensure you have:

Create your first script (UI)

The easiest way to create a script is through the browser-based interface:

  1. Navigate to the Developer Dashboard

    Visit https://store.getmirra.app/developer/scripts and sign in with your Mirra account.

  2. Click "Create New Script"

    This opens a guided 4-step wizard that walks you through the entire process.

  3. Add basic information (Step 1)

    • Name: Give your script a descriptive name
    • Description: Explain what your script does
    • Runtime: Choose Node.js 18 or Python 3.11
    • Category: Select the most appropriate category
    • Private: Toggle on if you want the script for personal use only
  4. Write your code (Step 2)

    The built-in Monaco editor provides syntax highlighting and autocomplete. A starter template is provided based on your chosen runtime:

    Node.js example:

    async function main(params) {
      return {
        success: true,
        message: 'Hello from your script!',
        input: params
      };
    }
     
    module.exports = { main };

    Python example:

    def main(params):
        return {
            'success': True,
            'message': 'Hello from your script!',
            'input': params
        }
  5. Configure resource permissions (Step 3)

    Select which integrations your script can access (Telegram, Gmail, Calendar, etc.). The UI auto-detects resources referenced in your code.

  6. Set up automation (Step 4)

    Configure how your script can be triggered (events, manual, scheduled), define user-facing variables, and set pricing if you're publishing to the marketplace.

  7. Deploy

    Click "Create Script" and your script is instantly deployed and ready to use!

The UI automatically handles deployment, configuration, and makes your script available immediately.

Create your first script (API)

For programmatic workflows and CI/CD pipelines, you can create scripts via the REST API.

Getting your API Key

Generate an API key from the web portal or the mobile app (SettingsDeveloper). Copy the key immediately. It's only shown once.

Store your API key securely. Never commit it to version control or expose it in client-side code.

See the Authentication guide for more details.

Create a script via API

Create a script by sending a POST request to the scripts endpoint:

curl https://api.fxn.world/api/sdk/v1/scripts \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Script",
    "description": "A simple echo script that returns the input",
    "runtime": "nodejs18",
    "category": "utility",
    "code": "async function main(params) { return { success: true, input: params }; } module.exports = { main };",
    "isPrivate": false,
    "config": {
      "timeout": 30,
      "memory": 256
    },
    "pricing": {
      "model": "free"
    }
  }'

Response:

{
  "success": true,
  "data": {
    "id": "673abc123def456789",
    "name": "My First Script",
    "description": "A simple echo script that returns the input",
    "runtime": "nodejs18",
    "status": "active",
    "createdAt": "2025-11-19T12:00:00Z"
  }
}

Your script is now deployed and ready to execute!

Using the SDK

The Mirra SDK provides type safety and convenience for Node.js and TypeScript applications.

Installation

npm install @mirra-messenger/sdk

Create a script using the SDK

import { MirraSDK } from '@mirra-messenger/sdk';
 
const mirra = new MirraSDK({ apiKey: process.env.MIRRA_API_KEY });
 
const script = await mirra.scripts.create({
  name: 'My Script',
  description: 'A helpful automation script',
  runtime: 'nodejs18',
  code: `
async function main(params) {
  return { success: true, input: params };
}
module.exports = { main };
  `.trim(),
  config: {
    timeout: 30,
    memory: 256
  }
});
 
console.log('Script created:', script.id);

Execute a script

const result = await mirra.scripts.invoke({
  scriptId: script.id,
  payload: { message: 'Hello, Mirra!' }
});
 
console.log('Result:', result);

Troubleshooting

401 Unauthorized

Your API key is missing or invalid.

Check that:

  • You include the X-API-Key header in every request
  • Your API key starts with mirra_
  • The key hasn't been revoked

See Authentication for more details.

400 Validation Error

Your request data failed validation.

Example error response:

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "subdomain must be between 3 and 30 characters",
    "details": {
      "field": "subdomain"
    }
  }
}

The details object indicates which field caused the validation error. Verify that all required fields are present and meet the documented constraints.

409 Conflict

The resource already exists (typically a naming conflict).

Example error response:

{
  "success": false,
  "error": {
    "code": "RESOURCE_EXISTS",
    "message": "A script with this name already exists"
  }
}

Choose a different name or verify that you do not already own the resource.

See the Error Codes reference for a complete list of error codes and handling strategies.

Next steps

Now that you have created your first script, explore more features:

On this page