getJourneyContent()

in lambda/Message_Archiver/archiver/lib/pinpoint.js [168:205]


  getJourneyContent(applicationId, journeyId, journeyActivityId) {
    return this.pinpoint.getJourney({
      ApplicationId: applicationId,
      JourneyId: journeyId,
    }).promise()
      // Get the Journey
      .then((response) => {
        this.options.logger.log({
            level: 'info',
            message: JSON.stringify(response.JourneyResponse)
        });
        return response.JourneyResponse;
      })
      // Get the Activity
      .then((journey) => {
        return journey.Activities[journeyActivityId];
      })
      // Get the Template
      .then((activity) => {
        const templateType = Object.keys(activity);
        const templateName = activity[templateType]['TemplateName'];
        return this.getTemplateContentByType[templateType](templateName);
      })
      .then((content) => {
          this.options.logger.log({
              level: 'info',
              message: JSON.stringify(content)
          });
          return content;
        })
      .catch((error) =>  {
        this.options.logger.log({
            level: 'error',
            message: JSON.stringify(error.message)
        });
        return [];
      });
  }