Package: notifly
NotiflyCode UsageTable of ContentsAbout the packageBuilt WithPrerequisites for installInstall the packageWorking of the toolTelegramDiscordSlackContributingAbout the packageSimple Bots to push notifications during an event trigger.wrapper to send messages, images, files over the bot using API.wrapper to send message, images, files to the channel using Webhooks.wrapper to send message, images, files to the channel using API.Built WithPython 3PrerequisitesPythonIt is preinstalled in Ubuntu 20.04. To check the version use command :python3 --versionIf it is not preinstalled for some reason, proceedhereand download as per requirement.Run the following command in terminal to download the required packags for running the tool locally :Using requirements file :pip3 install -r requirements.txtDirectly download packages:pip3 install requests==2.24.0
pip3 install matplotlib==3.2.2
pip3 install slackclient==2.9.3Install the packageRun the following terminal commands to install the package on the given distros.Termux :pkg install python3pip3 install notiflyUbuntu/Debiansudo apt install python3-pippip3 install notiflyArchsudo pacman -S python3-pippip3 install notiflyThis may take a while depending on the network speed.Working of the toolTelegramTo see how the tool works,Create thetelegram bot.Getting the bot API tokenSearch and go to_@Botfather_.Message/mybots.Select the bot.Select theAPI tokendisplayed in message.Copy and use in sample code.fromnotiflyimporttelegram#import the packagex=telegram.Notifier('bot API token')#create object of class Notifierx.send_message('message')#send messagex.send_image("image address")#send image(.jpg or .png format)x.send_file("file address")#send documentx.session_dump()#creates folder named 'downloads' in local folder, downloads/saves message,chat details for current session in 'sessio_dump.json' fileRun sample code.DiscordTo see how the tool works,Create server.Create and copy serverwebhookand use in sample code.fromnotiflyimportdiscordx=discord.Notifier(r'webhook')#create object of class Notifierx.send_message('message')#send messagex.send_file("file address")#send filex.send_file("image address")#send imageRun sample code.SlackTo see how the tool works,Create app. Follow these steps,Gohere.Go toCreate an App.EnterApp Nameand select workspace. ClickCreate App.UnderAdd features and functionalityselectIncoming WebhooksandActivate Incoming Webhooks.Scroll down, selectAdd New Webhook to Workspaceand select a channel from the drop down.This channel name is used as an argument in the sample code. ClickAllow.SelectOAuth & Permissionsfrom left-sidebar.UnderScopes>Bot Token ScopesclickAdd an OAuth Scopeand add the following scopes,chat:writechat:write.publicfiles:writeusers:writeScroll up, underOAuth Tokens for Your Teamcopy theBot User OAuth Access Tokento use in sample code.ClickReinstall to Workspace, select channel and clickAllow.Write sample code.fromnotiflyimportslackx=slack.Notifier('token',channel='channel-name')#create object of class Notiflierx.send_message('message')#send messagex.send_file("image or file address")#send image/fileRun sample code.Tensorflow IntegrationPlug and play feature for your tensorflow callbacks# create your notifier using above methodsfromnotiflyimportdiscordnotifier=discord.Notifier(r'webhook')classMyNotifierCallback:@notifier.notify_on_epoch_begin(epoch_interval=1,graph_interval=1,hardware_stats_interval=1)defon_epoch_begin(self,epoch,logs=None):pass@notifier.notify_on_epoch_end(epoch_interval=1,graph_interval=1,hardware_stats_interval=1)defon_epoch_end(self,epoch,logs=None):pass@notifier.notify_on_train_begin()defon_train_begin(self,logs=None):pass@notifier.notify_on_train_end()defon_train_end(self,logs=None):passmodel.fit(callbacks=[MyNotifierCallback()])Learn more about Notifly ✨Read thewiki pageswhich has all the above steps in great detail with some examples as well 🤩🎉.ContributingFork the ProjectCreate your Feature Branchgit checkout -b feature/mybranchCommit your Changesgit commit -m 'Add something'Push to the Branchgit push origin feature/mybranchOpen a Pull RequestFollow the given commands or use the amazingGitHub GUIHappy Contributing