rewritetoday, the official Node.js/TypeScript SDK for the Rewrite API.
It wraps authentication, typed REST calls, and resource helpers on top of @rewritetoday/rest and @rewritetoday/types.
Use your preferred package manager:
bun add rewritetoday
# Or
npm install rewritetoday
# Or
pnpm add rewritetodayFirst, you need to create an API key in the Rewrite Dashboard and use it in the constructor.
import { Rewrite } from 'rewritetoday';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY);import { Rewrite } from 'rewritetoday';
const rewrite = new Rewrite({
secret: process.env.REWRITE_API_KEY,
rest: {
timeout: 10_000,
headers: {
'User-Agent': 'GetMonitor API (1.0.0)',
},
},
});const { data, error } = await rewrite.messages.send({
to: '+551234567890',
content: 'Hey, Rewrite is here!',
});You can view in our documentation everything in you can use when sending a message.
Requests run through @rewritetoday/rest. HTTP failures can throw HTTPError.
import { HTTPError } from '@rewritetoday/rest';
try {
await rewrite.messages.get('invalid_id');
} catch (error) {
if (error instanceof HTTPError) {
console.error('HTTP Error:', error.status, error.method, error.url);
}
}Made with 🤍 by the Rewrite team.
SMS the way it should be.