-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
45 lines (34 loc) · 1.75 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
### Spark Bot for AWS Lambda ###
This is a template to create a Spark Bot using AWS Lambda as the external service.
The high level process is:
1) Create a new Spark Bot at https://developer.ciscospark.com/apps.html
!!Ensure you save the Access Token!!
2) Create the AWS API Gateway & Lambda Function
3) Register the Webhook
4) Test the bot by sending a direct message from Spark to your bot.
AWS API GATEWAY
Ensure to turn off all authentication
LAMBDA FUNCTION
AWS Lambda requires that all libraries are in a .zip file AT THE ROOT level.
See http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
pip install ciscosparkapi -t ./project-dir
cp lambda_function.py ./project-dir
cd project-dir;zip -r ../mylambdafunction.zip ./ -x \*.pyc ; cd ..
Zip up the contents of the project-dir upload to lambda ensure that lambda_function.py is in the root dir.
Ensure to create an Environment variable called SPARK_ACCESS_TOKEN with with token from https://developer.ciscospark.com/apps.html
Ensure that Handler in the lambda configuration is set to lambda_function.lambda_handler
REGISTER THE WEBHOOK
Import Cisco Spark.postman_collection.json into Postman.
-Replace $$BOT_AUTH_TOKEN$$ with token from https://developer.ciscospark.com/apps.html
-Replace $$AWS_API_GATEWAY_TRIGGER$$ with API Gateway Trigger url
-Replace $$BOT_ID$$ with self id from https://api.ciscospark.com/v1/people/me
TESTING
Lambda Test Template
{
"actorId": "Y2lzY29zcGFyazovL3VzL1BFT1BMRS9lNWFjYTVmMy00MzBiLTQxNjEtYWMxYS04ZWVhYjYxMDc2NTY",
"data": {
"roomId": "Y2lzY29zcGFyazovL3VzL1JPT00vMWY0Nzk1MjItYjViNS0zMTA2LWFhNWEtZjY1ZTZkMGRiNjg2",
"id": "Y2lzY29zcGFyazovL3VzL01FU1NBR0UvNjc1NTZhZjAtZjQyNC0xMWU2LWI4Y2MtNWJhMmYxNGFhNjVi"
},
"event": "created"
}