# Services : Slack
#### Token Types
https://api.slack.com/concepts/token-types
```
App xapp-*
Bot xoxb-*
User xoxp-*
Workflow xwfp-*
```
#### Sending a Message
**Example**
```python
API_URL = "https://slack.com/api/chat.postMessage"
TOKEN = "xoxb-not-a-real-token-this-will-not-work"
class SlackException( ValueError ):
def __init__( self, message, args ):
super().__init__( message )
self.args = args
def send_message( text, channel ):
# submit request
args = dict( channel=channel, test=text ) # keep secrets out of args
response = requests.post( API_URL, data=dict( args, token=TOKEN ) )
# validate response
content_type, body = response.headers[ "Content-Type" ], response.text
if content_type.startswith( "application/json" ):
parsed = json.loads( body )
if not parsed[ "ok" ]:
raise SlackException( parsed[ "error" ], args )
return parsed
elif body != "ok":
raise SlackException( body, args )
return body
```