Create or replace a channel body for a template
const url = 'https://your-notavia-host/v1/templates/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/bodies/email';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"subject_template":"example","text_template":"example","html_template":"example","structured_template":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://your-notavia-host/v1/templates/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/bodies/email \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "subject_template": "example", "text_template": "example", "html_template": "example", "structured_template": "example" }'Upserts the body for the given channel. channel must be one of:
email, in_app, sms, slack, teams, discord.
Returns 200 OK when updating an existing body; 201 Created when
creating one for the first time.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Kebab-case channel identifier used in URL path segments and template body keys.
Request Body required
Section titled “Request Body required ”Provide the fields relevant to the target channel. Fields not applicable to the channel are ignored.
object
JSON string containing the channel-specific structured body. For Slack this is a Block Kit blocks array rendered via Liquid. For Teams this is an Adaptive Card v1.5 object rendered via Liquid. For Discord this is an embed object rendered via Liquid.
Example generated
{ "subject_template": "example", "text_template": "example", "html_template": "example", "structured_template": "example"}Responses
Section titled “ Responses ”Body updated.
Per-channel body variant for a template. The channel-specific fields that apply depend on the channel:
- Email:
subject_template+html_template(+ optionaltext_template) - InApp:
html_template(ortext_templatefor plain-text in-app) - SMS:
text_template - Slack:
structured_template(Block Kit JSON as Liquid template) - Teams:
structured_template(Adaptive Card v1.5 JSON as Liquid template) - Discord:
text_template(content) and/orstructured_template(embed JSON)
object
Notification channel identifier.
Example
{ "channel": "email"}Body created.
Per-channel body variant for a template. The channel-specific fields that apply depend on the channel:
- Email:
subject_template+html_template(+ optionaltext_template) - InApp:
html_template(ortext_templatefor plain-text in-app) - SMS:
text_template - Slack:
structured_template(Block Kit JSON as Liquid template) - Teams:
structured_template(Adaptive Card v1.5 JSON as Liquid template) - Discord:
text_template(content) and/orstructured_template(embed JSON)
object
Notification channel identifier.
Example
{ "channel": "email"}Validation or request error.
object
object
Example generated
{ "error": { "type": "example", "code": "example", "message": "example", "param": "example" }}Missing or invalid credentials.
object
object
Example generated
{ "error": { "type": "example", "code": "example", "message": "example", "param": "example" }}Credentials do not have the required scope.
object
object
Example generated
{ "error": { "type": "example", "code": "example", "message": "example", "param": "example" }}