moonmail

MoonMail: No subscriber to attachSender


When campaign sending process is fired up, AttachRecipientsService publish to SNS with the topic "ATTACH_SENDER_TOPIC_ARN". However, there is no subscriber to this action in AWS / MoonMail. Any idea how the "ATTACH_SENDER" is handled?

It is not possible to send a campaign without this information.

As noted here: https://github.com/microapps/MoonMail/wiki/Campaigns

Users service will get the message and attach a sender object, with the actual sender credentials in case he’s able to send the campaign (pushing the message to the PrecompileCampaign topic), or will drop the message to the campaign errors topic.

But there is no Users service. Any idea?


Solution

  • I replaced users service by sending a SNS event to the "PRECOMPILE_CAMPAIGN_TOPIC_ARN".

    events\lib\attach_recipients_count_service.js

     _publishToSns(canonicalMessage) {
            debug('= AttachRecipientsService._publishToSns', canonicalMessage);
            const params = {
              Message: JSON.stringify(canonicalMessage),
              TopicArn: process.env.PRECOMPILE_CAMPAIGN_TOPIC_ARN
            };
            return this.snsClient.publish(params).promise()
              .then(() => canonicalMessage);
          }
    

    Make sure that the canonicalMessage contains "sender" object:

    "sender": {
        "region": "...",
        "apiKey": "...",
        "apiSecret": "...",
        "ratePerSecond": "...",
        "emailAddress": "...",
        "fromName": "..."
      }