Get news article

Action ID
actions.intent.GET_NEWS_ARTICLE
Description

Search and view news updates. Filter news updates by topic and location using the newsArticle.about.name and newsArticle.contentLocation.name intent parameters. Additionally filter news updates by publication date, author, or publisher using the newsArticle.datePublished, newsArticle.author.name, and newsArticle.publisher.name parameters, if available.

For news related to sports (news articles of type "SportsEvent"), the sport, the team name, and the date of the event can be found in the newsArticle.about.sport, newsArticle.about.competitor.name, and newsArticle.about.doorTime intent parameters. Other game details (like season or league name) are contained in the newsArticle.about.description intent parameter.

Locale support

Functionality Locales
Preview creation using App Actions test tool en-US
User invocation from Google Assistant en-US

Example queries

The following fields represent essential information that users often provide in queries that trigger this built-in intent:

newsArticle.about.name
newsArticle.contentLocation.name

Other supported fields

The following fields represent information that users often provide to disambiguate their needs or otherwise improve their results:

newsArticle.@type
newsArticle.about.@type
newsArticle.about.competitor.@type
newsArticle.about.competitor.memberOf.@type
newsArticle.about.competitor.memberOf.name
newsArticle.about.competitor.name
newsArticle.about.homeTeam
newsArticle.about.sport
newsArticle.about.description
newsArticle.about.doorTime
newsArticle.author.@type
newsArticle.author.name
newsArticle.contentLocation.@type
newsArticle.datePublished
newsArticle.publisher.@type
newsArticle.publisher.name

Android widgets and slices

We recommend implementing Android widgets for this built-in intent. A widget presents information or interaction options from your app to improve user engagement in Google Assistant. Widgets are available for App Actions implementations using shortcuts.xml.

If you have a legacy App Actions implementation using actions.xml, use Android slices instead. We recommend migrating your implementation to shortcuts.xml to take advantage of widgets fulfillment and other improvements.

Supported text values by field








Inventory availability by field








Sample XML files

For information about the actions.xml schema, see Create actions.xml. For information about the shortcuts.xml schema, see Create shorcuts.xml.

Handle BII parameters

shortcuts.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- This is a sample shortcuts.xml -->
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
  <capability android:name="actions.intent.GET_NEWS_ARTICLE">
    <intent
      android:action="android.intent.action.VIEW"
      android:targetPackage="YOUR_UNIQUE_APPLICATION_ID"
      android:targetClass="YOUR_TARGET_CLASS">
      <!-- Eg. datePublished = "2019-12-05" -->
      <parameter
        android:name="newsArticle.datePublished"
        android:key="datePublished"/>
      <!-- Eg. aboutName = "US Elections" -->
      <parameter
        android:name="newsArticle.about.name"
        android:key="aboutName"/>
      <!-- Eg. authorName = "John Doe" -->
      <parameter
        android:name="newsArticle.author.name"
        android:key="authorName"/>
      <!-- Eg. publisherName = "John Doe" -->
      <parameter
        android:name="newsArticle.publisher.name"
        android:key="publisherName"/>
      <!-- Eg. contentLocationName = "Mountain View" -->
      <parameter
        android:name="newsArticle.contentLocation.name"
        android:key="contentLocationName"/>
    </intent>
  </capability>
</shortcuts>
      

actions.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- This is a sample actions.xml -->
<actions>
  <action intentName="actions.intent.GET_NEWS_ARTICLE">
    <fulfillment urlTemplate="myapp://custom-deeplink{?datePublished,aboutName,authorName,publisherName,contentLocationName}">
      <!-- e.g. datePublished = "2019-12-05" -->
      <!-- (Optional) Require a field eg.datePublished for fulfillment with required="true" -->
      <parameter-mapping urlParameter="datePublished" intentParameter="newsArticle.datePublished" required="true" />
      <!-- e.g. aboutName = "US Elections" -->
      <parameter-mapping urlParameter="aboutName" intentParameter="newsArticle.about.name" />
      <!-- e.g. authorName = "John Doe" -->
      <parameter-mapping urlParameter="authorName" intentParameter="newsArticle.author.name" />
      <!-- e.g. publisherName = "John Doe" -->
      <parameter-mapping urlParameter="publisherName" intentParameter="newsArticle.publisher.name" />
      <!-- e.g. contentLocationName = "Mountain View" -->
      <parameter-mapping urlParameter="contentLocationName" intentParameter="newsArticle.contentLocation.name" />
    </fulfillment>

    <!-- Provide a fallback fulfillment with no required parameters. For example, to your app search or router deeplink -->
    <fulfillment urlTemplate="myapp://deeplink" />
  </action>
