Used to create an automated campaign or create a campaign to be dispatched immediately with the send API method.

To review the parameters supported in the create method see the campaign model properties dedicated guide.

Examples

Android

Android send now broadcast campaign:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken":"YOUR_APPTOKEN",
    "title": "First Android Test",
    "android_push": 1,
    "broadcast": 1,
    "push_title": "First Android Test",
    "push_text": "Testing Android Ping!"
  }'

iOS

iOS send now broadcast campaign:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "title": "First iOS Test",
    "ios_push": 1,
    "ios_push_sandbox": 1,
    "broadcast": 1,
    "push_text": "Testing iOS Ping!"
  }'

An iOS send now campaign with a payload, and an attribute is equal to on condition attached.

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "title": "El Classico",
    "ios_push": 1,
    "ios_push_sandbox": 1,
    "push_text": "1-0! Messi scores.",
    "payload_add": [
      {
        "key": "score",
        "value": "1-0"
      }
    ],
    "conditions": {
      "operator": "AND",
      "0": {
        "operator": "AND",
        "0": [
          "tags_attribute",
          "=",
          "live_scores",
          [
            "value",
            "=",
            "on"
          ]
        ]
      }
    }
  }'

Web push

A web push campaign with an inbox message:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
      "apptoken": "YOUR_APPTOKEN", 
    "title": "El Classico", 
    "web_push": 1, 
    "web_push_chrome": 1, 
    "web_push_firefox": 1, 
    "inbox": 1, 
    "messages": {
      "3": {
        "push_title": "El Classico", 
        "push_text": "1-0! Messi scores.", 
        "url": "https://mywesbite.com/destination.html?from=push"
      },
      "6": {
        "inbox_type": "1", 
        "push_title": "El Classico", 
        "push_text": "60\" - Messi scores. 1-0", 
        "url": "https://mywesbite.com/destination.html?from=inbox"
      }
    }
  }'

Webhook

A webhook campaign using an SMS provider platform:

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APP_TOKEN",
    "title": "webhookSmsExample",
    "webhook": 1,
    "broadcast": 1,
    "messages": {
      "8": {
        "webhook": {
          "url": "https://api.thirdparty.example.com/api/v2/json",
          "get_params": [
            {
              "key": "text",
              "value": "The quick brown fox jumped over the lazy dog."
            },
            {
              "key": "value",
              "value": "12345"
            },
            {
              "key": "api_secret",
              "value": "THIRD_PARTY_SECRET"
            },
            {
              "key": "api_key",
              "value": "API_KEY"
            }
          ],
          "request_body_type": "raw",
          "request_body_data": {
            "raw": "",
            "post": "",
            "json": ""
          },
          "request_headers":""
        }
      }
    }
  }'

Multi-language

Post data using the same URL for different languages

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{ 
    "apptoken": "APP_TOKEN",
    "title": "Inbox Multilanguage with same URL",
    "inbox": 1,
    "languages_multi": 1,
    "languages_list": ["en", "ru"],
    "languages_default": "en",
    "messages": { 
      "6": { 
        "push_title_languages": {
          "en": "Test",
          "ru": "Тест"
        },
        "push_text_languages": {
          "en": "Hello",
          "ru": "Привет"
        },
        "url": "https://website-local.xtremepush.com?lang=common"
      }
    }
  }'

Post data for using a different URL per language

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{ 
    "apptoken": "APP_TOKEN",
    "title": "Inbox Multilanguage with diff URL",
    "inbox": 1,
    "languages_multi": 1,
    "languages_list": ["en", "ru"],
    "languages_default": "en",
    "messages": {
      "6": {
        "push_title_languages": {
          "en": "Test",
          "ru": "Тест"
        },
        "push_text_languages": {
          "en": "Hello",
          "ru": "Привет"
        },
        "url_languages": {
          "en": "https://website-local.xtremepush.com?lang=en",
          "ru": "https://website-local.xtremepush.com?lang=ru"
        }
      }
    }
  }'

Email content

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOURAPPTOKEN",
    "title": "Email Example via API", 
    "email": 1,
    "broadcast": 1,
    "messages": {
      "7": { 
        "email_address_id": xxx,
        "email_subject": "Hi {{first_name}}, check out our sample API email test",
        "email_unsubscribe": 0,
        "email_text": "[Image]\n\nEditor 2.0 now available\n\nThe New Drag and Drop Editor is Here!\n\nOur amazing email editor with built in responsive design has now become even better, giving you full control over rows and columns\n\n[Image]",
        "email_type":1, 
        "email_template": 1,
        "email_html":"YOUR FULLY RESPONSIVE EMAIL HTML"
      }
    }
  }'

SMS

In this example "broadcast":1 is used to target your entire available user base, conditions that target a subsection of your audience, and scheduling and other options can be added as described in the general overview of campaign methods. In this example a personalisation tag has been added in the SMS text to pull in the users' first names.

curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOURAPPTOKEN",
    "title": "Email Example via API", 
    "sms": 1,
    "broadcast": 1,
    "messages": { 
      "9": {
        "sms": {
          "from": "xtremepush",
          "text": "{{first_name}}, check out our SMS API test"
        }
      }
    }
  }'
Language
Click Try It! to start a request and see the response here!