Package: nftl-slack-tools
Library: nftl-slack-toolsThis is a tool for Slack API handling.Source documentation of api is availableherePyPI project pageInstallationpipinstallnftl-slack-toolsUsagefromnftl_slack_tools.clientimportSlackClientslack=SlackClient(slack_token='xoxp-...')channel=slack.get_channels_api().create('new_order')ifchannel:print('Yupi!')InterfaceChannelsSlack API wrapper that is handling channels categoryAPI referenceUsagefromnftl_slack_tools.clientimportSlackClientslack=SlackClient(slack_token='xoxp-...')channels_api=slack.get_channels_api()Available methodslist()Lists all channels in a Slack team.
Channels depends on token so if you want to list users use user token
instead of SlackApi admin tokenSlack API :channels.listArgs:
    limit: optional page length ( default: 1000 )
    cursor: optional message list cursor for pagination
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or channels :py:class:`typing.Dict`
    with two keys: channels (list of channels) and cursor for pagination
    when successcreate()Create new channel with desired nameSlack API :channels.createArgs:
    channel: channel name, can only contain lowercase letters, numbers,
        hyphens, and underscores, and must be 21 characters or less
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or channel info as :py:class:`typing.Dict`
    when successonboard()Invite users to all the channels available in token scope except generalSlack API : Not availableArgs:
    users_ids: :py:class:`typing.List` of slack user ids
    cursor: pagination cursor for retry etc.
    invite_token: optional auth token that will overwrite SlackApi token
        used for channel invitation
Returns:
    boolean success statusinvite()Invite user to the channelSlack API :channels.inviteArgs:
    channel: Slack channel id like CXJSD234G
    user: Slack user id like UXS65F48
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or channel info as :py:class:`typing.Dict`
    when successinfo()Get channel info by channel idSlack API :channels.infoArgs:
    channel_id: Slack channel id
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if channel_id not found or channel info
    as :py:class:`typing.Dict` when successchannel_info()Find channel info by channel nameSlack API : Not availableArgs:
    channel_name: Slack channel name
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if channel_name is not found or channel info
    as :py:class:`typing.Dict` when successhistory()Fetches history of messages and events from a channel.Slack API :channels.historyArgs:
    channel: Slack channel id like CXJSF234X
    count: number of messages per page
    latest: End of time range
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if error occurred or number of removed messagesclear_history()Channel history cleaner
Reads history and removes messages one by oneSlack API : Not availableArgs:
    channel_name: Slack channel name
    chat: Chat api handler
Returns:
    Number of removed messagesGroupsSlack API wrapper that is handling groups categoryAPI referenceUsagefromnftl_slack_tools.clientimportSlackClientslack=SlackClient(slack_token='xoxp-...')channels_api=slack.get_groups_api()Available methodslist()Lists all groups aka private channel in a Slack team.
Groups depends on token so if you want to list users use user token
instead of SlackApi admin tokenSlack API :groups.listArgs:
    limit: optional page length ( default: 1000 )
    cursor: optional message list cursor for pagination
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or channels :py:class:`typing.Dict`
    with two keys: groups (list of groups) and cursor for pagination
    when successcreate()Create new group with desired nameSlack API :groups.createArgs:
    group: group name, can only contain lowercase letters, numbers,
        hyphens, and underscores, and must be 21 characters or less
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or group info as :py:class:`typing.Dict`
    when successonboard()Invite users to all the groups available in token scope except generalSlack API : Not availableArgs:
    users_ids: :py:class:`typing.List` of slack user ids
    cursor: pagination cursor for retry etc.
    invite_token: optional auth token that will overwrite SlackApi token
        used for group invitation
Returns:
    boolean success statusinvite()Invite user to the groupSlack API :groups.inviteArgs:
    group: Slack group id like GXJSD234G
    user: Slack user id like UXS65F48
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or group info as :py:class:`typing.Dict`
    when successinfo()Get group info by group idSlack API :groups.infoArgs:
    group_id: Slack group id
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if group_id not found or group info
    as :py:class:`typing.Dict` when successgroup_info()Find group info by group nameSlack API : Not availableArgs:
    group_name: Slack channel name
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if group_name is not found or channel info
    as :py:class:`typing.Dict` when successhistory()Fetches history of messages and events from a group.Slack API :groups.historyArgs:
    group: Slack group id like GXJSD234G
    count: number of messages per page
    latest: End of time range
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if error occurred or number of removed messagesclear_history()Group history cleaner
Reads history and removes messages one by oneSlack API : Not availableArgs:
    group_name: Slack group name
    chat: chat api handler
Returns:
    Number of removed messagesUsersSlack API wrapper that is handling users categoryAPI referenceUsagefromnftl_slack_tools.clientimportSlackClientslack=SlackClient(slack_token='xoxp-...')users_api=slack.get_users_api()Available methodsinfo()Gets information about the userSlack API :users.infoArgs:
    user: Slack user id like UXS65F48
    locale: should response contain locale info
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or user info as :py:class:`typing.Dict`
    when successvalidate_name()Validate users name fieldSlack API : This method is not documentedArgs:
    name: name to be validated
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or boolean validity resultinvite()Invite user to the workspaceSlack API : This method is not documentedArgs:
    email: account email,
    firstname: account first name
    lastname: account last name
    channels: comma separated list of channels (id's) to be invited,
    restricted: restrict to guest that can use multiple channels
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or boolean validity resultChatSlack API wrapper that is handling chat categoryAPI referenceUsagefromnftl_slack_tools.clientimportSlackClientslack=SlackClient(slack_token='xoxp-...')chat_api=slack.get_chat_api()Available methodsdelete()Deletes a messageSlack API :chat.deleteArgs:
    channel: Slack channel id like CXJSD234G
    ts: Message id
    token: optional auth token that will overwrite SlackApi token
Returns:
    boolean operation statusSignupSlack API wrapper that is handling signup categoryThis category is not documented in Slack docUsagefromnftl_slack_tools.clientimportSlackClientslack=SlackClient(slack_token='xoxp-...')chat_api=slack.get_signup_api()Available methodscreate_user()Create a user with invitation codeThis method is not documented in Slack docArgs:
    code: invitation code
    username: user name that wil be used fo real and display name
    passwd: user password to be set
    locale: locale for user
    tos: TOS key to be accepted
    token: optional auth token that will overwrite SlackApi token
Returns:
    None if data is invalid or user info as :py:class:`typing.Dict`
    when successDeployment how toAvailablehere