Giter Club home page Giter Club logo

evernote-telegram-bot's Introduction

Telegram bot for Evernote

Coverage Status Maintainability

This bot can save to your Evernote everything that you send.

You can use this bot in Telegram: https://t.me/evernoterobot
Or you can use your own telegram bot and your own server, then see Installation

Installation

If you have some reasons do not use my bot deployed on my server, you can use your own installation.

  • Create your bot with the BotFather (see https://core.telegram.org/bots#3-how-do-i-create-a-bot)
  • Create Evernote application and obtain a pair of keys (access key and access secret)
  • Install a Docker to your server (see https://docs.docker.com/install/)
  • Get and set up SSL certificate (see https://letsencrypt.org)
  • Set up nginx/caddy/another proxy server to work with your SSL certificate.
  • Check you have curl on your server (usually it's installed by default)
  • Execute this command: sudo curl https://raw.githubusercontent.com/djudman/evernote-telegram-bot/master/evernotebot-install.sh --output evernotebot-install.sh && sh evernotebot-install.sh
    • sudo is needed because there is copying a file to /etc/init.d directory
    • you will need to enter some data as:
  • Execute /etc/init.d/evernotebot start to start bot

How to build docker image manually

  • Clone source code to your server
    git clone https://github.com/djudman/evernote-telegram-bot.git
    
  • Build image
    docker build -t evernote-telegram-bot .
    
  • Define environment variables (for example, in .bashrc)
  • Create a docker volume to store data docker volume create evernotebot-data
  • Run a container
    docker run \
        -e EVERNOTEBOT_DEBUG="$EVERNOTEBOT_DEBUG" \
        -e EVERNOTEBOT_HOSTNAME="$EVERNOTEBOT_HOSTNAME" \
        -e EVERNOTEBOT_EXPOSE_PORT="$EVERNOTEBOT_EXPOSE_PORT" \
        -e TELEGRAM_API_TOKEN="$TELEGRAM_API_TOKEN" \
        -e TELEGRAM_BOT_NAME="$TELEGRAM_BOT_NAME" \
        -e EVERNOTE_READONLY_KEY="$EVERNOTE_READONLY_KEY" \
        -e EVERNOTE_READONLY_SECRET="$EVERNOTE_READONLY_SECRET" \
        -e EVERNOTE_READWRITE_KEY="$EVERNOTE_READWRITE_KEY" \
        -e EVERNOTE_READWRITE_SECRET="$EVERNOTE_READWRITE_SECRET" \
        -d \
        -p 127.0.0.1:8000:8000 \
        --restart=always \
        --name=evernotebot \
        -it \
        -v ./logs:/app/logs:rw \
        --mount source="evernotebot-data",target="/evernotebot-data" \
        evernote-telegram-bot
    

Environment variables

Variable name Default value Description
EVERNOTEBOT_DIR $HOME/evernotebot Install dir for tha bot. Some files there. For example, logs/ dir and .env file
EVERNOTEBOT_DEBUG 0 Enable debug mode (additional logging, use evernote sandbox)
EVERNOTEBOT_HOSTNAME evernotebot.djud.site DNS name of your host. This name will use in such URLs as oauth callback url and webhook url
EVERNOTEBOT_EXPOSE_PORT 8000 Port that the docker container with bot listen on your machine. The bot inside container uses 127.0.0.1:8000
TELEGRAM_BOT_NAME evernoterobot Name of telegram bot. You used this in BotFather
TELEGRAM_API_TOKEN - Access token for telegram API. You can obtain this by BotFather
EVERNOTE_READONLY_KEY - appKey for your Evernote app (readonly permissions)
EVERNOTE_READONLY_SECRET - secret for your Evernote app (readonly permissions)
EVERNOTE_READWRITE_KEY - appKey for your Evernote app (read/write permissions), required for one_note bot mode
EVERNOTE_READWRITE_SECRET - secret for your Evernote app (read/write permissions), required for one_note bot mode

evernote-telegram-bot's People

Contributors

auroradysis avatar djudman avatar dzarlax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

evernote-telegram-bot's Issues

"One note" mode doesn't work

When switch to "One note", the main note with name Telegram bot notes is being created. But when sending any text, the bot says Text accepted but no text appears inside note. The updated time of note is not changed as well.

Server down ?

Send message to @evernoterobot has no response from several days ago, even /help command .

Save link to forwarded message

Use info from

"forward_from_chat":{"id":-1001000275375,"title":"Evil Martians","username":"evilmartians","type":"channel"},"forward_from_message_id":1040"

To build link to message https://t.me/evilmartians/1040
and add it to evernote (details URL or just to end of text)

Source of notes

Any chances to add the name of the telegram source to the notes created in my Evernote acc? Name of the channel/group/sender? I mean when i forward a message from a channel to the bot. Now it stamps it [Telegram bot] only.

Bot stopped responding

Since a couple of days ago the bot stopped saving messages and responding to any command. Any idea why?

authorization failed

start with signing in...
default
but the bot respond "We are sorry, but you declined authorization ๐Ÿ˜ข" every time.

Bot stopped working

Bot stop saving notes and responding to commands a couple of days ago, any idea why? :(

Dashboard

I think it will be useful to have some dashboard, where bot owner can see some data, for example

  • list of users
    • and ability to send message to every user?
  • some common statistic
    • daily/monthly active users
    • how many messages handled / notes created
    • some tech info, for example how many requests we get and send to different APIs

Tests

The bot have no tests, it must be fixed.
I think py.test is a standard for testing in python world, so we will use it https://docs.pytest.org/en/7.1.x/

Base plan:

  • test commands
  • test main pipeline
    • send text message
    • send file
    • send voice message
    • send location
  • test switch mode
  • test switch notebook

Test updates data can be placed to json files nearby test

Remember about messages without captions

Html code in notes

Now this message will failed:

Hello

because of evernote works with notes in ENML (based on XHTML) format

To support telegram channels with comments

There are telegram channels with a comment function from the peerboard.org โ€“ it appears like a comment button under each post. If you forward such message, the comment button is also forwarded. The bot does not react to such messages, even not with "text accepted", he just doesn't see them. See posts in this channel for example: https://t.me/Shmit16

File too big

Telegram Bot Api. Need to handle error 'File is too big' in getFile() method (For the moment, bots can download files of up to 20MB in size)

Bot is dead

Trying to send any messages to @evernoterobot, no any reply. Same with @dev_evernoterobot

reconneting failes

Good evening Sir,

unfortunately I am not able to connect your bot to Evernote.

I log in correctly, everything is released in Evernote - but then it shows
"internal server error"
Although the bot shows that it works. But - when I try to send a message to the bot - or try to forward a message - it always says
"Error. You have to sign in to Evernote first. Send /start and press the button"

Tried it very often - also reinstalled Evernote - but always the same problem

Do you have a solution?
Unfortunately I have no programming skills ,

Thank you very much, Wolfgang

Translated with www.DeepL.com/Translator (free version)
image

Save photo caption in message body please

I'm using twitter client named Twidere, when share photo from twitter to telegram, it will insert twitter message as photo caption, a result like this:

2016-10-19-092058-495x601

Also, this bot use trimmed message as evernote title, after above photo saved to evernote, its like:

2016-10-19-092705-567x229

I lost photo caption(twitter message and original twitter url).

So, can you make photo caption saved in evernote message body ? Or do not trim evernote body, we know it can be long enough for twitter message.

Thanks for this fantastic bot !

How to get Evernote access keys?

Please share whole process. As I see a request for sandbox access is needed first, then the app should be activated for prod by special form request on official Evernote site. Too complex. Is there another way?

The bot doesn't save text with `&` character

The bot does not save text which include some of the symbols, for example &. E.g. a text figuring "Brain&Behavioral Science" will be accepted, but not saved. You have to delete the &, then the bot save the text.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.