π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
import { Resend } from 'resend';
import { EmailInterface } from '@gitroom/nestjs-libraries/emails/email.interface';
const resend = new Resend(process.env.RESEND_API_KEY || 're_132');
export class ResendProvider implements EmailInterface {
name = 'resend';
validateEnvKeys = ['RESEND_API_KEY'];
async sendEmail(
to: string,
subject: string,
html: string,
emailFromName: string,
emailFromAddress: string,
replyTo?: string
) {
const sends = await resend.emails.send({
from: `${emailFromName} <${emailFromAddress}>`,
to,
subject,
html,
...(replyTo && { reply_to: replyTo }),
});
// The SDK returns API errors (like 429 rate limits) instead of throwing,
// throw so sendEmailSync retries the send
if (sends.error) {
throw new Error(`${sends.error.name}: ${sends.error.message}`);
}
return sends;
}
}