Back to APIs

List, create, update and delete applications.

Using the Svix API with Trigger.dev

You can use Trigger.dev with any existing Node SDK or even just using fetch. Using io.runTask makes your Svix background job resumable and appear in our dashboard.

Use io.runTask() and the official SDK or fetch.

Use our HTTP endpoint to subscribe to webhooks

Example code using Svix

Below are some working code examples of how you can use Svix with Trigger.dev. These samples are open source and maintained by the community, you can copy and paste them into your own projects.

1
import z from "zod";
2
import { Svix } from "svix";
3
import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
4
5
// Create an access token at https://api.svix.com/docs#section/Introduction/Authentication
6
// https://dashboard.svix.com/api-access
7
const svix = new Svix(process.env.SVIX_API_KEY!);
8
9
// Using official Svix sdk, https://github.com/svix/svix-webhooks/tree/main/javascript/
10
client.defineJob({
11
id: "create-svix-application",
12
name: "Create Svix application",
13
version: "1.0.0",
14
trigger: eventTrigger({
15
name: "create-svix-application",
16
schema: z.object({
17
name: z.string(),
18
uid: z.string().optional(),
19
rateLimit: z.number().optional(),
20
metadata: z.record(z.string(), z.string()).optional(),
21
}),
22
}),
23
run: async (payload, io) => {
24
await io.runTask(
25
"Create application",
26
async () => {
27
const app = await svix.application.create({
28
name: payload.name,
29
rateLimit: payload.rateLimit,
30
uid: payload.uid,
31
metadata: payload.metadata,
32
});
33
return app;
34
},
35
36
// Add metadata to improve how the task displays in the logs
37
{ name: "Create application", icon: "svix" }
38
);
39
},
40
});