Supermatic Docs

Try the console

We strongly believe in quick feedback loops. That's why we built the console. You can use the console when you for example need to change orders in bulk or find all customers that ordered a specific product. Since you can import the files you write in the editor, you can even test your code in the console.

In this guide, you'll learn how to send out an email with the console.

1. Hello, world!

The console is always with you, on every page in the dashboard, in the bottom left corner:

Console

Click the "Console" button and give it a try with a classic "Hello, world!" example:

console.log("Hello, world!");

Click "Run" and "Hello, world!" should be printed on the right side.

Protip: Go to the logs to see the output of your console executions.

2. Send an email

Let's take the "Hello, world!" example to the next level, by sending an email instead:

import email from "@supermatic/email";

export default async () => {
  await email.send({
    from: "[email protected]", // Your email address.
    html: "<h1>Hello, world!</h1>",
    subject: "Hello, world!",
    to: "[email protected]", // The recipient's email address.
  });
  console.log("Email sent!");
};

Paste this into your console, change from and to to something more reasonable, and click "Run".

Note that the from address has to be an address that has been approved by us. The email address connected to your Supermatic account is already preapproved, but if you'd like to use another address, contact us at [email protected]

3. Import files

One of the most useful features of the console is that you can test the code you write in the editor.

Head over to the editor and create a file called test.js (read more about the editor in Create your first automation). Paste the following code in it and save it:

export function logSomething() {
   console.log("Logging something from test.js");
}

Now, open the console and run the following code:

import {logSomething} from "./test.js";

logSomething();

"Logging something from test.js" should now printed.