Simple library for posting to Rocket.Chat via webhooks a.k.a. integrations.
Project description
Simple library for posting to Rocket.Chat via webhooks a.k.a. integrations
Installation
Rockethook can be installed from PyPi: pip install rockethook
Usage
The idea behind this library is to create Webhook object and then post Messages with it. You can create Message object and fulfill it with content (text and/or attachments) later.
Or you can just Webhook.quick_post('Your message')
without bothering with Message objects.
It is a very small library indeed, so the best explanation is an example of usage:
>>> import rockethook >>> my_hook = rockethook.Webhook('https://rocketchat.example.com', my_token) >>> msg = rockethook.Message(icon_url='http://example.com/icon.png') >>> msg.append_text('First line.') >>> msg.append_text('Second line.') >>> msg.add_attachment( ... title='Attach', ... title_link='http://example.com', ... image_url='http://example.com/img.png' ... ) >>> my_hook.post(msg)
To override default webhook’s channel:
>>> msg = rockethook.Message(channel="#my-channel")
To quickly post simple text messages:
>>> my_hook.quick_post('Hi!') >>> my_hook.quick_post('Call me back\nPlease')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rockethook-1.0.4.tar.gz
.
File metadata
- Download URL: rockethook-1.0.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f738ab92dbb9f6b1b7228d9b1ec94e606fa3cd4b16f781216740576b7013749 |
|
MD5 | 58310bbd0b03420cc59d8bc3a6417637 |
|
BLAKE2b-256 | 4014ee344268700ea50810089148c4d5918acf7c51ba86d29a18533005607e63 |
File details
Details for the file rockethook-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: rockethook-1.0.4-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38e4fe61352e880dd49d12bd0a44716d27e0bf8c1f1ddd793736f7dfdc9a4fde |
|
MD5 | 951ec2b15d21d0c64fdd5cc4588390a4 |
|
BLAKE2b-256 | 7430240cfb5540697e2ac37fa7bb4cfbaf066ec687a43873b8f2f38a5ab6d6a1 |