API Definition

Alerts of Story Searches

Alerts are email messages that contain saved search results. To setup and activate an alert requires the following steps:

  1. Create the alert using alert/create.
  2. Set the "when", "what", and "who" for the alert:
    • Use alert/addschedule to define when the alert is to occur.
    • Use alert/addsearch to define the content of the alert by associating one or more saved searches with it.
    • Use alert/destination to define email addresses that will receive the alert.
  3. Activate the alert with alert/activate to start sending alerts based on the alert schedules.
Creating a News Alert
Creating Periodic Alerts of Stories

Creating a News Alert
This example shows the basic steps to create an alert that will be sent on specific days of the week at a specific time of day.
  1. Create an alert.
    Create and name an alert with alert/create using the required parameters session and name. This example also includes the subject parameter to set the alert's email subject.

    Request
    https://secure.newsedge.com/opensapi/20/alert/create?session=935DA0B364E9E130F0EC3827FC3CCC9C&name=Drug%20Trials&subject=Drug%20Trials%20Alert

    Response
    <opens-api>
        <message>Alert 34729 created</message>
    </opens-api>
    
  2. Get a list of alerts and alert IDs.
    To identify an alert in other API requests, use the id attribute of the alert element from alert/list.

    Request
    https://secure.newsedge.com/opensapi/20/alert/list?session=935DA0B364E9E130F0EC3827FC3CCC9C

    Response
    <opens-api>
      <alerts>
        <alert id="34729" name="Drug Trials" status="Inactive"/>
      </alerts>
    </opens-api>
    
  3. Get an alert's information.

    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.


    Request
    https://secure.newsedge.com/opensapi/20/alert/info?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <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>
    
  4. Define a schedule for an alert.

    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:

    • type=settime sets a specific time of day for the alert to occur. This example uses type=settime.
    • type=period sets a period of time between recurrences of the alert throughout the day.

    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.


    Request
    https://secure.newsedge.com/opensapi/20/alert/addschedule?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&days=Monday,Wednesday,Friday&type=settime&setTime=171500

    Response
    <opens-api>
       <message>Schedule 3411 added to alert 34729 for user 32594</message>
    </opens-api>
    
  5. Get a saved search ID for the alert.
    An alert's content is generated from one or more saved searches. You associate a saved search using alert/addsearch, which is shown in the following step. First, this step uses savedsearch/list to get the ID of the saved search we want the alert to use. A saved search ID is the ss attribute of the savedsearch element from savedsearch/list. In this example we'll use the saved search identified as 13818.

    Request
    https://secure.newsedge.com/opensapi/20/savedsearch/list?session=935DA0B364E9E130F0EC3827FC3CCC9C

    Response
    <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>
    
  6. Define the content of an alert from a saved search.

    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.


    Request
    https://secure.newsedge.com/opensapi/20/alert/addsearch?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&savedSearch=13818

    Response
    <opens-api>
      <message>Search 13818 added to alert 34729 for user 32594</message>
    </opens-api>
    
  7. Define an email destination to receive an alert.

    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.


    Request
    https://secure.newsedge.com/opensapi/20/alert/adddestination?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert34729&emailAddress=name@example.com&emailFormat=HTML

    Response
    <opens-api>
      <message>Destination name@example.com, format HTML added to alert 34729 for user 32594</message>
    </opens-api>
    
  8. Activate an alert.
    Alerts are not sent until the alert is activated using alert/activate with the session and alert parameters.

    Request
    https://secure.newsedge.com/opensapi/20/alert/activate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <opens-api>
        <message>Alert 34729 for user 32594 activated</message>
    </opens-api>
    
  9. Review an alert's information.

    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.


    Request
    https://secure.newsedge.com/opensapi/20/alert/info?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <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>
    
  10. Update an alert.

    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 ElementThe alert/update Parameter to Use
    alert name attribute Use the parameter name to change the alert's name.
    alertSubject elementUse the parameter subject to set or change the email subject line.
    alertComment elementUse the parameter comment to add a text comment to the top of the email.
    emailContents value attributeUse 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 attributeUse the parameter tocLocation=top to add a table of contents to the top of the email.
    maxResults value attributeUse the parameter maxResultsPerSearch to set the maximum number of results for each search included in the alert.
    maxStories value attributeUse the parameter maxStoriesPerEmailto set the maximum number of stories to include in an alert email message.
    maxTotalStories value attributeUse the parameter maxStoriesPerAlert to set the maximum total number of saved search results to be emailed for the alert.
    enableHighlighting elementUse the parameter highlighting=TRUE to highlight search terms in the email results.

    Request
    https://secure.newsedge.com/opensapi/20/alert/update?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729&highlighting=TRUE

    Response
    <opens-api>
      <message>Alert 34729 updated</message>
    </opens-api>
  11. Deactivating and deleting an alert.
    If you no longer need an alert, use alert/deactivate and alert/delete, each with the session and alert parameters.

    Request
    https://secure.newsedge.com/opensapi/20/alert/deactivate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <opens-api>
      <message>Alert 34729 for user 32594 deactivated</message>
    </opens-api>

Creating Periodic Alerts of Stories
This example shows how to add an additional schedule to an alert so that the the alert occurs on a regular schedule, such as every 15 minutes.
  1. Get an alert's ID.

    Request
    https://secure.newsedge.com/opensapi/20/alert/list?session=935DA0B364E9E130F0EC3827FC3CCC9C

    Response
    <opens-api>
      <alerts>
        <alert id="34729" name="Drug Trials" status="Inactive"/>
      </alerts>
    </opens-api>
    
  2. Add a periodic schedule to an alert.

    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:

    • type=period
    • startTime=hhmmss. This example uses the value 090000, which represents 9AM.
    • endTime=hhmmss. This example uses the value 153000, which represents 3:30 PM.
    • periodInSeconds=seconds. This example uses 900, which represents a period of every 15 minutes. (900 seconds is the lowest value allowed.)

    Request
    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

    Response
    <opens-api>
      <message>Schedule 3413 added to alert 34729 for user 32594</message>
    </opens-api>
    
  3. Get an alert's information.

    Request
    https://secure.newsedge.com/opensapi/20/alert/info?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <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>
    
  4. Activate an alert.
    Remember to activate the alert if it is not already activated using alert/activate with the session and alert parameters.

    Request
    https://secure.newsedge.com/opensapi/20/alert/activate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <opens-api>
      <message>Alert 34729 for user 32594 activated</message>
    </opens-api>
    
  5. Deactivating and deleting an alert.
    If an alert is no longer needed, use alert/deactivate and alert/delete, each with the session and alert parameters.

    Request
    https://secure.newsedge.com/opensapi/20/alert/deactivate?session=935DA0B364E9E130F0EC3827FC3CCC9C&alert=34729

    Response
    <opens-api>
      <message>Alert 34729 for user 32594 deactivated</message>
    </opens-api>