diff --git a/botmaker_message/app.py b/botmaker_message/app.py index 8b9480d..5fb693c 100644 --- a/botmaker_message/app.py +++ b/botmaker_message/app.py @@ -33,10 +33,11 @@ def botmaker_message(event, context): botmaker.save() if SANDBOX_MODE and SANDBOX_URL: try: + auth_bm_token = event['headers'].get('auth-bm-token', '') requests.post( SANDBOX_URL, json=payload, - headers=event['headers'] + headers={"auth-bm-token": auth_bm_token} ) except Exception as e: pass diff --git a/packaged.yaml b/packaged.yaml index 6311c4a..7fad4af 100644 --- a/packaged.yaml +++ b/packaged.yaml @@ -1,4 +1,5 @@ AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 Description: 'omni-serverless Sample SAM Template for omni-serverless @@ -6,51 +7,52 @@ Description: 'omni-serverless ' Globals: Function: - Timeout: 3 -Outputs: - BotmakerMessageApi: - Description: Api Botmaker Message - Value: - Fn::Sub: https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/botmaker/message - CuencaShippingApi: - Description: Api Cuenca Shipping - Value: - Fn::Sub: https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/cuenca-shipping/address + Timeout: 5 Resources: - BotmakerMessageFunction: + CuencaShippingFunction: + Type: AWS::Serverless::Function Properties: - CodeUri: s3://omni-serverless.cuenca.io/3c754f49836826d39576ac79e938db4f + CodeUri: s3://omni-serverless.cuenca.io/64b65d2f3f116974bbd59fc6eb214384 + Handler: app.cuenca_shipping + Runtime: python3.7 Environment: Variables: MONGO_URI: mongodb://0.0.0.0:27017/ + CORS_ORIGIN: http://0.0.0.0:9000 Events: CuencaShipping: + Type: Api Properties: + Path: /cuenca-shipping/address Method: post - Path: /botmaker/message + CuencaShippingCors: Type: Api - Handler: app.lambda_handler - Runtime: python3.7 + Properties: + Path: /cuenca-shipping/address + Method: options + BotmakerMessageFunction: Type: AWS::Serverless::Function - CuencaShippingFunction: Properties: - CodeUri: s3://omni-serverless.cuenca.io/1d6d365d1f6474104b15ab6918fea368 + CodeUri: s3://omni-serverless.cuenca.io/a42dcc73f0519a51768522afdc413f5e + Handler: app.botmaker_message + Runtime: python3.7 Environment: Variables: - CORS_ORIGIN: http://0.0.0.0:9000 MONGO_URI: mongodb://0.0.0.0:27017/ + SANDBOX_MODE: false + SANDBOX_URL: https://example.com Events: CuencaShipping: - Properties: - Method: post - Path: /cuenca-shipping/address Type: Api - CuencaShippingCors: Properties: - Method: options - Path: /cuenca-shipping/address - Type: Api - Handler: app.lambda_handler - Runtime: python3.7 - Type: AWS::Serverless::Function -Transform: AWS::Serverless-2016-10-31 + Path: /botmaker/message + Method: post +Outputs: + CuencaShippingApi: + Description: Api Cuenca Shipping + Value: + Fn::Sub: https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/cuenca-shipping/address + BotmakerMessageApi: + Description: Api Botmaker Message + Value: + Fn::Sub: https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/botmaker/message