Package: slack-notifications
Slack notificationsInstallationpipinstallslack-notificationsSimple usageimportosimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'slack.send_notify('channel-name',username='Bot',text='@channel This is test message')orimportosfromslack_notificationsimportSlackslack=Slack('<token>')slack.send_notify('channel-name',username='Bot',text='@channel This is test message')Messageimportosfromslack_notificationsimportSlack,Attachmentslack=Slack('<token>')message=slack.send_notify('channel-name',username='Bot',text='@channel This is test message')message.text='This is test message'message.update()message.add_reaction('<name>')message.remove_reaction('<name>')message.upload_file('./test.yml',filetype='yaml')message.attachments.append(Attachment(title='Attachment title',pretext='Attachment pretext',text='Attachment text',footer='Attachment footer',color='green',),)message.update()Use attachmentsimportosimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'attachment=slack.Attachment(title='Attachment title',pretext='Attachment pretext',text='Attachment text',footer='Attachment footer',color='green',)slack.send_notify('channel-name',username='Bot',text='@channel This is test message',attachments=[attachment])See program APIAttachment fieldsimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'attachment=slack.Attachment(title='Attachment title',pretext='Attachment pretext',text='Attachment text',footer='Attachment footer',fields=[slack.Attachment.Field(title='Field title',value='Field value',),],color='green',)slack.send_notify('channel-name',username='Bot',text='@channel This is test message',attachments=[attachment])Simple Text Blockimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'block=slack.SimpleTextBlock('Text example',fields=[slack.SimpleTextBlock.Field('Text field',),slack.SimpleTextBlock.Field('Text field',emoji=True,),],)slack.send_notify('channel-name',username='Bot',text='@channel This is test message',blocks=[block])See program APIInit colorimportslack_notificationsasslackslack.init_color('green','#008000')Call slack resourceimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'response=slack.call_resource(slack.Resource('users.info','GET'),params={'user':'W1234567890'})Resource iteratorimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'foruserinslack.resource_iterator(slack.Resource('users.list','GET'),'members'):passRaise exception if error was givenimportslack_notificationsasslackslack.ACCESS_TOKEN='xxx'slack.send_notify('channel-name',username='Bot',text='@channel This is test message',raise_exc=True)Program APIsend_notifychanneltext: str = Noneusername: str = Noneicon_url: str = Noneicon_emoji: str = Nonelink_names: bool = Trueraise_exc: bool = Falseattachments: List[Attachment] = Noneblocks: List[BaseBlock] = Noneupload_filechannelfiletitle: str = None,content: str = None,filename: str = None,thread_ts: str = None,filetype: str = 'text',raise_exc: bool = Falsecall_resourceresource: Resourceraise_exc: bool = False**kwargs (requests lib options)resource_iteratorresource: Resourcefrom_key: strcursor: str = Noneraise_exc: bool = Falselimit: int = DEFAULT_RECORDS_LIMITinit_colorname: strcode: strAttachmentimage_url: str = None,thumb_url: str = None,author_name: str = None,author_link: str = None,author_icon: str = None,title: str = None,title_link: str = None,text: str = None,pretext: str = None,footer: str = None,footer_icon: str = None,timestamp: str = None,fields: List[Attachment.Field] = None,color: str = NoneAttachment.Fieldtitle: str = Nonevalue: str = Noneshort: bool = FalseSimpleTextBlocktext: strmrkdwn: bool = Trueblock_id: str = Nonefields: List[SimpleTextBlock.Field] = NoneSimpleTextBlock.Fieldtext: stremoji: bool = Falsemrkdwn: bool = TrueDividerBlockblock_id: str = NoneImageBlockimage_url: strtitle: str = Nonealt_text: str = Nonemrkdwn: bool = Trueblock_id: str = NoneContextBlockelements: List[Union[ContextBlock.TextElement, ContextBlock.ImageElement]]block_id: str = NoneContextBlock.TextElementtext: strmrkdwn: bool = TrueContextBlock.ImageElementimage_url: stralt_text: str = None