Alerts are email messages that contain saved search results. To setup and activate an alert requires the following steps:
https://secure.newsedge.com/opensapi/20/alert/create?session=935DA0B364E9E130F0EC3827FC3CCC9C&name=Drug%20Trials&subject=Drug%20Trials%20Alert
<opens-api> <message>Alert 34729 created</message> </opens-api>
https://secure.newsedge.com/opensapi/20/alert/list?session=935DA0B364E9E130F0EC3827FC3CCC9C
<opens-api> <alerts> <alert id="34729" name="Drug Trials" status="Inactive"/> </alerts> </opens-api>
To get details about an alert, use alert/info with the required parameters session and alert. In the returned results, notice the first three sub-elements of the alert element, which need to be filled in using the following API requests:
Use alert/update to add or update the other alert information.
https://secure.newsedge.com/opensapi/20/alert/info?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api> <alerts> <alert id="34729" name="Drug Trials" status="Inactive"> <alertSchedule></alertSchedule> <alertSearches></alertSearches> <additionalDestinations></additionalDestinations> <alertSubject>Drug Trials Alert</alertSubject> <alertComment/> <emailContents value="briefs"/> <tocLocation value="top"/> <lastExecTime value="19700101T000000+0000"/> <maxResults value="50"/> <maxStories value="50"/> <maxTotalStories value="500"/> <enableHighlighting/> </alert> </alerts> </opens-api>
You schedule alerts for specific days of the week with specific times for those days using alert/addschedule. The request requires the parameters session, alert, and days, with additional parameters to set the times. You can set two types of time schedules:
This example sets a schedule for Monday, Wednesday, and Friday at the set time of 5:15PM.
You can add multiple schedules as needed. To delete a schedule use alert/deleteschedule.
https://secure.newsedge.com/opensapi/20/alert/addschedule?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&days=Monday,Wednesday,Friday&type=settime&setTime=171500
<opens-api> <message>Schedule 3411 added to alert 34729 for user 32594</message> </opens-api>
https://secure.newsedge.com/opensapi/20/savedsearch/list?session=935DA0B364E9E130F0EC3827FC3CCC9C
<opens-api> <status>OK</status> <savedsearches> <savedsearch ss="6762" owner="NewsEdge.com" level="SYSTEM" name="NewsEdge" permission="OPAQUE"/> <savedsearch ss="13818" owner="API User" level="PERSONAL" name="Pharmaceutical Development" permission="WRITE"/> <savedsearch ss="6761" owner="NewsEdge.com" level="SYSTEM" name="Pharmaceuticals Industry" permission="OPAQUE"/> . . . </savedsearches> </opens-api>
To add the saved search obtained from the previous step, use alert/addsearch with the required session, alert, and savedSearch parameters.
You can add multiple searches to an alert if desired. To delete a search from an alert use alert/deletesearch.
https://secure.newsedge.com/opensapi/20/alert/addsearch?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&savedSearch=13818
<opens-api> <message>Search 13818 added to alert 34729 for user 32594</message> </opens-api>
Use alert/adddestination to add an email address destination for the alert. The required parameters include the session identifier, the alert identifier, an emailAddress, and an emailFormat, which can have the value HTML, smartphone, text, mobile, or Webalert.
You can add more email destinations to the alert as needed. To delete an email from an alert use alert/deletesearch.
https://secure.newsedge.com/opensapi/20/alert/adddestination?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert34729&emailAddress=name@example.com&emailFormat=HTML
<opens-api> <message>Destination name@example.com, format HTML added to alert 34729 for user 32594</message> </opens-api>
https://secure.newsedge.com/opensapi/20/alert/activate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api> <message>Alert 34729 for user 32594 activated</message> </opens-api>
Use alert/info with the session and alert parameters to get all the details about the alert.
See the next step for how to add or modify the other alert values.
https://secure.newsedge.com/opensapi/20/alert/info?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api> <alerts> <alert id="34729" name="Drug Trials" status="Active"> <alertSchedule> <dayOfWeek scheduleId="3411" number="3,5"> <setTime>T171500-0400</setTime> </dayOfWeek> </alertSchedule> <alertSearches> <alertSearch id="13818" name="Pharmaceutical Development"/> </alertSearches> <additionalDestinations> <destination type="email" format="HTML">name@example.com</destination> </additionalDestinations> <alertSubject>Drug Trials Alert</alertSubject> <alertComment/> <emailContents value="briefs"/> <tocLocation value="top"/> <lastExecTime value="19700101T000000+0000"/> <maxResults value="50"/> <maxStories value="50"/> <maxTotalStories value="500"/> <enableHighlighting/> </alert> </alerts> </opens-api>
Modify an alert's settings using alert/update with the required parameters session and alert, plus any of the parameters in the following table. The left column contains an attribute or element shown in the results of the previous step. The right column indicates the alert/update parameter to use to change the value:
Attribute or Element | The alert/update Parameter to Use |
---|---|
alert name attribute | Use the parameter name to change the alert's name. |
alertSubject element | Use the parameter subject to set or change the email subject line. |
alertComment element | Use the parameter comment to add a text comment to the top of the email. |
emailContents value attribute | Use the parameter contents=briefs to include headlines and a brief description of the story in the email or use contents=headlines to show only headlines. |
tocLocation value attribute | Use the parameter tocLocation=top to add a table of contents to the top of the email. |
maxResults value attribute | Use the parameter maxResultsPerSearch to set the maximum number of results for each search included in the alert. |
maxStories value attribute | Use the parameter maxStoriesPerEmailto set the maximum number of stories to include in an alert email message. |
maxTotalStories value attribute | Use the parameter maxStoriesPerAlert to set the maximum total number of saved search results to be emailed for the alert. |
enableHighlighting element | Use the parameter highlighting=TRUE to highlight search terms in the email results. |
https://secure.newsedge.com/opensapi/20/alert/update?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&highlighting=TRUE
<opens-api> <message>Alert 34729 updated</message> </opens-api>
https://secure.newsedge.com/opensapi/20/alert/deactivate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api> <message>Alert 34729 for user 32594 deactivated</message> </opens-api>
https://secure.newsedge.com/opensapi/20/alert/list?session=935DA0B364E9E130F0EC3827FC3CCC9C
<opens-api> <alerts> <alert id="34729" name="Drug Trials" status="Inactive"/> </alerts> </opens-api>
To schedule an alert to be sent periodically throughout the day, use the alert/addschedule request with the required parameters session, alert, days, and the following additional parameters to set the periodic times:
https://secure.newsedge.com/opensapi/20/alert/addschedule?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&days=1,2,3,4,5&type=period&startTime=090000&endTime=153000&periodInSeconds=900
<opens-api> <message>Schedule 3413 added to alert 34729 for user 32594</message> </opens-api>
https://secure.newsedge.com/opensapi/20/alert/info?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api>
<alerts>
<alert id="34729" name="Drug Trials" status="Active">
<alertSchedule>
<dayOfWeek scheduleId="3411" number="3,5">
<setTime>T171500-0400</setTime>
</dayOfWeek>
<dayOfWeek scheduleId="3413" number="1,2,3,4,5">
<startTime>T090000-0400</startTime>
<endTime>T153000-0400</endTime>
<period>PT15M</period>
</dayOfWeek>
</alertSchedule>
<alertSearches>
<alertSearch id="13818" name="Pharmaceutical Development"/>
</alertSearches>
<additionalDestinations>
<destination type="email" format="HTML">name@example.com</destination>
</additionalDestinations>
<alertSubject>Drug Trials Alert</alertSubject>
<alertComment/>
<emailContents value="briefs"/>
<tocLocation value="top"/>
<lastExecTime value="19700101T000000+0000"/>
<maxResults value="50"/>
<maxStories value="50"/>
<maxTotalStories value="500"/>
<enableHighlighting/>
</alert>
</alerts>
</opens-api>
https://secure.newsedge.com/opensapi/20/alert/activate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api> <message>Alert 34729 for user 32594 activated</message> </opens-api>
https://secure.newsedge.com/opensapi/20/alert/deactivate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729
<opens-api> <message>Alert 34729 for user 32594 deactivated</message> </opens-api>