Embed timeline from user name stored in db


Hello, I have a unique problem to solve for my NPO. My site provide contents for school courses. Each course has its own pages and the instructor needs to display timeline from the course’s twitter account for each course. The course twitter account is saved in database. What will be my choices to solve this issue?

  1. Embed a twitter widget. To my knowledge, that requires a data-widget-id which can only be retrieved from twitter setting. The instructors simply do not want to do that. I can help but it is a maintenance nightmare.

Is there a way to get data-widget-id simply via user name (screen name) via REST API?

  1. Call REST API to get timeline. This route seems to involve a lot of custom code to render the returned data on web page. I’d like to know if it actually is how people handle the dynamic content. I may need to research a little more.

I’m new to twitter integration - any help would be appreciated!


Configure your first user timeline widget from the NPO account. Your NPO Twitter account should appear in the username field.

Copy-and-paste the generated markup into a new template object to be included by your content management system. Retrieve the username stored for the course to display. Place the username inside a data-screen-name attribute inside the link.

<a class="twitter-timeline"
Tweets by @{username}

If no data-screen-name override is provided the widget will display the latest Tweets from your NPO account. All widgets with the same ID will share options for the widget type such as @replies, photo display, or colors.


Sorry I’m not totally clear…Are your suggesting that the same data-widget-id would work for various user names from database? Is the data-widget-id tied to my twitter account? I tried that already yesterday but let me try again.

Maybe I’m just repeating myself, but the user name would be dynamic and retrieved from a database. Each course has its own twitter account. The problem is that I can’t go to widget setting and get the widget id for each account as it is a maintenance burden, not acceptable for my work.


The data-screen-name parameter overrides the username set when configuring your widget. More info:

The widget ID is associated with a specific Twitter account. If you are creating a widget on behalf of an organization it may make the most sense to create that widget from the organization’s Twitter account, which leaves everything in place if you were no longer with the organization or unable to be reached.