</actions>

Use web inventory

newsArticle.about.name is a field that supports web inventory. In the following example, Google Assistant performs a web search for the user query and determines the fulfillment URL. Assistant filters for search results that match the provided urlFilter value of https://www.mywebsite.com/link1/.*.

shortcuts.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- This is a sample shortcuts.xml -->
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
  <capability android:name="actions.intent.GET_NEWS_ARTICLE">
    <intent
      android:action="android.intent.action.VIEW"
      android:targetPackage="YOUR_UNIQUE_APPLICATION_ID"
      android:targetClass="YOUR_TARGET_CLASS">
      <parameter android:name="newsArticle.datePublished">
        <data android:pathPattern="https://www.mywebsite.com/link1/.*"/>
      </parameter>
      <parameter android:name="newsArticle.about.name">
        <data android:pathPattern="https://www.mywebsite.com/link2/.*"/>
      </parameter>
      <parameter android:name="newsArticle.author.name">
        <data android:pathPattern="https://www.mywebsite.com/link3/.*"/>
      </parameter>
      <parameter android:name="newsArticle.publisher.name">
        <data android:pathPattern="https://www.mywebsite.com/link4/.*"/>
      </parameter>
      <parameter android:name="newsArticle.contentLocation.name">
        <data android:pathPattern="https://www.mywebsite.com/link5/.*"/>
      </parameter>
    </intent>
  </capability>
</shortcuts>
      

actions.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- This is a sample actions.xml -->
<actions>
  <action intentName="actions.intent.GET_NEWS_ARTICLE">
    <!-- Use URL from entity match for deep link fulfillment -->
    <!-- Example: url = 'https://www.mywebsite.com/link1/item1' -->
    <fulfillment urlTemplate="{@url}" />

    <!-- Provide a fallback fulfillment with no required parameters. For example, to your app search or router deeplink -->
    <fulfillment urlTemplate="myapp://deeplink" />

    <!-- Define parameters with web inventories using urlFilter -->
    <parameter name="newsArticle.about.name">
      <entity-set-reference urlFilter="https://www.mywebsite.com/link1/.*" />"/>
    </parameter>
  </action>
</actions>

JSON-LD sample

The following JSON-LD sample provides some example values that you can use in the App Actions test tool:

{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "about": {
    "@type": "Thing",
    "name": "US Elections"
  },
  "author": {
    "@type": "Person",
    "name": "John Doe"
  },
  "contentLocation": {
    "@type": "Place",
    "name": "Mountain View"
  },
  "datePublished": "2019-12-05",
  "publisher": {
    "@type": "Person",
    "name": "John Doe"
  }
}
{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "about": {
    "@type": "SportsEvent",
    "competitor": {
      "@type": "SportsTeam",
      "memberOf": {
        "@type": "Organization",
        "name": "Example Cricket League"
      },
      "name": "Cricket team A"
    },
    "descripton": "1st match of the Example series",
    "doorTime": "2011-12-20T23:59:59",
    "homeTeam": {
      "@type": "SportsTeam",
      "name": "Cricket team B"
    },
    "name": "Team A - Team B Cricket match",
    "sport": "Cricket"
  },
  "author": {
    "@type": "Person",
    "name": "John Doe"
  },
  "contentLocation": {
    "@type": "Place",
    "name": "Mountain View"
  },
  "datePublished": "2019-12-05",
  "publisher": {
    "@type": "Organization",
    "name": "Example Publications"
  }
}