How To Integrate Twitter Feeds without Forge Components
Discussion

Hi All, This is a quick example of how to integrate Twitter feeds into your apps without the Twitter Connector Forge Component which is designed for more advanced things like tweeting and signing in using your Twitter credentials.

Twitter has a handy publish site, so you can modify the script slightly to suit your needs:

https://publish.twitter.com/#

Then just copy the HTML and add it to an expression, replace the " with ', wrap the HTML with " and set escape content to No. As per Image below


This is what it looks like:

Hi André,

Thanks, that's very useful info! Perhaps you could post the value of that Expression as text as well? That'll save many people from typos probably :).

Sure @Kilian!

Here is an example of the code for the Twitter Dev account timeline:

"<a class='twitter-timeline' href='https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw'>Tweets by TwitterDev</a> <script async src='https://platform.twitter.com/widgets.js' charset='utf-8'></script>"

But again if you want to make specific edits like limit height and width, colour scheme, see other bits of code to just display latest tweet etc consult this site:
https://publish.twitter.com/# 
You just enter the post or twitter handle and it will give you the HTML to copy and paste, just remember to change the double quotes to single quotes...

Thanks again André!

Hi there,

I can't seem to replicate this. Did Outsystems update expression component, the escape content does not appear anymore on my end.


Hey Ray, for reactive apps you can use the Forge component Inject HTML:


The code then needs to be modified due to the "" '' issue. So use this code:

"<a class='twitter-timeline' href='https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw'>Tweets by TwitterDev</a> <script async src='https://platform.twitter.com/widgets.js' charset='utf-8'></script>"

Hi André,

This does not seem to be a working solution...

It only outputs a direct link to the profile.


Hi Remi. 


in reactive you need to load the Javascript separately: use system client action RequireScript to load the script.


so in summary, you would have an injectHTML block with:

"<a class='twitter-timeline' href='https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw'>Tweets by TwitterDev</a>"


and the RequireScript action with:

"https://platform.twitter.com/widgets.js"

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.