1

I'm currently trying to integrate a Twitter Timeline in a LWC component to be used in Salesforce Community but the feed does not appear when my component is displayed in Community Builder and when the Community is published.

The code from Twitter Publish is the following:

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

It seems pretty straight forward but I can't add a script tag in a LWC template. So what I did is simply add

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

into the Community header (Settings > Advanced > Edit Head Markup) and add platform.twitter.com in CSP Trusted Sites but it doesn't work.

Does someone know what I'm missing?

6
  • Download and add the script into a static resource and use that static resource in LWC Jan 8, 2020 at 7:43
  • I just load the script in renderedCallback() using loadScript()?
    – Jean
    Jan 8, 2020 at 8:21
  • I add the following to renderedCallback() Promise.all([ loadScript(this, twitterPlatform + '/twitterWidgets.js') ]).then(() => { console.log(twitterWidgets) }).catch(error => { console.log(error) }); But I have the following errors aura_proddebug.js:50208 null TypeError: Illegal invocation at t.exports (twitterWidgets.js:1) and Uncaught (in promise) TypeError: Illegal invocation at t.exports (twitterWidgets.js:1) Any ideas?
    – Jean
    Jan 8, 2020 at 9:21
  • Not sure I will have to check it. Jan 8, 2020 at 10:08
  • I am having this exact problem, which also gives these exact errors. I have also downloaded the script and put it in a static resource. @Jean were you able to find a solution?
    – Andrew
    Jan 17, 2020 at 12:30

1 Answer 1

1

I have resolved this by using the following component on AppExchange:

https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000EJc1NUAT&modal=where_to_install_package

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .