Push to segment API with inline content

Push to Segment API (also known as the Push to Contact Source API) with inline content, can be used from an external system, but not from the Campaign Automation UI.

📘

Note:

If the user wants to send a rich notification using this API, the rich content has to be created first using the Create Rich Content (POST:/channels/push/richcontent) or a valid rich content ID should be used. If a user wants to send an in-app notification using this API, the inapp content has to be created first using the In-App Content API (POST:/channels/push/inappcontent) or a valid inapp content ID should be used.

Functionalities available

The Push to Segment API with inline content call has POST functionalities.
POST: This call sends a push notification.
POST /channels/push/sendjobs

Swagger URL

https://api-campaign-us-[your pod number].goacoustic.com/restdoc/#!/channels/sendpush_to_segment_inline_source_post

Scenarios that can be accomplished using this API

Send to a predefined contact source/segment (database, query or contact list created in WCA) using content defined in the API payload.

The following mobile app messages supported:

  • Simple
  • Simple + inbox (rich content has to be created prior to using this API and must have a valid richcontent ID, see the Create Rich Content)
  • Simple + Extension
  • Inbox only (rich content has to be created prior to using this API and must have a valid richcontent ID, Create Rich Content)
  • In-App only
  • Data only

Additional information about this API

  • Regular personalization can only be used with information known to Watson Campaign Automation.
  • Relational table personalization is supported (with 18.1 release, no error validation available).
  • This API does check mobile app frequency limits and honors them.
  • Messages can be scheduled
  • Pre-processing can be specified, see the preBlockingHours attribute.
  • Can schedule based on recipient’s timezone, see useRecipientTimezone attribute.

Request body

SendJobWithInlineSpecification

Attribute

Data type

Description

appKeys (required)

array [string]

List of App keys

contactSourceId (optional)

long

ID of the contact source (ie. database, contact list, query)

campaignName (required)

string

Campaign name

messageName (required)

string

Message name

folder (optional)

string

Message folder location

scheduledDate (optional)

date

Date on which the push notification is to be sent

preBlockingHours (optional)

integer

Value representing the blocking time before send the push notification

useRecipientTimeZone (optional)

boolean

Whether or not to use recipient time zone for Push notification

Content (required)

model

Content for push notification

InlinePushContent

Attribute

Data type

Description

InboxMessage (optional)

model

Inbox message content

InAppMessage (optional)

model

InApp message content

Simple (optional)

model

Contents for push notification

InboxMessage

Attribute

Data type

Description

expirationDate (required)

date

InApp message expiration date represented in a string as per RFC 3339 (1970-01-01T00:00:00.000+00:00)

richContentID (required)**

string

Inbox message rich content ID – see Create Rich Content

**publishedmessageID from Campaign Automation cannot be used here.

InAppMessage

Attribute

Data type

Description

expirationDate (required)

date

InApp message expiration date represented in a String as per RFC 3339 (1970-01-01T00:00:00.000+00:00)

maxViews (required)

integer

Maximum number of views on the InApp message

inAppContentId (required)

InAppContentId

InApp message content id – See In-App Content API

In-App Content API

SimplePushContent

Attribute

Data type

Description

aps (optional)

iOSPushPayload

Push content for iOS devices

gcm (optional)

AndroidPushPayload

Push content for Android devices

iOSPushPayload

Attribute

Data type

Description

aps (optional)

model

APS

notification-action (optional)

model

Action to perform when notification is pressed

Data (optional)

model

Map of key value pairs as data content

media-attachment (optional)

string

Media URL send with the notification

APS

Attribute

Data type

Description

alert (optional)

string

Message to show on notification

badge (optional)

integer

Number to show on App

interruption-level (optional)

string

Value to determine the priority and timing of of when the user receives the notification.
The following values are available:

  • passive - does not interrupt the user. Available from iOS 15 version.
  • active (default) - wakes the phone does not interrupt focus mode.
  • time-sensitive - wakes the phone and interrupts the focus mode. Available from iOS 15 version.
  • critical - requires permission from Apple.

relevance-score (optional)

number

A number value between 0 and 1 to determine how the notification is featured when grouped.

IosAlertNode

Attribute

Data type

Description

title (optional)

string

Title of notification

subtitle (optional)

string

Subtitle of notification

body (optional)

string

Message of notification

Action

Attribute

Data type

Description

type (required)

string

Type of action to perform

name (optional)

string

Name of action to display on notification

value (required)

JSONnode

Parameters of action

AndroidPushPayload

Attribute

Data type

Description

alert (optional)

AndroidAlertNode – model

Android push contents

Data (optional)

model

Map of key value pairs as data content

AndroidAlertNode

Attribute

Data type

Description

subject (optional)

string

Subject of notification

message (optional)

string

Message of notification

notification-action (optional)

model

Action to perform when notification is pressed

Sample JSON request body

Simple message

{
  "appKeys": [
    "gcU6M2fD9P"
  ],
  "contactSourceId": "332229",
  "campaignName": "Black Friday 2017 Offer",
  "messageName": "Black Friday 2017 morning Promotion",
  "useRecipientTimeZone":"true",
  "scheduledDate":"2017-04-18T16:30:51.123+00:00",
  "content": {
    "simple": {
      "gcm": {
        "alert": {
         "subject": "Special Black Friday Sale!",
          "message": "Extra 20% off for purchases before midnight!",
          "notification-action": {
            "type": "url",
            "name": "URL",
            "value": "http://www.ibm.com"
          }
        }
      }
    }
  }
 }

Personalization example

Personalization fields (first_name, last_name) are contact attributes known/within to Campaign Automation.

"contactSourceId": "1234567",
  "campaignName": "Push to segment with inline",
  "messageName": "Demo message name",
  "appKeys": [
    "apIOSappkey",
    "gcAndroidAppkey"
  ],
  "content": {
    "simple": {
      "apns": {
        "aps": {
          "alert": "Simple personalization test for %%first_name%% %%last_name%%",
          "sound": "default"
        },
        "notification-action": {
          "type": "url",
          "value": "http://www.ibm.com"
        }
      },
      "gcm": {
        "alert": {
          "subject": "Simple personalization test for %%first_name%% %%last_name%%",
          "message": "Simple",
          "notification-action": {
            "type": "url",
            "value": "http://www.ibm.com"
          },
          "highPriority": false,
          "sensitive": false
        }
      }
    }
  }
 }