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

classmethod get_name()[source]

Get class name

classmethod get_desc()[source]

Get formatted description from class documentation string

classmethod get_arguments()[source]

Get action arguments

classmethod get_contexts()[source]

Get action contexts

classmethod get_class_info()[source]

Get action class information

classmethod get_id()[source]

Get action id

classmethod get_module()[source]

Get module namespace

running_context

Get running context

call_sms_context(arguments, keyword)[source]

Call child sms method

call_console_context(arguments)[source]

Call child console method

call_web_context(arguments)[source]

Call child web method

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

process_notify()[source]

Process notify message pool

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, MailObj for mail
manager(arg)[source]

To notify administrator which manage this action, available in SMS context only

Parameters:arg – message for sms, MailObj for mail
admin(arg)[source]

To notify super administrator

Parameters:arg – message for sms, MailObj for mail
contacts(arg)[source]

To notify contacts based on group membership of the sender, available in SMS context only

Parameters:arg – message for sms, MailObj for mail
supervisors(arg)[source]

To notify all supervisors

Parameters:arg – message for sms, MailObj for mail

Exceptions

exception janua.actions.ActionError[source]

Action error exception

exception janua.actions.ActionNotifyError[source]

Action notify error exception