External Data Feeds references

A push request property specifying which external data feeds should be invoked and with what parameters in order to support personalization from feed content.

View as Markdown
Important

You must first create an external data feed in the dashboard, then you can refer to its ID as the name in the feed references object. The Coupons service is a type of external data feed. See Coupons for formatting and usage information.

Feed references object

An object used to indicate that an external data feed should be invoked, the name of the feed to invoke, and the way in which to invoke it. You can only include a feed if you include a templates object in the payload or set the personalization option to true.

Jump to examples ↓

OBJECT PROPERTIES
  • defaults object

    Default parameter values for your feed. These values override any defaults you set for your feed in the Airship dashboard.

  • feeds array[object]REQUIRED

    An array of feeds that you want to use to personalize your message.

    OBJECT PROPERTIES
    • name stringREQUIRED

      The feed ID set in the dashboard.

    • on_error string

      Determines how the message is handled if the feed is unreachable or does not return an expected response. Defaults to cancel.

      Possible values:

      • continue
      • cancel

      Default: cancel

    • params object

      An optional dictionary of overrides for default parameters in handlebars referencing the feed.

Used in:

Examples

Example push external data feeds request

POST /api/push HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

 {
    "device_types": ["ios"],
    "audience": { "tag": "earlyBirds" },
    "notification": {
       "alert": "{{#feed \"featured_product\"}}Hello, {{user}}, could I interest you in {{product_name}} today?{{/feed}}"
    },
    "options": {
       "personalization": true
    },
    "feed_references": {
       "feeds": [
          {
             "name": "featured_product"
          }
       ],
       "defaults": {
          "featured_product": {
             "category": "featured"
          }
       }
    }
 }
HTTP/1.1 202 Accepted
Content-Type: application/vnd.urbanairship+json; version=3
Content-Length: 123
Data-Attribute: push_ids

{
    "ok": true,
    "operation_id": "5e7852b0-6909-4e60-a73f-4d6b92d94c80",
    "push_ids": [
       "bf28d158-fefe-475a-9c2a-ed4f69cc891e"
    ]
}   

Example feed references object

{
   "feed_references": {
      "feeds": [
         {
            "name": "featured_product",
            "params": {
               "sub_category": "shoes"
            },
            "on_error": "continue"
         }
      ],
      "defaults": {
         "featured_product": {
            "category": "featured"
         }
      }
   }
}