Specs/Announcements/0.2.0

From MediaWiki.org
Jump to navigation Jump to search

This page documents the various configuration options available when defining announcements to be shown in the Wikipedia mobile apps via the featured feed endpoint.

Note: Currently, announcement definitions are hard-coded in MCS as needed and deployed as part of the normal deployment process. Eventually, we plan to set up on-wiki announcement configurations, likely using JsonConfig, so that the app teams can create and update announcements directly without requiring a service deployment by Reading Infrastructure.

Name Type Required Description Example
id string Y unique (among current announcement objects) ID of the announcement 201809ANDROID
type enum Y announcement type, one of [ 'survey', 'fundraising', 'announcement' ] fundraising
start_time string Y ISO 8601 date/time representing the earliest the announcement should be shown 2018-08-09T20:00:00Z
end_time string Y ISO 8601 date/time representing the latest the announcement should be shown 2018-08-16T20:00:00Z
platforms string[] Y array of platforms on which this announcement should be shown, consisting of one or more of [ 'iOSApp', 'AndroidApp', 'AndroidAppV2' ] [ 'AndroidAppV2' ]
text string Y body text of the announcment.

IMPORTANT:

- this MUST be formatted as an HTML string for Android

- this MUST NOT be HTML-formatted for iOS

https://phabricator.wikimedia.org/T153224

'<b>hello</b><br><br>world' (Android)

'hello\n\nworld' (iOS)

countries string[] Y array of ISO 3166 country codes for countries in which the announcement should be shown. clients will match these to request header GeoIP data. [ 'US', 'CA' ]
action object Y object containing two properties:

- title (string, required) - button text for the action button on the announcement

- url (string, required) - URL to which the user should be directed when the action button is clicked

{ title: 'Foo', url: 'http://example.com' }
image_url string N URL for an image file to be displayed on the announcment card https://upload.wikimedia.org/wikipedia/en/5/5f/Original_Doge_meme.jpg
image string N [DEPRECATED] URL for an image file to be displayed on the announcement card. Legacy field for Android that should match image_url. Both fields should be provided for Android until enough (TM) clients have adopted the version with the change. https://upload.wikimedia.org/wikipedia/en/5/5f/Original_Doge_meme.jpg
caption_HTML string N Additional HTML-formatted content to display below the announcement, usually a privacy statement and link to privacy policy. NOTE: Must be <p>-wrapped for iOS, and must not be for Android. See <a href="https://foundation.wikimedia.org/wiki/Privacy_policy">privacy policy</a>.
beta boolean N [AndroidAppV2 only] Optional boolean flag controlling the release builds for which the announcement should be shown.

Set to true if the announcement should be shown only in pre-production builds (beta, alpha, dev).

Set to false if the announcement should be shown only in release builds.

If not defined, the announcement will be shown for all builds.

true
logged_in boolean N [AndroidAppV2 only] Optional boolean flag controlling whether announcements should be shown based on the user login state.

Set to true if the announcement should be shown only if the user is logged in.

Set to false if the announcement should be shown only if the user is NOT logged in.

If not defined, the announcement will be shown regardless of the user's login state.

true
reading_list_sync_enabled boolean N [AndroidAppV2 only] Optional boolean flag controlling whether announcements should be shown based on whether the user

has enabled reading list syncing.

Set to true if the announcement should be shown only if the user has enabled reading list syncing.

Set to false if the announcement should be shown only if the user has NOT enabled reading list syncing.

If not defined, the announcement will be shown regardless of whether the user has enabled reading list syncing.

true
negative_text string N [AndroidAppV2 only] text to show on a "negative" button on the announcement. if absent, the button is not shown No thanks
image_height integer N [AndroidAppV2 only] height, in device-independent pixels (dp), of the image portion of the announcement card 48