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 Acoustic Campaign.
  • 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

AttributeData typeDescription
appKeys (required)array [string]List of App keys
contactSourceId (optional)longID of the contact source (ie. database, contact list, query)
campaignName (required)stringCampaign name
messageName (required)stringMessage name
folder (optional)stringMessage folder location
scheduledDate (optional)dateDate on which the push notification is to be sent
preBlockingHours (optional)integerValue representing the blocking time before send the push notification
useRecipientTimeZone (optional)booleanWhether or not to use recipient time zone for Push notification
Content (required)modelContent for push notification

InlinePushContent

AttributeData typeDescription
InboxMessage (optional)modelInbox message content
InAppMessage (optional)modelInApp message content
Simple (optional)modelContents for push notification

InboxMessage

AttributeData typeDescription
expirationDate (required)dateInApp message expiration date represented in a string as per RFC 3339 (1970-01-01T00:00:00.000+00:00)
richContentID (required)**stringInbox message rich content ID – see Create Rich Content

**publishedmessageID from Campaign Automation cannot be used here.

InAppMessage

AttributeData typeDescription
expirationDate (required)dateInApp message expiration date represented in a String as per RFC 3339 (1970-01-01T00:00:00.000+00:00)
maxViews (required)integerMaximum number of views on the InApp message
inAppContentId (required)InAppContentIdInApp message content id – See In-App Content API

In-App Content API

SimplePushContent

AttributeData typeDescription
aps (optional)iOSPushPayloadPush content for iOS devices
gcm (optional)AndroidPushPayloadPush content for Android devices

iOSPushPayload

AttributeData typeDescription
aps (optional)modelAPS
notification-action (optional)modelAction to perform when notification is pressed
Data (optional)modelMap of key value pairs as data content
media-attachment (optional)stringMedia URL send with the notification

APS

AttributeData typeDescription
alert (optional)stringMessage to show on notification
badge (optional)integerNumber to show on App
interruption-level (optional)stringValue 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)numberA number value between 0 and 1 to determine how the notification is featured when grouped.

IosAlertNode

AttributeData typeDescription
title (optional)stringTitle of notification
subtitle (optional)stringSubtitle of notification
body (optional)stringMessage of notification

Action

AttributeData typeDescription
type (required)stringType of action to perform
name (optional)stringName of action to display on notification
value (required)JSONnodeParameters of action

AndroidPushPayload

AttributeData typeDescription
alert (optional)AndroidAlertNode – modelAndroid push contents
Data (optional)modelMap of key value pairs as data content

AndroidAlertNode

AttributeData typeDescription
subject (optional)stringSubject of notification
message (optional)stringMessage of notification
notification-action (optional)modelAction 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
        }
      }
    }
  }
 }