{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# pip3 install slacker\n", "from slacker import Slacker" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[slack api 사이트](https://api.slack.com/) -> 'start building' -> Create app -> OAuth & Permissions에 있는 Bot User OAuth Access Token 값을 아래 token에 넣으면 됩니다" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "token = 'xoxo-your-token'\n", "slack = Slacker(token)\n", "slack.chat.post_message(channel='채널명 혹은 채널 id', text='message test', as_user=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Channel 확인 : id값 확인 가능\n", "slack.channels.list().body\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Group 확인 : id값 확인 가능\n", "slack.groups.list().body\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }