igor

package module
v0.0.0-...-b8cd375 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 7 Imported by: 0

README

Igor

Build Status

This is a Flowdock bot. It uses AWS DynamoDB and AWS Lambda to check if there are new mentions and it responds to them if the date is between some values stored in DynamoDB configuration.

Control panel screenshot

How to

... deploy

Unfortunately we have to work with Cognito which is not supported by CloudFormation, so we have to split the work

  1. Make sure you have:
    • Docker installed;
    • an AWS account;
    • client ID of a Google+ API approved Google Dev Console application;
    • a Flowdock account (optional, unless you really want to use it and not just experiment with it).
  2. rename personal.env.template to personal.env and introduce adequate values, as explained in it
  3. run make prepare to download extra tooling from internet to igor's dir
  4. run cmd/main/cf/non_supported_pre.sh to update the personal.env
    • open your email and approve requested certificate
  5. deploy to AWS with make form (take note: this will take awhile)
  6. run cmd/main/cf/non_supported_post.sh to do finishing steps in configuration and deploy the site

From this point on you can modify HTML and do make deploy-site to replace the cloud.

Other things you want to do are like:

  • update function only with make lambda-update
  • invoke directly via make lambda-invoke
... configure

Open the index.html which should be in the S3 and login using your Google credentials. Configure the application. Profit

How does it work

I've drawn a small UML diagram explaining how it all works in case you want to use or extend it:

UML flow

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MentionContext

type MentionContext struct {
	Message  string
	Moment   time.Time
	Flow     string
	ThreadID string
	User     string
	UserID   int64
}

MentionContext gives context when in which way last mention was made

type UserConfig

type UserConfig struct {
	Identity string
	// contains filtered or unexported fields
}

UserConfig is a core structure that can communicate with Flowdock and is based on the contents stored in DB

func New

func New(identity, messageFormat, flowdockUsername, flowdockToken string, activeFrom, activeUntil time.Time, lastCommunication map[string]time.Time) *UserConfig

New creates a new UserConfig structure

func (*UserConfig) GetNonAnsweredMentions

func (userConfig *UserConfig) GetNonAnsweredMentions() (result map[string]*MentionContext)

GetNonAnsweredMentions returns when was direction mention last received, per user that executed the mention

func (*UserConfig) GetResponseMessage

func (userConfig *UserConfig) GetResponseMessage() (string, error)

GetResponseMessage will return the active reponse message

func (*UserConfig) IsActive

func (userConfig *UserConfig) IsActive() bool

IsActive returns true if the configuration table contains "active" configuration with value "true"

func (*UserConfig) RespondToFlow

func (userConfig *UserConfig) RespondToFlow(flow, thread, siteLocation string) error

RespondToFlow allows to send a message to a certain flow/thread using Flowdock client

func (*UserConfig) RespondToPerson

func (userConfig *UserConfig) RespondToPerson(userID int64, siteLocation string) error

RespondToPerson allows to send a private message to a certain user using Flowdock client

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL