cs-icon.svg

YouTube App Installation Guide

YouTube is a video-sharing service where users can watch, upload, create their own videos, like, and comment on other videos.

Contentstack Marketplace lets you embed and display the information of any YouTube channel directly into the CMS environment by just providing a channel ID. This saves the content managers' time and eliminates the potential errors caused by manual data insertion.

Prerequisites

This step-by-step guide explains how to install and configure YouTube within your stack.

Steps for Execution

  1. Get YouTube API key
  2. Get Channel ID
  3. Install and Configure the YouTube app in Contentstack Marketplace
  4. Use the YouTube app within your Stack
  1. Get YouTube API key

    In order to set up this extension in Contentstack, you will need the YouTube API key.
    Follow the steps to get your YouTube API key.

    1. Sign in to Google Console Cloud to go to APIs & Services.
    2. Click SELECT PROJECT to select an existing project or click CREATE PROJECT to create a new project.
      YouTube-API-Select_or_Create_Project.png
    3. Go to the Library section in the left panel.
    4. Click YouTube Data API V3.
      YouTube-YouTube_Data_API_V3.png
    5. Click ENABLE.
      YouTube-API-Enable.png
    6. Click CREATE CREDENTIALS.
      YouTube-Create-Credentials.png
    7. Under Credential Type, select the following:
      • From the Select an API dropdown, select YouTube Data API v3.
      • From What data will you be accessing?, select Public data.
      • YouTube-API-Credentials.png
    8. Click NEXT.
      This will create your YouTube API Key.
    9. Copy the API key and click DONE.
      YouTube-API-Copy_API.png
  2. Get Channel ID

    While configuring the app (in Step 3), you need to specify the YouTube channel ID from which you want to fetch and display the videos.

    Note: In Contentstack, using the YouTube app, you can display videos from any public channel.

    Each YouTube channel has a unique ID. Let us understand how to get this ID:

    1. Visit the home/landing page of the YouTube channel of your choice on a browser.
    2. Right-click on the page and click View page source.
    3. Search for channelId.
      YouTube_-_ChannelID.png
    4. Copy the channel ID.
  3. Install and Configure the YouTube app in Contentstack Marketplace

    To install the application in Contentstack, follow the steps below:

    1. Log in to your Contentstack account.
    2. In the left-hand side primary navigation, click the Marketplace icon to go to the Marketplace.
      MP-Apps.png
    3. Click Apps from the left panel.
    4. Within the Marketplace, you can see all the available apps. Hover over the YouTube app and click Install App.
      YouTube-App.png
    5. In the popup window, select the stack where you want to install the YouTube app and click the Install button.
      Youtube-Install-App
    6. On the Configuration page, enter the following details:
      1. API Key: Enter the YouTube API Key that we retrieved in Step 1.
      2. Channel ID(s): Enter the YouTube Channel ID(s) that we retrieved in Step 2.
      3. Note: You can add multiple channel ids at once.

      4. Choose YouTube Keys to Save in Entry: Choose how to save the data fetched from theYouTube account in Contentstack entries.
        1. If you select the All Fields option, you can select only a limited number of videos in the entry.
        2. For Custom Fields, you can search and add specific YouTube Keys you want to save in entries. By default, the videoId key is selected.
        YouTube-Congifuration
      5. Note: Only the embedded source URL (src) will be stored in JSON RTE plugin response.

        Sample JSON:

        attrs": {
                  "src": "https://www.youtube.com/embed/oT1f39lgQdk",
                  "type": "YouTube"
                }                
        
    7. On the UI Locations tab, you can see the predefined app locations. You can use the toggle button corresponding to each UI location to enable or disable it based on your requirements. YouTube-UI-Locations
    8. Additional Resource: For more information on UI locations, please refer to the Installed Apps guide.

    9. Click the Save button.
    10. Click Open Stack to start using the YouTube application.
  4. Use the YouTube app within your Stack

    To use the YouTube application within an entry of your stack, follow the steps given below:

    1. Go to your stack, click the Content Models icon in the left navigation panel, and click the + New Content Type button.
    2. Create a content type by adding relevant details as displayed below:
      YouTube-Content-Type

    There are two ways to use the YouTube application in your entry:

    1. Custom Field
    2. JSON Rich Text Editor Field

    Steps to use the YouTube application using a Custom field

    1. In the Content Type Builder page, add a Custom field in your content type by clicking the Insert a field link represented by a + sign.
    2. Under Select Extension/App, select YouTube and click the Proceed button.
      YouTube-App-Add-In-Custom-Field
      This adds YouTube in the custom field.
      YouTube-App-Added-In-Custom-Field
    3. After adding the app in a custom field, click Save or Save and Close to save your changes.
    4. To use the YouTube app, create an entry for this content type. In the left navigation panel, navigate to the Entries page, click + New Entry to create a new entry for the above content type, and then click Proceed.
      You will see the YouTube custom field on your entry page as shown below:
      YouTube-Custom-Field-Sample-Entry
    5. Click the + Add Video(s) button.
      YouTube-Custom-Field-Add-Videos
    6. Select the video(s) from your YouTube selector page and click the Add Videos(s) button to add them to your entry.
      YouTube-Custom-Field-Selector-Page-Add-Videos

      Note: You can add multiple videos in one go.

      You can filter products based on channels. You have configured multiple channel Id(s) at the time of configuration in Step 3.
      YouTube-Custom-Field-Selector-Page-Channel-Filter
      You can search for videos on the YouTube selector page based on the video name.
      YouTube-Custom-Field-Selector-Page-Search
      Hover over the video on the YouTube selector page, and you can see the View in YouTube option to go directly to the YouTube app.
      YouTube-Custom-Field-Selector-Page-View-In-YouTube
      The selected video(s) are referenced in the thumbnail view within your entry.
      YouTube-Custom-Field-Added-Videos-In-Thumbnail-view
      Select the list view option from the dropdown to view the video(s) in the list view.
      YouTube-Custom-Field-Added-Videos-View-Options
      The selected video(s) are referenced in the list view within your entry.
      YouTube-Custom-Field-Added-Videos-In-List-view
    7. To reorder the video, open it in YouTube or delete the video, hover over the image to get the options available, then perform the following:
      1. Click the Reorder icon to reorder the video.
      2. Click the Open in YouTube icon to open the video in the YouTube app.
      3. Click the Delete icon to delete the selected video.

      Thumbnail View

      YouTube-Custom-Field-Added-Videos-Features-In-Thumbnail-view

      List View

      YouTube-Custom-Field-Added-Videos-Features-In-List-view
      Delete action generates a prompt modal for confirmation. Click the Delete button to delete the video permanently.
      YouTube-Custom-Field-Delete-Modal
    8. After adding the video(s), Save and Publish your entry.

    Steps to use the YouTube application in a JSON Rich Text Editor field

    1. In the Content Type Builder page, add a JSON Rich Text Editor field in your content type by clicking the Insert a field link represented by a + sign.
    2. Under Select JSON RTE Plugin(s), select YouTube, and then click Add Plugin(s).
      YouTube-App-Add-In-JSONRTE
      This adds YouTube in the JSON Rich Text Editor field.
      YouTube-App-Added-In-JSONRTE
    3. After adding the app in a JSON Rich Text Editor field, click Save or Save and Close to save your changes.
    4. To use the YouTube app, create an entry for this content type. In the left navigation panel, navigate to the Entries page, click + New Entry to create a new entry for the above content type, and then click Proceed.
      You will see the YouTube button in the JSON Rich Text Editor field on your entry page, as shown below:
      YouTube-JSONRTE-Sample-Entry
    5. Click the YouTube app icon.
      YouTube-JSONRTE-Add-Videos
    6. Select the video(s) from your YouTube selector page and click the Add Videos(s) button to add them to your entry.
      YouTube-Custom-Field-Selector-Page-Add-Videos

      Note: You can add multiple videos in one go.

      You can filter products based on channels. You have configured multiple channel Id(s) at the time of configuration in Step 3.
      YouTube-Custom-Field-Selector-Page-Channel-Filter
      You can search for videos on the YouTube selector page based on the video name.
      YouTube-Custom-Field-Selector-Page-Search
      Hover over the video on the YouTube selector page, and you can see the View in YouTube option to go directly to the YouTube app.
      YouTube-Custom-Field-Selector-Page-View-In-YouTube
      The video(s) you selected are referenced within your entry.
      YouTube-JSONRTE-Added-Videos
    7. To reorder, edit, or delete the video, hover over the video to get the options available, then perform the following:
      1. Click the Drag to move icon to reorder the video.
      2. Click the Edit icon to edit the video.
      3. Click the Delete icon to delete the selected video.

      YouTube-JSONRTE-Added-Videos-Features
      Edit action generates a prompt modal for updating the embed URL. Click the Update button to edit the URL.
      YouTube-JSONRTE-Edit-Modal
    8. After adding the video(s), Save and Publish your entry.
Was this article helpful?
^