import sendgrid from "npm:@sendgrid/client@^7.7.0";
/**
* @param contact_ids Important: contact IDs are not email addresses.
*/
type Sendgrid = {
token: string;
};
export async function main(
api_token: Sendgrid,
list_id: string,
contact_ids: string[],
) {
sendgrid.setApiKey(api_token.token);
const request = {
url: `/v3/marketing/lists/${list_id}/contacts`,
method: "DELETE",
qs: {
contact_ids: contact_ids?.join(",") || "",
},
};
try {
const [_, body] = await sendgrid.request(request);
return body;
} catch (error) {
throw Error("\n" + JSON.stringify(error?.response?.body || error));
}
}
Submitted by admin 392 days ago
import sendgrid from "npm:@sendgrid/client@^7.7.0"
/**
* @param contact_ids Important: contact IDs are not email addresses.
*/
type Sendgrid = {
token: string;
};
export async function main(
api_token: Sendgrid,
list_id: string,
contact_ids: string[],
) {
sendgrid.setApiKey(api_token.token)
const request = {
url: `/v3/marketing/lists/${list_id}/contacts`,
method: 'DELETE',
qs: {
contact_ids: contact_ids?.join(',') || ''
}
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by admin 395 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts"
import sendgrid from "npm:@sendgrid/client@^7.7.0"
/**
* @param contact_ids Important: contact IDs are not email addresses.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
list_id: string,
contact_ids: string[],
) {
sendgrid.setApiKey(api_token.token)
const request = {
url: `/v3/marketing/lists/${list_id}/contacts`,
method: 'DELETE',
qs: {
contact_ids: contact_ids?.join(',') || ''
}
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by adam186 523 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts"
import sendgrid from "npm:@sendgrid/client@^7.7.0"
/**
* @param contact_ids Important: contact IDs are not email addresses.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
list_id: string,
contact_ids: string[],
) {
sendgrid.setApiKey(api_token.token)
const request = {
url: `/v3/marketing/lists/${list_id}/contacts`,
method: 'DELETE',
qs: {
contact_ids: contact_ids?.join(',') || ''
}
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by adam186 558 days ago
import * as wmill from "https://deno.land/x/windmill@v1.51.0/mod.ts"
import sendgrid from "npm:@sendgrid/client@^7.7.0"
/**
* @param contact_ids Important: contact IDs are not email addresses.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
list_id: string,
contact_ids: string[],
) {
sendgrid.setApiKey(api_token.token)
const request = {
url: `/v3/marketing/lists/${list_id}/contacts`,
method: 'DELETE',
qs: {
contact_ids: contact_ids?.join(',') || ''
}
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by adam186 646 days ago