Push delivery working example

The following example shows how to create an XML instructions file for a Push delivery.

Overview

You can use Contactsend to send Push notifications to applications installed on iOS or Android devices. To send a Push notification to a device, you need:

  • The device token that is created when the application is installed on the device
  • The certificate that identifies the application in the App Store

Before sending a Push notification using Contactsend, you should:

  • Register the application and its certificates with Contactsend
  • Collect the device tokens when end-users install the mobile application

XMLDelivery is just one of the solutions provided by Contactlab that you can use to send Push notifications. See Does XMLDelivery match your needs? for more details.

Note:

See the Contactlab Developer Site for a sample application that collects device tokens for mobile applications.

Recipients

A recipient or a test_recipient is identified by adding three fields:

  • The device token

    <PUSH> is the field name used in the example.

  • The endpoint type

    <PUSH_ENDPOINT> is the field name used in the example.

  • The mobile application name as registered with Contactsend

    <APP_NAME> is the field name used in the example.

Note:

The field names described above and used in the example are for illustration purposes only. The actual field names must be selected from and match those used in the database. However, field name matching is not case sensitive, for example, you can use Name or name.

Endpoint types

You can use the following endpoint types:

  • APN

    Apple Push Notification for Apple devices.

  • GCM

    Google Cloud Messages for Android devices.

See Related Pages below for links to the topics that describe each tag.

    <?xml version=1.0 encoding=utf-8?>
    <contactlab
    xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
    xsi:noNamespaceSchemaLocation=contactlab.xsd>
        <auth>
            <suid>*********</suid>
            <key>**************</key>
        </auth>
        <campaign>
            <push>
                <newsletter>11199</newsletter>
                <recipients>
                    <retry />
                    <new_recipients>
                        <recipient>
                            <PUSH>APA91bEmeADR-bKemhPberuJhjT25Z0EAd8kkwmoUblTlYk4pSwA98Wj31ki-
                            uv3kMcghaN9U0KlyQDvh-_7Wy8VliolTONwNkW6njRqjMhQnCv4K5wsPgm5KGF5Elp2y8_
                            sEoKRNAJToEBGLIo0HMND9aj7QFQtHsrmg</PUSH>
                            <PUSH_ENDPOINT>GCM</PUSH_ENDPOINT>
                            <APP_NAME>YourAppleAppName</APP_NAME>
                        </recipient>
                        <recipient>
                            <PUSH>aaa8cca5c9c3ef1b4d1787183f6ba0035fc93e067948140f59df54579451dac</PUSH>
                            <PUSH_ENDPOINT>APN</PUSH_ENDPOINT>
                            <APP_NAME>YourGoogleAppName</APP_NAME>
                        </recipient>
                        …..
                    </new_recipients>
                </recipients>
                <delivery method=auto>
                </delivery>
                <message>
                    <subject>xmld2 BOMB push test</subject>
                    <push_endpoints>
                        <apn><![CDATA[
                        {
                        “aps”:{
                              “alert”:{
                                 “body”:”Hello ${MyAppleApp}$”,
                                 “title”:”Date: <%= Time.now.strftime(‘%Y-%m-%dT%T’) %>”
                              }
                           }
                        }
                        ]]></apn>
                        <gcm>![CDATA[
                        {
                        “notification”:{
                              “icon”:”ic_notification”,
                              “body”:””Hello ${MyGoogleApp}$”,
                              “title”:”Date: <%= Time.now.strftime(%Y-%m-%dT%T) %>“,
                              “click_action”:”com.contactlab.clabpush_android_sample.OPEN_MAIN_ACTIVITY”
                           }
                        }
                         ]]></gcm>
                    </push_endpoints>
                </message>
            </push>
        </campaign>
    </contactlab>

See the Web UI for more about creating a <push_template_envelope>.

Next page:

Example of an XML report


Also see:

Other links: