Action¶
Action object¶
-
class
janua.actions.action.Action[source]¶ Action parent class, all action class must inherit from it
-
category= None¶ Category to sort actions
Note
category __INTERNAL__ is for internal use
-
dangerous= False¶ Action is dangerous ? (Janua Client)
-
phone_number= None¶ phone number to determine which sender trigger action (sms context only)
-
email= None¶ email of administrator who trigger action
-
keyword= None¶ sms keyword which trigger action
Note
an action triggered with sms keyword don’t require authentication.
- If filtered attribute set to:
- True: only phone numbers in authorized group are allowed to trigger action
- False: anyone can trigger action
-
keyword_arguments= []¶ sms keyword arguments, typically all words behind keyword are considered as arguments
-
enabled= True¶ Flag to enable or disable action
-
filtered= True¶ For keyword
-
notify= None¶ notify object
-
admin= None¶ Admin database object which managed this action
-
running_context¶ Get running context
-
send_sms(message=None, to=None, filtered=True)[source]¶ Send SMS
Parameters: - message – SMS message
- to – string containing phone number and/or group name separated by commas
- filtered – authorized to send only to managed contacts or send to anyone
Returns: tuple (success, message) where success is a boolean to indicate success or error
-
send_email(subject=None, message=None, to=None, template=None, template_args={}, filtered=True)[source]¶ Send mail
Parameters: - subject – mail subject
- message – mail body
- to – string containing phone number, group name or mail separated by commas
- template – mail template to use
- template_args – mail template arguments
- filtered – authorized to send only to managed contacts or send to anyone
Returns: tuple (success, message) where success is a boolean to indicate success or error
-
Notify object¶
-
class
janua.actions.action.Notify(action)[source]¶ Notify wrapper class
-
sms= None¶ sms notify method object (
NotifyMethod)
-
mail= None¶ mail notify method object (
NotifyMethod)
-
-
class
janua.actions.action.NotifyMethod(pool, action, flags)[source]¶ Notification methods
-
sender(arg)[source]¶ To notify sender which trigger action
Parameters: arg – message for sms, MailObjfor mail
-
manager(arg)[source]¶ To notify administrator which manage this action, available in SMS context only
Parameters: arg – message for sms, MailObjfor mail
-
admin(arg)[source]¶ To notify super administrator
Parameters: arg – message for sms, MailObjfor mail
-