A Telegram bot that receives photo attachments from users and store them on Google Cloud.
- node > v6
- yarn
- gcloud sdk
- a Google Cloud app credentials json file
- https://console.cloud.google.com/home/dashboard
- Create project
- Create credential
- download the .json file and copy to the root of photobot project as
keyfile.json
git clone [email protected]:TelaSocial/photobot.git
cd photobot
yarn install
cp config-sample.js config.js
$EDITOR config.js
With gcloud sdk configured to your gcloud app, you will have to create the indexes with:
yarn build:index
yarn run info
yarn start:dev:bot
yarn start:dev:api
yarn build
yarn start
yarn monitor
ls logs
tail -f THE_FILENAME_YOU_WANT
yarn stop
Gets the feed with all public photos in the configured gcloud app + bucket, regardless of their captions.
curl --request GET \
--url http://localhost:7314/photos
Gets the feed of public photos that has a hashtag in it's caption
curl --request GET \
--url http://localhost:7314/photos/tag/latino
Gets the feed of public photos that contains a word in it's caption
curl --request GET \
--url http://localhost:7314/photos/word/telasocial
Gets the feed of public photos that contains a word in it's caption
curl --request GET \
--url http://localhost:7314/photos/album/destaques
Blacklists an individual photo and remove it from the public feeds.
headers: Authentication
body parameter: photoId
example:
curl --request POST \
--url http://localhost:7314/blacklist \
--header 'authentication: 98765498765498765' \
--header 'content-type: application/json' \
--data '{
"photoId": "AgADAQADn6gxG3tmKgHscgQ3VBrHqcWs5y8ABKjihbunkqIUGcQBAAEC"
}
Add a photo to an album
headers: Authentication
body parameter: photoId
example:
curl --request POST \
--url http://localhost:7314/photos/album/showcase \
--header 'authentication: 98765498765498765' \
--header 'content-type: application/json' \
--data '{
"photoId": "AgADAQADoKgxG3tmKgHaenVjPegTTQn25y8ABPtXeuwz8Dgd6zIBAAEC"
}'
- [api] remove photo from album
- [bot] switch to webhooks