import sendgrid from "npm:@sendgrid/client@^7.7.0";
/**
* @param on_behalf_of The subuser's username. This header generates the
* API call as if the subuser account was making the call.
*/
type Sendgrid = {
token: string;
};
export async function main(
api_token: Sendgrid,
email: string,
on_behalf_of?: string,
) {
sendgrid.setApiKey(api_token.token);
const headers: Record<string, string> = { Accept: "application/json" };
if (on_behalf_of) {
headers["on-behalf-of"] = on_behalf_of;
}
const request = {
url: `/v3/suppression/bounces/${email}`,
method: "GET",
headers,
};
try {
const [_, body] = await sendgrid.request(request);
return body;
} catch (error) {
throw Error("\n" + JSON.stringify(error?.response?.body || error));
}
}
Submitted by admin 497 days ago
import sendgrid from "npm:@sendgrid/client@^7.7.0"
/**
* @param on_behalf_of The subuser's username. This header generates the
* API call as if the subuser account was making the call.
*/
type Sendgrid = {
token: string;
};
export async function main(
api_token: Sendgrid,
email: string,
on_behalf_of?: string,
) {
sendgrid.setApiKey(api_token.token);
const headers: Record<string, string> = { "Accept": "application/json" }
if(on_behalf_of) {
headers['on-behalf-of'] = on_behalf_of
}
const request = {
url: `/v3/suppression/bounces/${email}`,
method: 'GET',
headers
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by admin 500 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 on_behalf_of The subuser's username. This header generates the
* API call as if the subuser account was making the call.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
email: string,
on_behalf_of?: string,
) {
sendgrid.setApiKey(api_token.token);
const headers: Record<string, string> = { "Accept": "application/json" }
if(on_behalf_of) {
headers['on-behalf-of'] = on_behalf_of
}
const request = {
url: `/v3/suppression/bounces/${email}`,
method: 'GET',
headers
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by adam186 628 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 on_behalf_of The subuser's username. This header generates the
* API call as if the subuser account was making the call.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
email: string,
on_behalf_of?: string,
) {
sendgrid.setApiKey(api_token.token);
const headers: Record<string, string> = { "Accept": "application/json" }
if(on_behalf_of) {
headers['on-behalf-of'] = on_behalf_of
}
const request = {
url: `/v3/suppression/bounces/${email}`,
method: 'GET',
headers
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by adam186 663 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 on_behalf_of The subuser's username. This header generates the
* API call as if the subuser account was making the call.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
email: string,
on_behalf_of?: string,
) {
sendgrid.setApiKey(api_token.token);
const headers: Record<string, string> = { "Accept": "application/json" }
if(on_behalf_of) {
headers['on-behalf-of'] = on_behalf_of
}
const request = {
url: `/v3/suppression/bounces/${email}`,
method: 'GET',
headers
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
Submitted by adam186 751 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 on_behalf_of The subuser's username. This header generates the
* API call as if the subuser account was making the call.
*/
export async function main(
api_token: wmill.Resource<"sendgrid">,
email: string,
on_behalf_of?: string,
) {
sendgrid.setApiKey(api_token.token);
const headers: Record<string, string> = { "Accept": "application/json" }
if(on_behalf_of) {
headers['on-behalf-of'] = on_behalf_of
}
const request = {
url: `/v3/suppression/bounces/${email}`,
method: 'GET',
headers
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + JSON.stringify(error?.response?.body || error))
}
}
Submitted by adam186 751 days ago