Promatly Logo
Promatly Developer Portal
Back to Home

Website & API Integration Guide

Learn how to run your converted workflows programmatically on your own website, application, or backend.

⚠️ Security Notice: Never expose your Promatly API key in client-side code (frontend JavaScript). Always route requests through your server's backend to keep your credentials safe.

Workflow Integration Steps

Step 1

Generate your Promatly API Key

Your API key authenticates your requests. It uses the prefix pmt_ for security.

  1. Navigate to the Account Settings page.
  2. Scroll down to the **Zapier Integration** section.
  3. Click **Generate Key** (or **Rotate Key** if you wish to reset it).
  4. Copy the API key to a secure storage system or environment configuration variable (e.g., PROMATLY_API_KEY).
Step 2

Retrieve the Workflow ID

Every workflow has a unique 24-character hexadecimal identifier.

  1. Find your workflow inside your dashboard or database.
  2. Copy its unique database identifier (e.g., 6a2e5ae1560dfbda674f4a48).
Step 3

Execute Workflow API Call

Trigger your workflow by sending a secure HTTPS POST request containing inputs mapping to the first step of your workflow.

POST https://www.promatly.com/api/zapier/workflows/<WORKFLOW_ID>/run

Headers Required:

Payload Body Format:

Provide inputs for execution inside an inputs dictionary object.

Integration Code Snippets

Select your language below to copy the drop-in code for triggering execution from your application:

curl -X POST "https://www.promatly.com/api/zapier/workflows/YOUR_WORKFLOW_ID/run" \
  -H "Authorization: Bearer pmt_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": {
      "user_message": "Hello, please format my prompt",
      "model_type": "gpt-4o-mini"
    }
  }'
const fetch = require('node-fetch'); // Required for Node.js < 18

async function triggerWorkflow() {
  const workflowId = 'YOUR_WORKFLOW_ID';
  const apiKey = 'pmt_YOUR_API_KEY';
  const url = `https://www.promatly.com/api/zapier/workflows/${workflowId}/run`;

  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      inputs: {
        user_message: 'Hello, please format my prompt',
        model_type: 'gpt-4o-mini'
      }
    })
  });

  const data = await response.json();
  if (data.ok) {
    console.log('Workflow Output:', data.output);
  } else {
    console.error('Execution Error:', data.error);
  }
}

triggerWorkflow();
// Use this to run workflow directly via browser or web client (make sure API key is proxy-hidden)
async function runPromatlyWorkflow(workflowId, inputs) {
  const response = await fetch(`https://www.promatly.com/api/zapier/workflows/${workflowId}/run`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer pmt_YOUR_API_KEY`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ inputs })
  });

  const data = await response.json();
  if (!response.ok || !data.ok) {
    throw new Error(data.error || 'Workflow execution failed');
  }
  return data.output;
}
import requests

def run_workflow(workflow_id, api_key, inputs):
    url = f"https://www.promatly.com/api/zapier/workflows/{workflow_id}/run"
    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    }
    payload = {
        "inputs": inputs
    }
    
    response = requests.post(url, json=payload, headers=headers)
    data = response.json()
    
    if response.status_code == 200 and data.get("ok"):
        return data.get("output")
    else:
        raise Exception(data.get("error", "Unknown error during execution"))

# Example Usage
# result = run_workflow("YOUR_WORKFLOW_ID", "pmt_YOUR_API_KEY", {"user_message": "test"})
# print(result)

🚀 Zapier Custom App Deployment Guide

If you used Promatly to generate a custom Zapier integration (via the Zapier CLI export), follow these steps to deploy it to your Zapier account.

1

Download and Extract

Download the .zip file from your Promatly dashboard. Right-click the file on your computer and select Extract All.

Open Windows PowerShell and navigate into the extracted folder:

PowerShell
cd "C:\path\to\your\extracted\migrated-zapier-project"
2

Install Dependencies

You must install the global Zapier CLI tool, and then install the specific local packages required for your workflow to build.

PowerShell
npx npm install -g zapier-platform-cli
npm install
3

Log In & Register App

Securely connect your terminal to your Zapier account and register your new custom app.

PowerShell
npx zapier-platform-cli login
npx zapier-platform-cli register "My Custom Promatly Workflow"

Follow the prompts to enter your email, password, and categorize your app (e.g. "Public", "HR").

4

Push to Zapier Servers

Upload your code to Zapier so it becomes a live app.

PowerShell
npx zapier-platform-cli push
5

Authenticate in Zapier UI

Once your terminal says "Push complete", your app is officially live on Zapier!

  1. Go to your Promatly Settings page in your web browser.
  2. Click the black Rotate Key button to generate a brand-new, secure API key. Copy it immediately.
  3. Go to Zapier.com and click + Create Zap.
  4. Search for your newly registered app in the Trigger or Action menu.
  5. When prompted to Sign in / Connect Account, paste the fresh API key you copied.
  6. Test the trigger and click Publish!

API Response Format

Success Response (200 OK)

{
  "ok": true,
  "output": {
    "result": "Formatted output from the final step of your workflow",
    "status": 200
  }
}

Error Response (500 / 401 / 403)

{
  "ok": false,
  "error": "Error executing step 17 (Format Prompt): Cannot read properties of undefined (reading 'final_prompt')"
}