In terminal set up virtual environment:
source ~/<path_to_venv>/bin/activate
Next install requirements:
cd ~/Projects/slack-lambda
./install-requirements.sh
Need to first set up AWS credentials (see configuring AWS CLI below).
cd ~/Projects/slack-lambda
apex --env test deploy
- In the AWS console, select
API Gateway
. - Click on
Create API
- Select
New Api
and setAPI name
to slack_invite - Click on
Create API
- Click on
Actions
and selectCreate Resource
- Set
Resource Name
toslack_invite
. - Click on
Create Resource
- Select
/invite
- Click on
Actions
and selectCreate Method
- Select
GET
and click on checkmark. - Click on method
GET
. - Under
GET - Setup
- Click on
Lambda Function
- Set
Lambda Region
tous-west-2
. - Set
Lambda Function
toslack-invite
. - Click on
Save
- Click on
Method Request
and enter theURL Query String Parameters
needed. - Click back.
- Click on
Integration Request
. - Expand
Body Mapping Templates
. - Select
When no template matches the request Content-Type header
. - Click
Add a mapping template
. - Enter
application/json
and then selectMethod Request passthrough
from the Generate template dropdown. - Click
Save
. - Click back.
- Click
Integration Response
. - Click the drop-down arrow in the first row.
- Drop down
Body Mapping Template
. - Click
Add mapping template
. - Enter
application/json
and then enter$util.parseJson($input.json('$'))
in the template area. - Click
Save
. - Click on drop down
Body Mapping Template
to compact. - Click
Save
. - Click on the
Actions
button and pickDeploy API
. - Pick
prod
for the stage and clickDeploy
. - Prod Stage Editor pops up. Click on
Save Changes
NOTE: Ruby is required. I used Ruby version 2.2.2 and it worked.
gem install travis --no-rdoc --no-ri
ln -s ~/.rbenv/versions/2.2.2/bin/travis ~/.local/bin/travis
sudo apt install awscli
aws configure
sudo curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sudo sh
Follow on-screen prompts:
python encrypt_token.py