Skip to main content
@mynthio/sdk/convex provides mynthWebhookAction() for handling signed Mynth webhooks in Convex HTTP actions.

Webhook helper

import { mynthWebhookAction } from "@mynthio/sdk/convex";

export const mynthWebhook = mynthWebhookAction({
  imageTaskCompleted: async (payload, { context }) => {
    console.log(payload.task.id);
    console.log(payload.result.images);
  },
  imageTaskFailed: async (payload) => {
    console.error("Task failed", payload.task.id);
  },
});
The helper:
  • verifies X-Mynth-Signature using HMAC-SHA256
  • parses the event and routes it to the matching handler
  • exposes Convex context for running queries and mutations
If you do not pass a secret explicitly, the helper reads MYNTH_WEBHOOK_SECRET from the environment.

Full walkthrough

For a complete Convex integration including schema, actions, webhooks, and reactive UI, see the Convex full-stack guide.