Slapdash Platform
GitHub
  • Ahoy, world!
  • Command Bar 101
    • How it Works
    • Core Terminology
    • Commands
    • Local Commands
    • Cloud Commands
    • Build Your First Command
    • Publish Command
    • Hooks
  • Command Tutorials
    • Toggle Dark Mode
    • Emoji Paster
    • Copy Special Character
    • Send Slack Message
  • Reference
    • Command Response
    • Action
    • View
    • List View
    • Masonry View
    • Form View
    • Tokens
    • Icon
    • Config
Powered by GitBook
On this page
  • Create Cloud Command
  • Developing & Deploying with Replit
  • Deploying with Vercel
  1. Command Bar 101

Cloud Commands

Commands that are hosted on the web.

PreviousLocal CommandsNextBuild Your First Command

Last updated 3 years ago

Cloud commands are hosted at URL endpoints. Slapdash makes HTTPS requests to the endpoint and interprets the JSON-encoded . Commands that run in the cloud can't make any changes to your computer (it's just JSON over HTTPS after all), so they are a safe way to share Command Bar functionality with others.

Create Cloud Command

To create a cloud command, run Create Command in the Command Bar, choose Cloud as a type, paste the Endpoint URL of your command, give it a name and press Create Command.

Developing & Deploying with Replit

The fastest way to start is to fork another Repl. Here are a few examples you can choose from:

Run Command

After forking the Repl, hit the Run button to make sure the associated HTTPS endpoint is accessible. Find the endpoint URL in the top-right panel. This is the URL you will use to create the command inside Slapdash.

Deploying & Sharing Command By default, Repls aren't always running. If you plan to use the command often or to share it with others, you'll need to make sure the Repl is set to be Always On.

Deploying with Vercel

Start by creating a New Project inside Vercel and choose the NextJS template.

Create a new file in the project under pages/api/ahoy-world.js.

Then, add the following sample code and push to your repository to deploy it.

module.exports = async (req, res) => {
  const response = {
    view: {
      type: "list",
      options: [
        {
          title: "Open Slapdash",
          action: {
            type: "open-url",
            url: "https://slapdash.com"
          }
        },
        {
          title: "Copy Heart Emoji",
          action: {
            type: "copy",
            value: "❤️"
          }
        }
      ]
    }
  };
  res.setHeader("Access-Control-Allow-Headers", "*"); // for config headers
  res.setHeader("Access-Control-Allow-Origin", "*");
  res.json(response);
}

At this stage, you should have a functioning URL like https://nextjs-***.vercel.app/api/ahoy-world that you can use to create a command in Slapdash.

One of our favourite ways to host and develop cloud commands is with . We like it because we can use any programming language to write the command, and we can do the development directly in the browser. It's a super quick way to get an HTTPS endpoint up and running with just a few clicks. Fork Example

You can also use Vercel to deploy a command as a .

Replit
Basic Python Example
Send Slack Message
Serverless Function
Command Response