BBC News – Lightning Web Component

Arun Kumar

2022 / Salesforce Project


1. Develop a Lightning Web Component that displays the top ten news articles from BBC News.

2. Create a lighting tab and display this component in this tab.


To bring news articles from the BBC News website to our lightning web component, we have to use the BBC News API. I looked to see if the official BBC API was available, but I couldn’t find any. In my search for an API to meet this requirement, I came across the fantastic API, and this API service was a perfect fit.

There are two ways of making a callout from the lightning web component.

Because NewsAPI does not support javascript callouts for free developer accounts, I used the second option and formed a callout with Apex code.

HTTP Callout architecture

To authenticate the NewsAPI, I used the Salesforce Named Credentials platform feature. NewsAPI API keys can be obtained by registering on their website.

create Named Credentials

Here’s how I made a call to news API from the Apex code.

The Apex code above returns the API response to the LWC javascript controller, and the javascript controller class parses the news article data and displays it on the LWC HTML page. All project code can be found in the Github repository, which is linked below.

GitHub Repository

Join 1,564 other followers

Quick News Lightning Component

News App | It displays the latest news articles from different news sources.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s