Bolt bridge reference
Table of Contents
Bolt web content can interact with the native app using a well-defined javascript bridge. For an overview of how this works, see the Pugpig HTML Bridge Overview. This document is a reference for the available bridge calls.
The bridge calls may refer to issues, timelines or editions. They're all the same thing. For example, issueAuthorisationStatus, timelineInfo and cancelEditionDownload are all acting on a collection of stories (sometimes called “articles”).
Some calls can only be made in a certain context, as defined by the availability field in the bridge description. This is usually because the call only makes sense in that context. The possible contexts are:
- within a timeline (a view that shows a list of stories/articles)
- within a storefront (a view that shows a list of editions/issues/timelines)
- within article content
- within an arbitrary web view (e.g. a web view launched from settings)
For example, the stories bridge only makes sense within a timeline because it's listing the stories within that timeline.
Active bridges
addToCalendar
Parameter(s) | Story |
Availability | iOS timeline only, Android all bridge-enabled views |
Updates | n/a |
Result | n/a |
authorisationStatus
Parameter(s) | n/a |
Availability | all bridge-enabled views |
Updates | on feed access changes |
Result |
{ "state" : "inactive" | "active", "message": "last subscription response message", "eligibleForStorePurchase", true | false, "eligibleForSubscriptionUpgrade", true | false, "store": "googleplay" | "amazon" | "itunes", "userInfo" : { userInfo response key-value pairs } } |
cancelEditionDownload
Parameter(s) | { "editionId" : String } |
Availability | all bridge-enabled views except timeline |
Updates | n/a |
Result | n/a |
clearForwardTouchesWithin
Parameter(s) | n/a |
Availability | Android timeline and content only |
Updates | n/a |
Result | n/a |
deleteEdition
Parameter(s) | { "editionId" : String } |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
forwardTouchesWithin
Parameter(s) |
[ {"x" : Integer, "y": Integer, "w": Integer, "h": Integer} ] You can have as many areas in a single call as you need. Calling forwardTouchesWithin adds the areas to the existing areas. Clear all areas with the clearForwardTouchesWithin bridge. |
Availability | Android timeline and content only |
Updates | n/a |
Result | n/a |
issueAuthorisationStatus
Parameter(s) | JSON string array of feed identifiers |
Availability | all bridge-enabled views |
Updates | on feed access changes |
Result |
{ … |
getConsentData
Parameter(s) | key: String |
Availability | all bridge-enabled views |
Updates | n/a |
Result | Consent value for given key, may be blank. |
getConsentStatus
Parameter(s) | n/a |
Availability | all bridge-enabled views |
Updates | n/a |
Result | "no_provider" | "unknown" | "not_required" | "required" | "obtained" |
localizableDateTimeString
Parameter(s) |
{ "stringId": String, "datetime" : String} datetime must be an ISO-8601 format string |
Availability | all bridge-enabled views |
Updates | n/a |
Result | Date or time string with given id using the specified ISO-8601 format. The string can contain {{date}}, {{time}} or {{datetime}} and the appropriate format will be substituted. |
localizableQuantityString
Parameter(s) |
{ "stringId": String, "quantity" : Integer, "params" : [ String ] } params is optional |
Availability | all bridge-enabled views |
Updates | n/a |
Result | string with given id, parameters substituted as appropriate. Quantity will be substituted according to cardinality rules. |
localizableRelativeTimeString
Parameter(s) |
{ "stringId": String, "datetime" : String, "params" : [ String ] } params is optional datetime must be an ISO-8601 format string |
Availability | all bridge-enabled views |
Updates | n/a |
Result |
Relative time string with given id using the specified ISO-8601 format, parameters substituted as appropriate. If the time is within 60 seconds, it uses the string key relative_date_now for the value. If the time is within 7 days, it's a relatively formatted value. If it's within the current year, it's a short day month string. Otherwise. it's a full absolute date. |
localizableString
Parameter(s) |
{ "stringId": String, "params" : [ String ] } params is optional |
Availability | all bridge-enabled views |
Updates | n/a |
Result | string with given id, with parameters substituted as appropriate |
localizableStringWithPriceSubstitutions
Parameter(s) | { "stringId": String } |
Availability | all bridge-enabled views |
Updates | n/a |
Result |
String with given id with price values substituted. TODO: more detail |
logInfo
Parameter(s) | message: String |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
openAudioPlayer
Parameter(s) | key: String |
Availability | all bridge-enabled views |
Updates | n/a |
Result | stored string value associated with the key, or null if key does not exist |
openImageGallery
Parameter(s) |
{ "initialImage" : Integer, "images" : [ { "src": "relative-src-url", "caption" : "caption-message", "copyright": "copyright-message" } ] } initialImage is the index to display first. You can have as many images as you like. All text fields must be defined, but can be blank. |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
openEdition
Parameter(s) |
{ "editionId" : String, "partition" : String, "autoDownload" : Bool, "skipTimeline": Bool } partition is optional autoDownload is optional and defaults to true. skipTimeline is optional and defaults to false. |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
openBrowser
Do not use this for internal URLs, like commands. This is unsupported, and the behaviour is undefined.
Parameter(s) | url: String. MUST be fully qualified. |
Availability | all bridge-enabled views, Bolt 4.3 or later. |
Updates | n/a |
Result | n/a |
paywallState
Parameter(s) | n/a |
Availability | content only |
Updates | authorisation changes |
Result | { "paywall": "standard" | "metered" | "none" } |
playAudio
Parameter(s) |
{ "url" : String, "story" : Story, "action" : String, "metadata": Dictionary } action can be “openActions”, “playNow”, “playNext”, “addToQueue” the metadata dictionary can contain an “image” field |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
pushUserIdentifier
Parameter(s) | n/a |
Availability | all bridge-enabled views |
Updates | n/a |
Result | push provider's unique user identifier, or a blank string if unavailable |
readStories
Parameter(s) | n/a |
Availability | all bridge-enabled views (except iOS timeline prior to Bolt 4.1.x) |
Updates | read stories updated |
Result |
{ "readStories" : [ [ feed-id, story-id ], [ feed-id, story-id ], … ] } |
rewriteURLUsingExternalDomainSettings
Parameter(s) | url: String |
Availability | all bridge-enabled views |
Updates | n/a |
Result | rewritten url string |
savedStories
Parameter(s) | n/a |
Availability | all bridge-enabled views (except iOS timeline prior to Bolt 4.1.x) |
Updates | saved stories updated |
Result |
{ "savedStories" : [ [feed-id, story-id], [feed-id, story-id], … ] } |
setSaved
Parameter(s) |
{ "story": Story, "saved" : Bool } iOS saves the story is “saved” is true and removes it if “saved” is false. Android removes the story if it is already saved, otherwise adds it. |
Availability | all bridge-enabled views (except iOS timeline prior to Bolt 4.1.x) |
Updates | n/a |
Result | n/a |
shareStory
Parameter(s) | Story |
Availability | iOS timeline only, Android all bridge-enabled views |
Updates | n/a |
Result | n/a |
shouldViewWidget
Parameter(s) | Story |
Availability | timeline only |
Updates | n/a |
Result | true if widget should be shown/activated |
startEditionDownload
Parameter(s) | { "editionId" : String } |
Availability | all bridge-enabled views (except iOS timeline prior to Bolt 4.1.x) |
Updates | n/a |
Result | n/a |
storeGet
Parameter(s) | key: String |
Availability | all bridge-enabled views |
Updates | n/a |
Result | stored string value associated with the key, or null if key does not exist |
storeSet
Parameter(s) |
{ "key": String, "value": String } Specify null as the value to delete the string associated with the key. |
Availability | all bridge-enabled views |
Updates | on feed access changes |
Result | n/a |
stories
Parameter(s) | n/a |
Availability | timeline only |
Updates | timeline changed |
Result |
{ "stories" : [ JSON-Array of stories ] } |
timelineIsReady
Parameter(s) | { "version" : "current-timeline-version" } |
Availability | timeline only |
Updates | n/a |
Result | n/a |
timeline
Parameter(s) | { "editionId": String } |
Availability | iOS all bridge-enabled views except timeline, Android all bridge-enabled views |
Updates | timeline changed (including download progress updates) |
Result |
{ downloadError is optional (there may be no error) |
timelines
Parameter(s) |
{ [String:String] } The dictionary filters the list of timelines. A filter matches an entry if, for every pair in the filter:
The timelines automatically filter out any entry that should not be visible for a given authorisation state (e.g. "private" timelines are filtered if you are not signed in). |
Availability | storefront only |
Updates | n/a |
Result | JSON array of timeline entries |
timelineInfo
Parameter(s) | n/a |
Availability | timeline only |
Updates | timeline changes |
Result |
{ "timelineType", "SavedTimeline" | "Timeline", "themeURL" : [ array-of-additional-CSS-files ], "sourceURL" : "timeline-source-url", "feedReference": { full-feed-reference-from-feed }, "metadata": { global-metadata-from-feed }, "debugLogs": true | false } The source URL is in the /t/feedid format. |
timelinesInfo
Parameter(s) | n/a |
Availability | storefront only |
Updates | n/a |
Result |
{ tab parameters, "baseUrl" : “base url string” } The "css" array is rewritten to be config-relative |
trackAnalyticsEvent
Parameter(s) |
{ "name" : String, "category" : String, "param" : String, "dimensions" : { [String:String] }} category and param are optional |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
updateTime
Parameter(s) | n/a |
Availability | timelines only |
Updates | Timeline refresh |
Result |
{ "dateTime", "time-last-updated", "lastCheckedDateTime" : "time-last-checked" } The times are in UTC, in format yyyy-MM-ddTHH:mm:ssZ |
viewArticle
Parameter(s) | Story |
Availability | timeline only |
Updates | n/a |
Result | n/a |
webviewInfo
Parameter(s) | n/a |
Availability | all bridge-enabled views |
Updates | n/a |
Result |
{ "baseUrl": url, Locale language is the ISO 639-1 language code, region is the ISO 3166-1 region code. It's legal for there to be no region. |
Deprecated bridges
baseUrl
Parameter(s) | n/a |
Availability | all bridge-enabled views |
Updates | n/a |
Result | n/a |
localeInfo
Parameter(s) | n/a |
Availability | all bridge-enabled views |
Updates | n/a |
Result |
{ } Language is the ISO 639-1 language code, region is the ISO 3166-1 region code. It's legal for there to be no region. |