This commit is contained in:
philc 2025-02-10 16:49:23 +01:00
parent 3195ecbd4d
commit bf37c601ad

View File

@ -23,7 +23,7 @@ const router = express.Router();
router.post("/backend", (req, res) => {}); router.post("/backend", (req, res) => {});
/** /**
* @api {get} adminapi/notifications/messages/:alias/:tribeId -Get message list for alias in tribe * @api {get} adminapi/notifications/messages/:alias/:tribeId - Get message list for alias in tribe
* @apiName notiflist * @apiName notiflist
* @apiDescription Get list of notifications for an alias and a tribe * @apiDescription Get list of notifications for an alias and a tribe
* @apiGroup Notifications * @apiGroup Notifications
@ -44,7 +44,7 @@ router.get("/messages/:alias/:tribeId", (req, res) => {
/** /**
* @api {POST} adminapi/notifications/sendmail/:tribe/:template - Send personnalize emails * @api {POST} adminapi/notifications/sendmail/:tribe/:template - Send personnalize emails
* @apiName Sendmail * @apiName Sendmail
* @apiDescription Send campain personnalized email by rendering a template store in ../../{tribe}/template/{template}.js containing email key like html, subject, text, cc,.. as mustache templatewith blank test replaced by data.<br> It use a smtp in conf global or in /itm/{tribe}.json that must have valid parameter emailcontact must be authorized by the smtp <br> * @apiDescription Send campain personnalized email by rendering a template store in {tribe}/template/{template}.js containing email key like html, subject, text, cc,.. as mustache templatewith blank test replaced by data.<br> It use a smtp in conf global or in adminapi/objects/tribes/itm/{tribe}.json that must have valid parameter emailcontact must be authorized by the smtp <br>
* "emailcontact": "noreply@smatchit.io",<br> * "emailcontact": "noreply@smatchit.io",<br>
* "smtp": {<br> * "smtp": {<br>
* "host": "smtp-relay.brevo.com",<br> * "host": "smtp-relay.brevo.com",<br>
@ -54,15 +54,13 @@ router.get("/messages/:alias/:tribeId", (req, res) => {
* "user": "xx", * "user": "xx",
* "pass": "yy" * "pass": "yy"
* }<br> * }<br>
* }
* @apiGroup Notifications * @apiGroup Notifications
* *
* @apiParam {string} template that must exist in {tribe}/template/{template}_{lg}.js that contain all email component (html, text, attachement...) * @apiParam {string} template that must exist in {tribe}/template/{template}_{lg}.js that contain all email component (html, text, attachement...)
* @apiParam {string} tribe * @apiParam {string} tribe
* @apiBody {object} emailstosend {emailsto:[{to:[emailslist], cc:[],bcc:[],attachments:[] and any key:value specific for this email}], key:value common to all email that will be include in each email} each item af emailsto is a mail that will be send.<br> If one email of emailsto[].to is not valid then it will be store in result.fail:[{to:emailerror,err:["errorformat"]}], then for well formated email, the result of an email will be store in results.success:[{to:emailsto[].to.emailslist.join(","),status:smtp status}] * @apiBody {object} emailstosend Format like { emailsto:[{to:[emailslist], cc:[],bcc:[],attachments:[],any key:value specific for this email}], any key:value common to all emails}<br> Each item af emailsto is a mail that will be send.<br> If one email of emailsto[].to is not valid then it will be store in result.fail:[{to:emailerror,err:["errorformat"]}], then for well formated email, the result of an email will be store in results.success:[{to:emailsto[].to.emailslist.join(","),status:smtp status}]
* *
* @apiSuccess {object} notif content
* @apiSuccessExample {json} Success-Response: * @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK * HTTP/1.1 200 OK
* {status:200,ref:"Notification",msg:"emailmanage",data:{emailsuccess:"number of mail sent",emailfail:"number of email adresse rejected",failsdetail:[{to:emailerror,err:["errorformat"]}] * {status:200,ref:"Notification",msg:"emailmanage",data:{emailsuccess:"number of mail sent",emailfail:"number of email adresse rejected",failsdetail:[{to:emailerror,err:["errorformat"]}]
@ -119,7 +117,7 @@ router.post(
); );
/** /**
* @api {POST} adminapi/notifications/registeranonymous -Register email||phone to mlist * @api {POST} adminapi/notifications/registeranonymous - Register email||phone to mlist
* @apiName register * @apiName register
* @apiGroup Notifications * @apiGroup Notifications
* @apiDescription Register an email or phone into a mailinglist mlist * @apiDescription Register an email or phone into a mailinglist mlist
@ -159,7 +157,7 @@ router.post("/registeranonymous", checkHeaders, (req, res) => {
res.status(result.status).json(result); res.status(result.status).json(result);
}); });
/** /**
* @api {GET} adminapi/notifications/unregister/:tribe/:mlist/:typekey/:data/:validation -Unregister email or phone from a mlist or all mlist * @api {GET} adminapi/notifications/unregister/:tribe/:mlist/:typekey/:data/:validation - Unregister email or phone from a mlist or all mlist
* @apiName unregister * @apiName unregister
* @apiGroup Notifications * @apiGroup Notifications
* @apiDescription Register an email into a mailinglist mlist * @apiDescription Register an email into a mailinglist mlist
@ -193,7 +191,7 @@ router.get(
); );
/** /**
* @api {GET} adminapi/notifications/stat/maillinglst/:tribe --Statistic maillinglst * @api {GET} adminapi/notifications/stat/maillinglst/:tribe - Statistic maillinglst
* @apiName statmaillinglst * @apiName statmaillinglst
* @apiGroup Notifications * @apiGroup Notifications
* @apiDescription Mailling list statistique * @apiDescription Mailling list statistique
@ -232,7 +230,7 @@ router.get("/stat/maillinglst/:tribe", checkHeaders, async (req, res) => {
}); });
/** /**
* @api {POST} adminapi/notifications/contactanonymous/:tribe -Contact anonymous * @api {POST} adminapi/notifications/contactanonymous/:tribe - Contact anonymous
* @apiName contactanonymous * @apiName contactanonymous
* @apiGroup Notifications * @apiGroup Notifications
* @apiDescription Register a contact in tribe and send a mail to admin of tribe * @apiDescription Register a contact in tribe and send a mail to admin of tribe