0.0.1 • Published 4 years ago

serverless-escapia-robotify v0.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

serverless-escapia-robotify

Report Downloader

Supported Reports

How to download an Escapia report

To submit a report download request, publish an AWS SNS message with the following details:

  • TopicArn -- arn:aws:sns:us-east-2:673853704728:escapia-robotify-report-download-request
  • Message -- a stringified JSON object with the following properties:
    • transactionId (type: string) (optional) -- a unique Id to help track your download request
    • callingProgress (type: string) (optional) -- the name of your process, also used to help track your download request
    • reportType (type: string) (required) -- the type of report you're downloading; supported values include:
      • Folio Balance
    • fileFormat (type: string) (required) -- the file format of the downloaded report; known supported values include:
      • CSV
      • EXCELOPENXML
    • reportParams (type: object) (optional) -- report parameters; supported object properties/values include:
      • startDate (type: string) -- the start date of the report
      • endDate (type: string) -- the end date of the report

Example download request in Node:

const AWS = require('aws-sdk');
AWS.config.region = 'us-east-2';
AWS.config.apiVersions = {
    sns: '2010-03-31'
};
const sns = new AWS.SNS();

const downloadReport = (event, context, callback) => {
    let messagePayload = {
        "transactionId": "qWSN1UHlEkESAJAbO_wV-XXX",
        "callingProcess": "my kewl process",
        "reportType": "Folio Balance",
        "fileFormat": "CSV",
        "reportParams": {
            "startDate": "7/6/2019",
            "endDate": "7/16/2019"
        },
        "escapiaInstanceId": "1655"
    }

    let response = {
        statusCode: 200,
        headers: {
          "Access-Control-Allow-Origin": "*",
          "Access-Control-Allow-Credentials": true
        }
    };

    let params = {
        Message: JSON.stringify(messagePayload),
        TopicArn: 'arn:aws:sns:us-east-2:673853704728:escapia-robotify-report-download-request'
    };
    sns.publish(params, (err, data) => {
        if (err) {
            logger.debug(err);
            response.body = JSON.stringify({ success: false, message: err.message });
        }
        else {
            response.body = JSON.stringify({ success: true });
        }
        callback(null, response);
    });
};

To receive notification after the report has been uploaded to s3, subscribe to the following SNS ARN:

  • arn:aws:sns:us-east-2:673853704728:escapia-robotify-report-download-results

An example of the results SNS message:

{
    "transactionId": "qWSN1UHlEkESAJAbO_wV-XXX",
    "callingProcess": "my kewl process",
    "reportType": "Folio Balance",
    "success": true,
    "s3Bucket": robotify-escapia-reports,
    "s3Key": "qWSN1UHlEkESAJAbO_wV-XXX/Folio Balance Report.csv"
}

An example of SNS message to request the Charge Template Unit Scope report:

{
    "transactionId": "abcdefghijklm",
    "callingProcess": "my kewl process",
    "reportType": "Charge Template Unit Scope",
    "fileFormat": "CSV",
    "reportParams": {}
}

Airbnb Rate Reconciliation

In general, the robot follows the process documented here: https://turnkeyvr.screenstepslive.com/s/internal/m/77430/l/871336-finalize-airbnb-reservation

Additional details on the robot:

  • The robot runs every 10 - 15 minutes and processes up to 5 Cases per run
  • When the robot picks up Cases to process, it first updates the Case Status to "In Progress"
  • In the event of an error during Case processing (ex: Escapia fails to load a page) or a scenario that the robot isn't programmed to handle (ex: a Reservation with a security deposit):
    • The Case's Subject will be updated to "Finalize Airbnb reservation in Escapia - - ROBOTIFY FAILURE"
    • The Case's Status will be reset to "New"
    • The Case's Description will include some details on the specific error
  • When the robot successfully processes a Case:
    • The Case's Status will be set to "Closed"
    • The Case's Description will include notes on what the robot did to process the Case
  • When the robot believes it successfully processed a Case but isn't 100% sure:
    • The Case's Subject will be updated to "Finalize Airbnb reservation in Escapia - - REVIEW REQUIRED"
    • The Case's Status will be reset to "New"
    • The Case's Description will include some details on what needs to be reviewed
  • Smiles will not see these Cases in the "Res - Airbnb Pending Reconcile -Smiles" Case list view unless the Case Subject is "Finalize Airbnb reservation in Escapia - - ROBOTIFY FAILURE" or "Finalize Airbnb reservation in Escapia - - REVIEW REQUIRED". While there will be notes from the robot in the Case Description, in general Smiles should try to work the Case from the beginning of the process documented in ScreenSteps, and if they are unable to reconcile the Case they should escalate.