Skip to content

Commit 1910383

Browse files
committed
init
0 parents  commit 1910383

File tree

11 files changed

+206
-0
lines changed

11 files changed

+206
-0
lines changed

.gitignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
48+
# Translations
49+
*.mo
50+
*.pot
51+
52+
# Django stuff:
53+
*.log
54+
local_settings.py
55+
56+
# Flask stuff:
57+
instance/
58+
.webassets-cache
59+
60+
# Scrapy stuff:
61+
.scrapy
62+
63+
# Sphinx documentation
64+
docs/_build/
65+
66+
# PyBuilder
67+
target/
68+
69+
# IPython Notebook
70+
.ipynb_checkpoints
71+
72+
# pyenv
73+
.python-version
74+
75+
# celery beat schedule file
76+
celerybeat-schedule
77+
78+
# dotenv
79+
.env
80+
81+
# virtualenv
82+
venv/
83+
ENV/
84+
85+
# Spyder project settings
86+
.spyderproject
87+
88+
# Rope project settings
89+
.ropeproject

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 1.0.0
2+
3+
- Initial release

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-present sms77 e.K.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
![Sms77.io Logo](https://www.sms77.io/wp-content/uploads/2019/07/sms77-Logo-400x79.png "Sms77.io Logo")
2+
3+
# Sms77 Integration Pack
4+
5+
This StackStorm pack allows integration with [sms77](https://www.sms77.io/) service.
6+
7+
## Installation
8+
9+
`st2 pack install https://github.com/sms77io/StackStorm`
10+
11+
## Configuration
12+
13+
Copy [sms77.yaml.dist](sms77.yaml.dist) to `/opt/stackstorm/configs/sms77.yaml` and edit
14+
it as required.
15+
16+
- ``api_key`` - Your API key - get it in
17+
the [developer dashboard][https://app.sms77.io/developer].
18+
19+
Dynamic values from the datastore can be used too -
20+
see [documentation](https://docs.stackstorm.com/reference/pack_configs.html).
21+
22+
**Caution** : Remember to tell StackStorm to reload new values after modifying the
23+
configuration in `/opt/stackstorm/configs/` by running `st2ctl reload --register-configs`
24+
25+
## Actions
26+
27+
- **send_sms** - Action which sends an SMS using sms77 API.
28+
`st2 run sms77.send_sms to=01716992343 text=HI2U from=StackStorm`
29+
30+
### Support
31+
32+
Need help? Feel free to [contact us](https://www.sms77.io/en/company/contact/).
33+
34+
[![MIT](https://img.shields.io/badge/License-MIT-teal.svg)](LICENSE)

actions/send_sms.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from sms77api.Sms77api import Sms77api
2+
3+
from st2common.runners.base_action import Action
4+
5+
6+
class Sms77SendSMSAction(Action):
7+
def __init__(self, config=None, action_service=None):
8+
super(Sms77SendSMSAction, self).__init__(config, action_service)
9+
self.client = Sms77api(self.config['api_key'])
10+
11+
def run(self, to, text, **kwargs):
12+
try:
13+
self.client.sms(to, text, kwargs)
14+
except Exception as e:
15+
error_msg = ('Failed sending sms to: %s, exception: %s\n' % (to, str(e)))
16+
self.logger.error(error_msg)
17+
raise Exception(error_msg)
18+
19+
self.logger.info('Successfully sent sms to: %s\n' % to)

actions/send_sms.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: This sends a SMS using sms77.
3+
enabled: true
4+
entry_point: send_sms.py
5+
name: send_sms
6+
parameters:
7+
from:
8+
description: Caller ID. Max 16 numeric or 11 alphanumeric characters. Example +14151234567.
9+
position: 2
10+
required: false
11+
type: string
12+
text:
13+
description: Body of the message.
14+
position: 1
15+
required: true
16+
type: string
17+
to:
18+
description: Recipient number in E.164 format. Example +14151234567.
19+
position: 0
20+
required: true
21+
type: string
22+
runner_type: python-script

config.schema.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
api_key:
3+
description: "API key"
4+
required: true
5+
secret: true
6+
type: "string"

icon.png

4.21 KB
Loading

pack.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: sms77 e.K.
3+
description: st2 content pack containing sms77 integration
4+
5+
name: sms77
6+
ref: sms77
7+
python_versions:
8+
- "3"
9+
version: 1.0.0

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sms77api

0 commit comments

Comments
 (0)