Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.templates.update(
'748395130237498620',
{
description: 'Template usado no fluxo de recuperacao de conta',
content: 'Rewrite: seu codigo e {{code}}',
tags: { flow: 'otp', channel: 'recovery' },
variables: [{ name: 'code', fallback: '478201' }],
},
);
if (error) throw error;{
"ok": true,
"data": null
}Templates
Update a template
Update the content, variables or description of an existing template.
PATCH
/
templates
/
{id}
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.templates.update(
'748395130237498620',
{
description: 'Template usado no fluxo de recuperacao de conta',
content: 'Rewrite: seu codigo e {{code}}',
tags: { flow: 'otp', channel: 'recovery' },
variables: [{ name: 'code', fallback: '478201' }],
},
);
if (error) throw error;{
"ok": true,
"data": null
}Authorizations
Send your API key as Authorization: Bearer rw_....
Required scope: project:templates:write.
Path Parameters
Template identifier returned by Rewrite.
Example:
"748395130237498412"
Body
application/json
Updated default SMS content.
Required string length:
1 - 1024Example:
"Rewrite: seu codigo e {{code}}"
Updated variable definitions for the template.
Maximum array length:
15Show child attributes
Show child attributes
Example:
[{ "name": "code", "fallback": "478201" }]
Updated human-readable description for the template.
Required string length:
1 - 72Example:
"Template usado no fluxo de recuperacao de conta"
Replacement metadata stored with the template.
Example:
{ "flow": "otp", "channel": "login" }