You may launch the API by doing:
['//executioncontext/messaging:viewer/compose/api/crud', payload, modtask]
The outcome
will be put in modtask.outcome
, i.e.
launchAPI(payload, cb) => {
doChain([['//executioncontext/messaging:viewer/compose/api/crud', payload, modtask],
() => cb(modtask.outcome)])
}Payload should be
{
action: 'generate',objconfig: {
templateaddress: 'the-template-address',fromIds: [userId, ...]
toIds: [userIdm ...]}
}And the output will create a JSON representation of the messagelog entry:
{
success: true,data: {
fromId: obj.froms[0].id,fromEmail: obj.froms[0].user,
toId: obj.tos[0].id,toEmail: obj.tos[0].user,
subject: obj.template.title,body: obj.template.description,
templatepath: objconfig.templateaddress}
}If the payload is
{
action: 'process',obj: {
// outcome.data from the call to generate}
} then the API will generate a new messagelog entry. However, if the payload is:{
action: 'process',messageId: numeric value
} the API will load the messagelog entry based on messageId.In both cases the API will send a using the transfer agent.