// Example: Creating a custom template
const createCustomTemplate = async (template) => {
try {
const response = await axios.post(
'https://api.notifiersystem.com/v1/templates',
{
name: template.name,
language: template.language,
category: template.category,
components: [
{
type: 'HEADER',
format: 'IMAGE',
example: {
header_url: [template.headerImage]
}
},
{
type: 'BODY',
text: template.body,
variables: template.variables
},
{
type: 'BUTTON',
sub_type: 'URL',
index: '0',
parameters: template.buttonParameters
}
],
customizations: {
branding: template.branding,
styling: template.styling,
metadata: template.metadata
}
},
{
headers: {
'Authorization': `Bearer ${process.env.NOTIFIER_SYSTEM_API_KEY}`,
'Content-Type': 'application/json',
'X-Tenant-ID': process.env.TENANT_ID
}
}
);
return response.data;
} catch (error) {
console.error('Error creating template:', error);
throw error;
}
};