New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

slapform

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slapform

Easily send submission to Slapform, your favorite form backend service.

latest
Source
npmnpm
Version
3.0.2
Version published
Weekly downloads
17
-22.73%
Maintainers
1
Weekly downloads
 
Created
Source



Site | NPM Module | GitHub Repo

Slapform is the official npm module for Slapform, a backend form processing service for contact forms, payment forms, and more—perfectly suited for static sites.

Quick start

1. Create a form

Go to slapform.com/dashboard/forms/new to create your form. Copy the Form ID when you're done.

2. Add to your site

Script tag (no build tools needed):

<script src="https://cdn.jsdelivr.net/npm/slapform@latest/dist/slapform.min.js"></script>
<script>
  var slapform = new Slapform();

  slapform.submit('YOUR_FORM_ID', {
    name: 'Jon Snow',
    message: 'Hello World!',
  })
  .then(function (response) {
    console.log('Success!', response);
  })
  .catch(function (error) {
    console.error('Failed:', error.message);
  });
</script>

NPM:

npm install slapform
// ESM
import Slapform from 'slapform';

// CommonJS
const Slapform = require('slapform');
const slapform = new Slapform({ formId: 'YOUR_FORM_ID' });

const response = await slapform.submit({
  name: 'Jon Snow',
  message: 'Hello World!',
});

HTML form (no JavaScript needed)

You can use Slapform without any JavaScript by pointing your HTML form's action to the API:

<form method="POST" action="https://api.slapform.com/YOUR_FORM_ID">
  <input type="email" name="email">
  <textarea name="message"></textarea>
  <button type="submit">Submit</button>
</form>

API

new Slapform(options)

OptionDefaultDescription
formId''Your form ID (also accepts form)
endpoint'https://api.slapform.com'API endpoint

slapform.submit(formId?, data, options?)

Submits form data. Returns a promise that resolves with the API response.

  • formId (optional) — Form ID string. Overrides the constructor's formId
  • data — Object with the fields you want to submit
  • options — Optional overrides for formId and endpoint
// Pass formId inline
slapform.submit('YOUR_FORM_ID', { message: 'Hello' });

// Or use the constructor default and just pass data
const sf = new Slapform({ formId: 'YOUR_FORM_ID' });
sf.submit({ message: 'Hello' });

// Override formId via options
sf.submit({ message: 'Hello' }, { formId: 'DIFFERENT_FORM_ID' });

Name triggers

Use special field names to trigger server-side behavior:

slapform.submit('YOUR_FORM_ID', {
  name: 'Jon Snow',
  message: 'Hello World!',
  slap_subject: 'My Favorite Message',
  slap_replyto: 'custom@replyto.com',
  slap_debug: false,
  slap_honey: '',
});

See the name trigger documentation for details.

Features

  • Submit data via HTML forms, AJAX, or this npm module
  • Submissions are sent directly to your email
  • Access submissions stored securely for up to 12 months
  • Spam protection
  • Zapier integration

Development

npm start        # Watch mode - rebuilds on file changes
npm run build    # One-time build (ESM, CJS, IIFE)
npm test         # Run tests

Build outputs

FileFormatUse case
dist/index.mjsESMimport in modern bundlers
dist/index.jsCJSrequire() in Node.js
dist/slapform.min.jsIIFE (minified)<script> tag / CDN

License

MIT

Keywords

html

FAQs

Package last updated on 15 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts