Instantly share code, notes, and snippets.

Embed
What would you like to do?
#Initialize your project folder using npm
ubuntu@YourComputer:~/FbJokeBot$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (fbjokebot)
version: (1.0.0)
description: https://cedricleruth.com/how-to-build-a-facebook-chatbot-aws-lambda-and-claudia-js-bot-builder/
entry point: (index.js)
test command:
git repository:
keywords:
author: Cedric Leruth
license: (ISC) MIT
About to write to /home/ubuntu/FbJokeBot/package.json:
{
"name": "fbjokebot",
"version": "1.0.0",
"description": "https://cedricleruth.com/how-to-build-a-facebook-chatbot-aws-lambda-and-claudia-js-bot-builder/",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Cedric Leruth",
"license": "MIT"
}
Is this ok? (yes)
#install claudia bot builder project dependency
ubuntu@YourComputer:~/FbJokeBot$ npm install claudia-bot-builder -S
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN fbjokebot@1.0.0 No repository field.
+ claudia-bot-builder@3.0.0
added 7 packages from 5 contributors in 2.817s
#install claudia tools to deploy and configure AWS lambda function
#Note : using the -D argument will intall claudia only in this project folder
#so it will still work if you share the whole project
#Note ; if you prefer to install the dependency directly
#on your workstation use sudo npm install claudia -g
ubuntu@YourComputer:~/FbJokeBot$ npm install claudia -D
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN fbjokebot@1.0.0 No repository field.
+ claudia@3.4.1
added 125 packages from 170 contributors in 4.307s
#install aws cli
#if you're on windows follow this article : https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html
#if you're on MacOS : https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html
#if you're on linux : https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html
#If you're on linux ubuntu as i am :
#Check if it's not already installed :
ubuntu@YourComputer:~/FbJokeBot$ aws --version
The program 'aws' is currently not installed. You can install it by typing:
sudo apt install awscli
#if it's not, install it :
ubuntu@YourComputer:~/FbJokeBot$ sudo apt install awscli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libqmi-glib1 linux-aws-headers-4.4.0-1049 linux-headers-4.4.0-1049-aws linux-image-4.4.0-1049-aws
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
docutils-common python3-botocore python3-colorama python3-dateutil python3-docutils python3-jmespath
python3-pygments python3-roman python3-rsa python3-s3transfer
Suggested packages:
texlive-latex-recommended texlive-latex-base texlive-lang-french fonts-linuxlibertine | ttf-linux-libertine
docutils-doc ttf-bitstream-vera
The following NEW packages will be installed:
awscli docutils-common python3-botocore python3-colorama python3-dateutil python3-docutils python3-jmespath
python3-pygments python3-roman python3-rsa python3-s3transfer
0 upgraded, 11 newly installed, 0 to remove and 3 not upgraded.
Need to get 2,609 kB of archives.
After this operation, 26.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-dateutil all 2.4.2-1 [39.1 kB]
Get:2 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 python3-roman all 2.0.0-2 [8,140 B]
.......
#and more until it's fully installed
#Once it's installed configure it following : https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
#Do not use your root user but create a new one with Programmatic access :
#To do so go to AWS Management Console > IAM > USERS > Create New User
# > Name : CliUser > Access Type : Programmatic Access
#Set Permission to CliUser Attach existing policy directly
# > Add : AWSLambdaFullAccess | IAMFullAccess | AmazonAPIGatewayAdministrator
# Next > Copy Access key Id and Secret Key id
# run aws configure with this user informations :
ubuntu@YourComputer:~/FbJokeBot$ aws configure
AWS Access Key ID [None]: YOURUSERACCESSKEYID
AWS Secret Access Key [None]: YOURUSERSECRETACCESSKEYID
Default region name [None]: YOURREGION
Default output format [None]: text
#Note : In this tutorial we are gonna use those great library available on npm
#This is not mandatory for claudia bot builder
ubuntu@YourComputer:~/FbJokeBot$ npm i sync-request
ubuntu@YourComputer:~/FbJokeBot$ npm i keyword-extractor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment