Admins / Consultants / Developers / Users

Create a Twitter Feed for Your Salesforce Login Page

By David Claiborne

Salesforce provides you with the ability to create “My Domain” for your organization. By default, when you use the My Domain login page, you get the current promotion from Saleforce (https://c.salesforce.com/login-messages/promos.html), in an iframe on the right hand side.

My Domain allows you to have a custom login page for your organization. In less than 30 minutes, you can set up a Twitter feed on your login page and a reusable component to use throughout your Salesforce org.

Instead of this:

Your users will see this:

Step 1 – Create a Visualforce Page that Shows the Twitter Feed

Since the page contains no code, you can create and edit the Visualforce page right in your production org. There is no need for a sandbox. The steps are:

  1. Go to Setup > Develop > VisualForce Pages.
  2. Select New.
  3. Enter the following code: [gist id=”9ea92b35055908dc1761506081b1cce1″ file=”02_Create a Visualforce Page that Shows the Twitter Feed.js”]

4. Replace <<Handle>> with the correct Twitter handle, without the “@”. Replace <<Default Text>> with something like “Twitter Feed from My Company.”

5. Select Preview to make sure it works.

6. Optional – Check “Available for Lightning Experience, Lightning Communities, and the mobile app.”

7. Select Save.

If you followed step 6, you can use this page as a Lightning component and add it to any Lightning page, for example add your Twitter feed to the Home page as shown below:

Step 2 – Create a Site to Host the Twitter Feed Page

  1. Select Setup > Sites.
  2. If this is your first Site (or Community), you need to register your Sites/Communities domain name. Follow the instructions on the page.
  3. Once your domain is registered, select New. Fill in the first fields with your information.

4. Add your Site Name (this will be the unique URL for the Site) and make the Site active.

5. Select the Visualforce page created earlier as the Active Home Page.

6. Leave the default entries as is.

7. VERY IMPORTANT – Set the Clickjack Projection to “Allow framing by any page (No protection).” Otherwise, the page will not display.

8. Accept the remaining default values.

9. Save the Site.

10. Verify that the page displays properly from the Site by clicking on the Site URL in the list of Sites.

11. Write down the Site URL – you will need it in the next step.

Step 3 – Create a My Domain

You can skip this step if you already have My Domain setup.

If you do not have a My Domain specified for your organization, follow these steps:

1. Select Setup > My Domain.

2. Follow the on-screen instructions to register and then deploy your “My Domain.”

For more guidance watch this Salesforce video.

Step 4 – Authentication Configuration

  1. In the lower half of the My Domain page called “Authentication Configuration”, select Edit.
  2. Enter the Site URL that you wrote down earlier in the Right Frame URL.

3. Select Save.

Summary

That’s it! You have set up a Twitter feed on the login page in less than 30 minutes and created a reusable component that can be used throughout your Salesforce org.

The Author

David Claiborne

David is an independent technology consultant, focusing solely on salesforce.com since 2004. He started the Salesforce Surveys group on Trailblazer in 2018 when Surveys was released.

Comments:

    Jaime de BIDtravel
    January 14, 2021 9:33 am
    Done! looks great! I guess it would be possible to set more than one feed if configured with blocks (columns)
    Jean-Se Dorais
    January 17, 2021 4:09 pm
    Great tutorial. Thank you!
    Christine Marshall
    January 20, 2021 9:10 am
    We are so glad you like it! Thanks for reading.
    Karine
    July 25, 2021 12:36 am
    How amazing, is something similar possible to display the feed of a specific Linkedin page?
    KG
    September 13, 2021 6:01 am
    Step 1 – Create a Visualforce Page that Shows the Twitter Feed Error: aub line 9, column 10: The content of elements must consist of well-formed character data or markup Error Error: The content of elements must consist of well-formed character data or markup.
    Akee
    September 22, 2021 7:39 am
    When using the above code I am getting below error Error: Twitter_Feed line 9, column 3: The content of elements must consist of well-formed character data or markup Error Error: The content of elements must consist of well-formed character data or markup. Can anyone help
    Bob R
    October 30, 2021 6:40 pm
    This took me a bit too. The directions are very literal. When they say to "Replace <> with the correct Twitter handle, without the “@”", if you simply put your handle in between the brackets, this will not work. You literally need to replace the whole "<>" phrase, brackets and all, with your handle. Same thing goes for this line: Replace <> with something like “Twitter Feed from My Company.” My code that worked for these lines looked like this: href="https://twitter.com/wildmontana?ref_src=twsrc%5Etfw"> Wild Montana Twitter Feed
    MMackay
    May 11, 2022 4:52 pm
    Hi Karine, Did you ever manage to solve this issue? Did you get a feed working from LinkedIn? regards Malc
    Louisa
    June 29, 2022 6:07 pm
    Is this possible for other social media platforms, Instagram, Facebook etc?

Leave a Reply