In this Scenario, I am trying to sent a notification from one user to another user through an Api call with payloads.
let notificationSystem: nkruntime.RpcFunction=(
ctx:nkruntime.Context,
logger:nkruntime.Logger,
nk:nkruntime.Nakama,
payload:string
)=>{
let user_id=ctx.userId;
let parsedPayload : { frienduserID :string; notify_content:string}=JSON.parse(payload);
let receiverId:string = parsedPayload[“frienduserID”];
let type_value:string = parsedPayload[“notify_content”];
logger.info("Receiver ID: " + JSON.stringify(receiverId));
logger.info("type_value : " + JSON.stringify(type_value));
let subject = “Notification”;
let content = {type: type_value};
let code = 101;
let senderId =user_id ;
let persistent = false;
try {
nk.notificationSend(receiverId, subject, content, code, senderId, persistent);
}
catch (error: any) {
logger.error(JSON.stringify(error.message));
return JSON.stringify({ error: error.message });
}
}
So, I tried to test this from nakama Api explorer Shows this error,
please help to resolve this, i’m stuck for 1 week