https://github.com/ariel17/twitter-echo-bot
Simple POC project using Golang, Docker and AWS to show a lifecycle development.
https://github.com/ariel17/twitter-echo-bot
bot go golang twitter
Last synced: 6 months ago
JSON representation
Simple POC project using Golang, Docker and AWS to show a lifecycle development.
- Host: GitHub
- URL: https://github.com/ariel17/twitter-echo-bot
- Owner: ariel17
- License: bsd-2-clause
- Created: 2021-10-20T21:19:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-30T13:55:25.000Z (almost 3 years ago)
- Last Synced: 2024-05-21T08:13:27.614Z (about 2 years ago)
- Topics: bot, go, golang, twitter
- Language: Go
- Homepage:
- Size: 740 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/ariel17/twitter-echo-bot/actions/workflows/main.yml)
[](https://goreportcard.com/report/github.com/ariel17/twitter-echo-bot)
[](https://circleci.com/gh/ariel17/twitter-echo-bot/tree/master)
[](https://codecov.io/gh/ariel17/twitter-echo-bot)
# Twitter echo bot
This is a very simple application, a proof of concept as working code written in
Golang, that access Twitter API to send an answer in the name of the account
owner for those tweets that matches the query pattern.
## Example
[See it on Twitter.](https://twitter.com/ariel_17_/status/1451647851180740609)

## Docker image
The Docker image is hosted at [Docker Hub](https://hub.docker.com/r/ariel17/twitter-echo-bot)
and it is build and pushed through [GitHub Actions](./actions).

### How to build it
```bash
$ docker build -t twitter-echo-bot .
```
### How to execute it
```bash
$ docker run -p 8080:8080 \
-e CONSUMER_API_KEY="key" \
-e CONSUMER_API_SECRET="secret" \
-e ACCESS_TOKEN="token" \
-e ACCESS_TOKEN_SECRET="token_secret" \
-e SEARCH_QUERY="#ariel17echobot" \
-e GREET_TEXT="Hellou!" \
-e RESPONSE_TEXT="bip bop bip!" \
-e JOB_SECONDS=10 \
twitter-echo-bot
```
Using an `.env` is preferred, also the deployment process uses it to provide
the required settings to the application instead of setting raw environment
variables. **Watch out to not track it!**
```bash
$ docker run --env-file=.env twitter-echo-bot
```
### Using make commands
This project includes a Makefile to avoid writting all those commands by hand
and go directly to the point with the same results:
```bash
$ make build # to test and build the image with :dev tag
$ make run # builds AND executes the application in your terminal
```
## Production deployment
The deployment is made using [Terraform](https://www.terraform.io/) to a AWS
t2.nano instance. The execution plan works as follows:

:warning: This configuration uses SSH to provision the Docker service, to pull
and execute the image; it may not be the most secure option for you.
### Development lifecycle
