declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$importMasterJsonRequestDto = new Components\ImportMasterJsonRequestDto(
locale: 'en_US',
masterJson: [
'workflows' => [
'welcome-email' => [
'welcome.title' => 'Welcome to our platform',
'welcome.message' => 'Hello there!',
],
'password-reset' => [
'reset.title' => 'Reset your password',
'reset.message' => 'Click the link to reset',
],
],
],
);
$response = $sdk->translations->master->import(
importMasterJsonRequestDto: $importMasterJsonRequestDto
);
if ($response->importMasterJsonResponseDto !== null) {
// handle response
}
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.translations.master.import_master_json(import_master_json_request_dto={
"locale": "en_US",
"master_json": {
"workflows": {
"welcome-email": {
"welcome.title": "Welcome to our platform",
"welcome.message": "Hello there!",
},
"password-reset": {
"reset.title": "Reset your password",
"reset.message": "Click the link to reset",
},
},
},
})
# Handle response
print(res)
package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Translations.Master.Import(ctx, components.ImportMasterJSONRequestDto{
Locale: "en_US",
MasterJSON: map[string]any{
"workflows": map[string]any{
"welcome-email": map[string]any{
"welcome.title": "Welcome to our platform",
"welcome.message": "Hello there!",
},
"password-reset": map[string]any{
"reset.title": "Reset your password",
"reset.message": "Click the link to reset",
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.ImportMasterJSONResponseDto != nil {
// handle response
}
}
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.translations.master.import({
locale: "en_US",
masterJson: {
"workflows": {
"welcome-email": {
"welcome.title": "Welcome to our platform",
"welcome.message": "Hello there!",
},
"password-reset": {
"reset.title": "Reset your password",
"reset.message": "Click the link to reset",
},
},
},
});
console.log(result);
}
run();
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Translations.Master.ImportAsync(importMasterJsonRequestDto: new ImportMasterJsonRequestDto() {
Locale = "en_US",
MasterJson = new Dictionary<string, object>() {
{ "workflows", new Dictionary<string, object>() {
{ "welcome-email", new Dictionary<string, object>() {
{ "welcome.title", "Welcome to our platform" },
{ "welcome.message", "Hello there!" },
} },
{ "password-reset", new Dictionary<string, object>() {
{ "reset.title", "Reset your password" },
{ "reset.message", "Click the link to reset" },
} },
} },
},
});
// handle response