service: coaching-chatbot

provider:
  name: aws
  runtime: nodejs4.3
  region: us-east-1
  iamRoleStatements:
    - Effect: Allow
      Action:
      - dynamodb:Scan
      - dynamodb:Query
      - dynamodb:GetItem
      - dynamodb:PutItem
      - dynamodb:DeleteItem
      Resource: arn:aws:dynamodb:${opt:region, self:provider.region}:*:*

functions:
  facebookMessenger:
    handler: facebook-messenger/handler.handler
    memorySize: 128
    timeout: 15
    events:
      - http:
          path: facebook-bot
          method: get
          integration: lambda
          response:
            headers:
              Content-Type: "'text/html'"
            template: $input.path('$.response')
      - http:
          path: facebook-bot
          method: post
          integration: lambda

resources:
  Resources:
    SessionsTable:
      Type: AWS::DynamoDB::Table
      DeletionPolicy: Delete
      Properties:
        AttributeDefinitions:
          - AttributeName: id
            AttributeType: S
        KeySchema:
          - AttributeName: id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:service}-sessions-${opt:stage, self:provider.stage}

plugins:
  - serverless-webpack

service: coaching-chatbot

provider:
  name: aws
  runtime: nodejs4.3
  region: us-east-1
  iamRoleStatements:
    - Effect: Allow
      Action:
      - dynamodb:Scan
      - dynamodb:Query
      - dynamodb:GetItem
      - dynamodb:PutItem
      - dynamodb:DeleteItem
      Resource: arn:aws:dynamodb:${opt:region, self:provider.region}:*:*

functions:
  facebookMessenger:
    handler: facebook-messenger/handler.handler
    memorySize: 128
    timeout: 15
    events:
      - http:
          path: facebook-bot
          method: get
          integration: lambda
          response:
            headers:
              Content-Type: "'text/html'"
            template: $input.path('$.response')
      - http:
          path: facebook-bot
          method: post
          integration: lambda

resources:
  Resources:
    SessionsTable:
      Type: AWS::DynamoDB::Table
      DeletionPolicy: Delete
      Properties:
        AttributeDefinitions:
          - AttributeName: id
            AttributeType: S
        KeySchema:
          - AttributeName: id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:service}-sessions-${opt:stage, self:provider.stage}
    PairsTable:
      Type: AWS::DynamoDB::Table
      DeletionPolicy: Delete
      Properties:
        AttributeDefinitions:
          - AttributeName: pair
            AttributeType: S
        KeySchema:
          - AttributeName: pair
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:service}-pairs-${opt:stage, self:provider.stage}

plugins:
  - serverless-webpack

Create DynamoDB table for pairs
Create DynamoDB table for pairs
