Created
June 5, 2012 18:40
-
-
Save swarbhanu/2876811 to your computer and use it in GitHub Desktop.
Script to get the user notification service send an sms to a phone as notification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------------------------------------------------------------------- | |
# Create sms notification | |
#--------------------------------------------------------------------------------- | |
from interface.objects import UserInfo | |
from pyon.event.event import EventPublisher | |
from ion.services.dm.presentation.user_notification_service import * | |
rr = pn.resource_registry | |
user = UserInfo(name = 'user') | |
user_id, _ = rr.create(user) | |
uns = pn.user_notification | |
notification_id = uns.create_sms(event_type='ResourceLifecycleEvent', | |
event_subtype=None, | |
origin='Some_Resource_Agent_ID1', | |
origin_type=None, | |
user_id=user_id, | |
phone='4013435434', | |
provider = 'Cingular', | |
message_header='A message_header', | |
parser='parser') | |
#------------------------------------------------------- | |
# publish an event for each notification to generate the emails | |
#------------------------------------------------------- | |
rle_publisher = EventPublisher("ResourceLifecycleEvent") | |
rle_publisher.publish_event(origin='Some_Resource_Agent_ID1', description="RLE test event for email") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment