You are here: Communications Cloud API v1 > Common Uses > Create Topics from Another Database

Create Topics from Another Database

In addition to automatically generating bulletins from external systems, you can use the API to set up automatic topic creation. For example, if you have a system that tracks the creation of legislative bills, you could elect to create a new topic for each bill added to this system. This allows concerned citizens (subscribers) to follow updates for that particular bill. It often helps to group topics of this nature under a category.

There are a number of approaches you can take, based on what you want to accomplish, but one approach might be:

  1. Set up the system to trigger a new topic when a bill is added.
  2. Create a nightly process to check the status and update the category of topics.
1. Set up the system to trigger a new topic when a record is added.

Configure your system to send a request to the API using the Create a Topic method when a specific type of record, such as a new bill, is added. We recommend assigning the same category to each topic created, such as a category labeled "Bills Under Discussion".

Operation

Send a POST to /api/account/ACCOUNT_CODE/topics.xml

Example Input
<topic>
  <code>####</code>
  <name>ENTER NAME</name>
  <short-name>####</short-name>
  <description nil="true"></description>
  <send-by-email-enabled type="boolean">false</send-by-email-enabled>
  <wireless-enabled type="boolean">false</wireless-enabled>
  <rss-feed-url nil="true"></rss-feed-url>
  <rss-feed-title nil="true"></rss-feed-title>
  <rss-feed-description nil="true"></rss-feed-description>
  <pagewatch-enabled type="boolean">true</pagewatch-enabled>
  <pagewatch-suspended type="boolean">false</pagewatch-suspended>
  <default-pagewatch-results type="integer" nil="true"></default-pagewatch-results>
  <pagewatch-autosend type="boolean">false</pagewatch-autosend>
  <pagewatch-type type="integer">1</pagewatch-type>
  <watch-tagged-content type="boolean">false</watch-tagged-content>
  <pages type="array">
    <page>
      <url>http://####.com</url>
    </page>
  </pages>
  <visibility>Listed</visibility>
</topic>
Elements
Example Output
<?xml version="1.0" encoding="UTF-8"?>
<topic>
  <to-param>TOPIC_CODE</to-param>
  <topic-uri>/api/account/ACCOUNT_CODE/topics/TOPIC_CODE.xml</topic-uri>
</topic>
Troubleshooting
2. Create a nightly process to check the status and update the category of topics.

To maintain your topic organization, it might help to set up a nightly process to check your system for certain changes and then trigger updates to associated topics. In the example of a system that tracks legislative bills, a nightly process could check the status of each bill to see if it has changed to something indicating it was passed or voted down. Any bill flagged as such would trigger the Update a Topic method to change the category for that topic. Topics for bills that have passed might go under a category like, "Active Bills". Topics for bills that were voted down might go under a category like, "Blocked Bills."

Operation

Send a PUT to /api/account/ACCOUNT_CODE/topics/TOPIC_CODE.xml

Example Input
<topic>
  <code>####</code>
  <name>ENTER NAME</name>
  <short-name>ENTER SHORT NAME</short-name>
  <description nil="true"></description>
  <send-by-email-enabled type="boolean">false</send-by-email-enabled>
  <wireless-enabled type="boolean">false</wireless-enabled>
  <rss-feed-url nil="true"></rss-feed-url>
  <rss-feed-title nil="true"></rss-feed-title>
  <rss-feed-description nil="true"></rss-feed-description>
  <pagewatch-enabled type="boolean">true</pagewatch-enabled>
  <pagewatch-suspended type="boolean">false</pagewatch-suspended>
  <default-pagewatch-results type="integer" nil="true"></default-pagewatch-results>
  <pagewatch-autosend type="boolean">false</pagewatch-autosend>
  <pagewatch-type type="integer">1</pagewatch-type>
  <watch-tagged-content type="boolean">false</watch-tagged-content>
  <pages type="array">
    <page>
      <url>http://####.com</url>
    </page>
  </pages>
  <visibility>Listed</visibility>
</topic>
Elements
Example Output
<?xml version="1.0" encoding="UTF-8"?>
<topic>
  <to-param>TOPIC_CODE</to-param>
  <topic-uri>/api/account/ACCOUNT_CODE/topics/TOPIC_CODE.xml</topic-uri>
</topic>
Troubleshooting

 

Was this page helpful? Can't find what you need? Let us know