Skip to content

magic7s/sparkbotlambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

### 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"
}

About

Template for creating Cisco Spark bots using AWS lambda

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages