Comments (4)
Custom vendors are supported (for example, see the community-contributed messagebird vendor: https://github.com/linkedin/iris/blob/master/src/iris/vendors/iris_messagebird.py). You'll need to create a vendor class that defines a supports
attribute, which defines what modes this vendor supports. Then, you need to define a send()
function (e.g. https://github.com/linkedin/iris/blob/master/src/iris/vendors/iris_messagebird.py#L98), which can handle all the logic of calling your API to send the messages.
from iris.
I created a script for handling a custom vendor in /vendors
called iris_otpapp_call.py
. Like this right?
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
import logging
import requests
import time
from iris.constants import OTPAPP_CALL_SUPPORT
logger = logging.getLogger(__name__)
class iris_otpapp_call(object):
supports = frozenset([OTPAPP_CALL_SUPPORT])
def __init__(self, config):
self.config = config
self.modes = {
OTPAPP_CALL_SUPPORT: self.send_message,
}
def send_message(self, message):
logging.info("##### It's here! #####")
return "ok"
I have also inserted the custom support like this:
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
# Headers
XFRAME = ('X-Frame-Options', 'SAMEORIGIN')
XCONTENTTYPEOPTIONS = ('X-Content-Type-Options', 'nosniff')
XXSSPROTECTION = ('X-XSS-Protection', '1; mode=block')
# Avoid using magic strings when referring to the transports vendors support
SMS_SUPPORT = 'sms'
CALL_SUPPORT = 'call'
EMAIL_SUPPORT = 'email'
IM_SUPPORT = 'im'
SLACK_SUPPORT = 'slack'
HIPCHAT_SUPPORT = 'hipchat'
OTPAPP_CALL_SUPPORT = 'otpapp_call'
Also, configuring the iris config file like this:
vendors:
- type: iris_otpapp_call
name: otpapp_call
And, injecting the database with a new priority and mode like this:
mysql> select * from priority;
+----+-------------+---------+
| id | name | mode_id |
+----+-------------+---------+
| 8 | urgent | 26 |
| 17 | high | 8 |
| 26 | medium | 35 |
| 35 | low | 35 |
| 36 | otpapp_call | 37 |
+----+-------------+---------+
5 rows in set (0,00 sec)
mysql> select * from mode;
+----+-------------+
| id | name |
+----+-------------+
| 26 | call |
| 36 | drop |
| 35 | email |
| 37 | otpapp_call |
| 17 | slack |
| 8 | sms |
+----+-------------+
6 rows in set (0,00 sec)
I have also created a plan that calls the priority: otpapp_call, but the send_message()
function still can't be called. What did I miss?
from iris.
You'll need to run the Iris sender for messages to send. make sender
should do that in the dev environment. You don't actually need to define a new priority unless you want to; making it available as a contact mode is sufficient as long as users update their default priority -> mode settings.
from iris.
I've run make sender
, but this block of code here still couldn't be called
def send_message(self, message):
logging.info("##### It's here! #####")
from iris.
Related Issues (20)
- Add global setting to not filter default Incident list by owner
- Getting 404 while try to post an incident HOT 4
- Invalid incident
- IRIS ldap not working HOT 3
- > Hello! How to connect AVAX to METAMASK? HOT 2
- I wish I knew what you guys are talking about
- Error while sending message or call to target HOT 4
- Hello! How to connect AVAX to METAMASK? HOT 2
- no python application found -- error HOT 1
- Unable to publish new (or existing) Plan HOT 2
- Additional Functionality: To introduce a DAO layer to leverage Iris functionality with different Databases.
- Create Plan Fail HOT 2
- Configuration as code HOT 1
- Feature request: Extract fields from AlertManager labels into top level context HOT 1
- Status of Container Images HOT 1
- Error during make on Quickstart setup
- IRIS ldap not working HOT 6
- Applications are not properly loaded when using uwsgi
- Able to trigger call from iris with out API Key is this an expected one HOT 2
- Getting error while running GET_INACTIVE_IDS_SQL sql query HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iris.