Schedule API with Natural Language

Use natural language to schedule emails programmatically.

Bu KinoshitaBu Kinoshita

A couple of weeks ago, we introduced the ability to schedule emails programmatically.

After seeing the positive feedback, we decided to take it a step further and introduce the ability to schedule emails using natural language.

Before

When we first launched, you could schedule an email by providing a timestamp in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).

This is still supported, since it provides flexibility for date and time manipulation.

import { Resend } from 'resend';
const resend = new Resend('re_123456789');
const oneMinuteFromNow = new Date(Date.now() + 1000 * 60).toISOString();
await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<p>it works!</p>',
scheduledAt: oneMinuteFromNow,
});

Now

Starting today, you can also use natural language to schedule an email.

The date can be defined in a more flexible format, such as "in 1 hour", "tomorrow at 9am", or "Friday at 3pm ET".

import { Resend } from 'resend';
const resend = new Resend('re_123456789');
await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<p>it works!</p>',
scheduledAt: 'in 1 min',
});

As a reminder, emails can be scheduled up to 72 hours in advance.

Conclusion

We hope this new feature improves the developer experience and makes it easier for you to schedule emails without the need to write more code or calculate timestamps using external libraries.