Categorygithub.com/GoTrellium/integram
modulepackage
0.0.0-20220224191517-dff46b95b716
Repository: https://github.com/gotrellium/integram.git
Documentation: pkg.go.dev

# README

Integram 2.0

Framework and platform to integrate services with Telegram using the official Telegram Bot API

ā„¹ļø Individual integration repos are located at https://github.com/integram-org.

CircleCI Docker Image GoDoc

Screencast

How to use Integram in Telegram (using public bots)

Just use these links to add bots to your Telegram

Did not find your favorite service? 🤘 Vote for it

How to host Integram on your own server (using your private bots)

🐳 Docker way

   git clone https://github.com/GoTrellium/integram && cd integram
  • Check the docker-compose.yml file for the required ENV vars for each service
    • E.g. in order to run the Trello integration you will need to export:

      • INTEGRAM_BASE_URL – the base URL where your Integram host will be accessible, e.g. https://integram.org

      • INTEGRAM_PORT – if set to 443 Integram will use ssl.key/ssl.cert at /go/.conf.

        • For Let's Encrypt: ssl.cert has to be fullchain.pem, not cert.pem

        This directory is mounted on your host machine. Just get the path and put these files inside

           ## Get the path of config directory on the host machine
           docker volume inspect -f '{{ .Mountpoint }}' integram_data-mainapp
        
      • TRELLO_BOT_TOKEN – your bot's token you got from @BotFather

      • You will need to get your own OAuth credentials from Trello

        • TRELLO_OAUTH_ID – API Key
        • TRELLO_OAUTH_SECRET – OAuth Secret
    • For more detailed info about other services you should check the corresponding repo at https://github.com/integram-org

  • Export the variables you identified in the previous step, for instance on linux this should be something like:
   export INTEGRAM_PORT=xxxx
   export ...
  • Now you can run the services (linux: careful if you need to sudo this, the exports you just did will not be available) :
   docker-compose -p integram up trello gitlab ## Here you specify the services you want to run
  • Or in background mode (add -d):
   docker-compose -p integram up -d trello gitlab
  • You should now see Integram's startup logs in your console
  • In Telegram, you can now start your bots (/start) and follow their directions, configure them using /settings
  • Some useful commands:
   ## Check the containers status
   docker ps
   
   ## Fetch logs for main container
   docker logs -f $(docker ps -aqf "name=integram_integram")   
  • To update Integram to the latest version:
    ## Fetch last version of images
    docker-compose pull integram trello gitlab
    ## Restart containers using the new images
    docker-compose -p integram up -d trello gitlab

šŸ›  Old-school way (No docker)

    ## set the GOPATH to the absolute path of directory containing 'src' directory that you have created before
    export GOPATH=/var/integram
    
    cd $GOPATH/src/integram
    ## install dependencies
    dep init
    go build integram && ./integram

Dependencies

Dependencies are specified in Gopkg.toml and fetched using Go dep

Contributing

Feel free to send PRs. If you want to contribute new service integrations, please create an issue first. Just to make sure someone is not already working on it.

Libraries used in Integram

License

Code licensed under GPLV3 license

Analytics

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
GetVersion returns the current HEAD git commit(first 7 symbols) if .git exists.
GetVersion returns the current HEAD git commit if .git exists.
No description provided by the author
No description provided by the author
No description provided by the author
Register the service's config and corresponding botToken.
No description provided by the author
Run initiates Integram to listen webhooks, TG updates and start the workers pool.
No description provided by the author
No description provided by the author
SliceContainsString returns true if []string contains string.
URLMustParse returns url.URL from static string.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
run only the main worker.
run only one the registred services and their workers.
run all-in-one process – main worker and all registred services.
JobRetryFibonacci specify jobs retry politic as delay after fail using fibonacci sequence.
JobRetryLinear specify jobs retry politic as retry after fail.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MaxMsgsToUpdateWithEventID set the maximum number of last messages to update with EditMessagesTextWithEventID.

# Structs

Bot represents parsed auth data & API reference.
No description provided by the author
Button contains the data to create Keyboard.
Chat information initiated from TG.
No description provided by the author
No description provided by the author
Context of the current request.
DefaultOAuth1 is the default OAuth1 config for the service.
DefaultOAuth2 is the default OAuth2 config for the service.
No description provided by the author
No description provided by the author
HTMLRichText produce HTML that can be sent to Telegram.
IncomingMessage specifies data that available for incoming message.
InlineButton contains the data to create InlineKeyboard One of URL, Data, SwitchInlineQuery must be specified If more than one specified the first in order of (URL, Data, SwitchInlineQuery) will be used.
InlineKeyboard contains the data to create the Inline keyboard for Telegram and store it in DB.
Job 's handler that may be used when scheduling.
No description provided by the author
MarkdownRichText produce Markdown that can be sent to Telegram.
Message represent both outgoing and incoming message data.
No description provided by the author
No description provided by the author
OAuthProvider contains OAuth application info.
No description provided by the author
OutgoingMessage specispecifiesfy data of performing or performed outgoing message.
Service configuration.
User information initiated from TG.
WebhookContext is passed to WebhookHandler of service.

# Interfaces

InlineKeyboardMarkup allow to generate TG and DB data from different states - (InlineButtons, []InlineButtons and InlineKeyboard).
KeyboardMarkup allow to generate TG and DB data from different states - (Buttons and Keyboard).
No description provided by the author
Servicer is interface to match service's config from which the service itself can be produced.

# Type aliases

Buttons is a Shorthand for []Button.
No description provided by the author
InlineButtons is a Shorthand for []InlineButton.
Keyboard is a Shorthand for [][]Button.
No description provided by the author
No description provided by the author