A utility to fetch email messages from Gmail and send it to Telegram via a bot.
- Mono 4
- Gmail API Key with scopes
GmailReadonly
andGmailModify
- Telegram Bot API Key
A configuration file should be in JSON
format. The format should adhere to the Config
class in the source code.
{
"TelegramApiToken": "token from @BotFather",
"TelegramChatGroupIds": [-11111111111111],
"StoredGoogleCredentialsPath": "./config/somewhere",
"GoogleCredentials": {}
}
The GoogleCredentials
object in the JSON file should be copied from the OAuth credentials provided by Google when
you create the credentials to access the Gmail API.
Build the application using mono:
nuget restore
xbuild /property:Configuration=Release /property:OutDir=build/
build/InternetSeparationAdapter.exe path/to/config.json
There is also a Docker image to run the application, but you need to have gotten the OAuth credentials for the user
you are trying to connect to before hand. You can configure StoredGoogleCredentialsPath
above to point it to
somewhere where you can then dump the credentials. See
the issue.
Since the Docker image mounts /usr/src/app/build/config
as a volume, you can put it inside your config
directory.
An example docker-compose.yml
file might look like:
version: "2"
services:
xxx:
build: .
restart: always
volumes:
- ./config:
command: ["config/xxx.json"]
Tests are missing! We need to write them =X