Skip to main content
Lymo can push real-time event notifications to your server via webhooks. When a plant is added to the store, Lymo sends an HTTP POST request to your configured endpoint with a JSON payload describing the event.

How webhooks work

When an event occurs, Lymo sends a POST request to the URL you registered. Your server receives the request, processes the payload, and responds with a 200 status code to acknowledge receipt. If Lymo does not receive a 200, it treats the delivery as failed and retries.

Webhook payload

Each webhook request includes a JSON body with the details of the event. For a plant event, the payload looks like this:
{
  "name": "monstera",
  "tag": "tropical"
}

Setting up your endpoint

1

Create a publicly accessible HTTPS endpoint

Your server must be reachable from the internet over HTTPS. Lymo will not deliver events to HTTP endpoints or localhost.
2

Register the webhook URL

Add your endpoint URL in the Lymo dashboard under Webhooks. Lymo starts delivering events immediately after you save the URL.
3

Return a 200 response to acknowledge receipt

Respond with an HTTP 200 status code as quickly as possible. Any other status code signals a failure.
4

Process the event asynchronously

After acknowledging the request, handle the payload in a background task or queue. This keeps your response time short and prevents delivery failures.

Responding to webhooks

Your endpoint needs to parse the incoming JSON body and return 200. Here are minimal examples in Express.js and Flask:
import express from "express";

const app = express();
app.use(express.json());

app.post("/webhooks/lymo", (req, res) => {
  const { name, tag } = req.body;

  // Acknowledge immediately
  res.sendStatus(200);

  // Process asynchronously
  console.log(`Received plant event: ${name} (${tag})`);
});

app.listen(3000);

Retry behavior

If your endpoint returns a non-2xx response or times out, Lymo retries the delivery using exponential backoff. Lymo attempts delivery multiple times before marking the event as failed.
Always return a 200 response quickly. If your handler takes too long, Lymo may consider the delivery failed and retry.
Use a task queue to process webhook payloads asynchronously so your endpoint responds immediately.