# Customjs

CustomJS is a code-first automation platform that enables seamless integration of custom JavaScript logic into various systems and technologies, allowing users to extend applications by writing functions for tasks like sending emails, generating PDFs, or updating CRM data fields.

- **Category:** developer tools
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 5
- **Triggers:** 0
- **Slug:** `CUSTOMJS`
- **Version:** 20260312_00

## Tools

### Authenticate CustomJS API Key

**Slug:** `CUSTOMJS_AUTHENTICATE_API_KEY`

Authenticate and validate a CustomJS API key. Returns workspace details, request limits, and decoded JWT token information including user email. Use this to verify an API key is valid before making other CustomJS API calls.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_key` | string | Yes | The CustomJS API key to verify. Obtain from the CustomJS dashboard. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Convert HTML to PDF

**Slug:** `CUSTOMJS_CONVERT_HTML_TO_PDF`

Convert HTML content to a PDF document. Use this tool to generate PDF files from raw HTML markup. Supports: - Complete HTML documents or fragments - Inline CSS styling (colors, fonts, tables, borders, backgrounds) - Unicode characters and special symbols - Multi-page documents Returns raw PDF bytes suitable for file storage or download.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `code` | string | No | JavaScript code snippet to process the HTML conversion. Uses the built-in HTML2PDF utility. The default value handles standard HTML to PDF conversion - typically no changes needed. |
| `input` | string | Yes | The HTML content to convert to PDF. Can be a complete HTML document including <html>, <head>, and <body> tags, or just a fragment. Supports inline CSS styles for formatting. |
| `returnBinary` | string | No | Instructs the API to return binary PDF data. Must be 'true' for PDF output. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Convert HTML to PNG

**Slug:** `CUSTOMJS_CONVERT_HTML_TO_PNG`

Tool to convert HTML string to PNG image. Use when you need a PNG from HTML after preparing your markup.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `html` | string | Yes | HTML content to convert into a PNG image |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Merge multiple PDFs into one

**Slug:** `CUSTOMJS_MERGE_PDFS`

Merge multiple PDF files from URLs into a single PDF document. Use this tool when you need to combine two or more PDF documents into one. The PDFs are merged in the order provided. All input URLs must be publicly accessible. Returns a downloadable merged PDF file.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `pdf_urls` | array | Yes | List of publicly accessible HTTP/HTTPS URLs pointing to the PDF files to merge. The PDFs will be merged in the order provided. Minimum 2 URLs required. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Run Puppeteer Script

**Slug:** `CUSTOMJS_RUN_PUPPETEER_SCRIPT`

Execute a Puppeteer script in a headless browser and capture a screenshot. Use this tool for browser automation tasks such as navigating to URLs, interacting with page elements, extracting data, or capturing visual snapshots of web pages. The script runs in a sandboxed Puppeteer environment with access to a 'page' object.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `code` | string | No | JavaScript wrapper code that invokes the PUPPETEER utility. In most cases, use the default value. Only modify if you need a different execution pattern. |
| `input` | string | Yes | Puppeteer script to execute in a headless browser. The script has access to a 'page' object (a Puppeteer Page instance). Common operations include: page.goto(url), page.waitForSelector(selector), page.click(selector), page.type(selector, text), page.screenshot(), and page.evaluate(). The script runs asynchronously, so use 'await' for async operations. |
| `returnBinary` | boolean | No | Whether to return a screenshot of the final page state as PNG image data. Set to true (default) to capture and return the screenshot. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
