Create

Prev Next
Post
/create/campaign

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.

Body parameters
Android
{
  "apptoken": "YOUR_APP_TOKEN",
  "title": "First Android Test",
  "android_push": 1,
  "encryption": "0",
  "broadcast": 1,
  "push_title": "First Android Test",
  "push_text": "Testing Android Ping!",
  "push_picture_type": "url",
  "push_picture": "https://example.com/image.png"
}
iOS
{
  "apptoken": "YOUR_APPTOKEN",
  "title": "First iOS Test",
  "ios_push": 1,
  "ios_push_sandbox": 1,
  "broadcast": 1,
  "push_text": "Testing iOS Ping!"
}
iOS with payload
{
  "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
{
  "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
{
  "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 (same URL)
{
  "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"
    }
  }
}
Multi-language (different URL)
{
  "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
{
  "apptoken": "YOUR_APP_TOKEN",
  "title": "Email Example via API",
  "email": 1,
  "broadcast": 1,
  "encryption": 0,
  "messages": {
    "7": {
      "email_from_address": "info@example.com",
      "email_from_name": "Info",
      "email_subject": "Hi {{first_name}}, check out our sample API email test",
      "email_unsubscribe": 0,
      "email_type": 1,
      "email_template": 1,
      "email_html": "YOUR FULLY RESPONSIVE EMAIL HTML"
    }
  }
}
SMS
{
  "apptoken": "YOURAPPTOKEN",
  "title": "SMS Example via API",
  "sms": 1,
  "broadcast": 1,
  "messages": {
    "9": {
      "sms": {
        "from": "xtremepush",
        "text": "{{first_name}}, check out our SMS API test"
      }
    }
  }
}
object
apptoken
string Required

Your App token

title
string Required

The title of your campaign

trigger
integer (int32)

The type of campaign to create. Parameter options: 0 - Scheduled campaign (default value) 1 - Geo / iBeacon triggered campaign 2 - Event triggered campaign 3 - Api triggered campaign

category_id
integer (int32)

The ID of the engagement category that you want to link to the campaign. A project's configuration may require this parameter to be set.

target_applications
integer (int32)

The ID or IDs of the app or site that you want to target. This option needs to be enabled beforehand from Settings > Engagement rules and categories.

email
boolean

Enable email message channel. Default to 0 (off)

sms
boolean

Enable sms message channel. Default to 0 (off)

android_push
boolean

Enable push message channel on Android. Default to 0 (off)

ios_push
boolean

Enable push message channel on iOS. Default to 0 (off)

ios_push_production
boolean

Enable push message channel for iOS production builds. Default to 0 (off)

ios_push_sandbox
boolean

Enable push message channel for iOS dev builds. Default to 0 (off)

web_push
boolean

Enable web push message channel. Default to 0 (off)

web_push_chrome
boolean

Enable web push messaging for Chrome and Opera. Default to 0 (off)

web_push_firefox
boolean

Enable web push messaging for Firefox. Default to 0 (off)

web_push_safari
boolean

Enable web push messaging for Safari. Default to 0 (off)

inbox
boolean

Enable inbox message channel. Default to 0 (off)

webhook
string

Enable webhook message channel. Default to 0 (off)

encryption
integer (int32)

Only applicable — and required to be 1 or 2 — if your project has the encryption feature enabled, and the campaign has the android_push or ios_push channels enabled. Parameter options: 0 - Turned off (default value) 1 - Use where possible 2 - Enforce encryption

Responses
200

200

Result
{
  "success": true,
  "code": 200,
  "message": "Campaign is successfully created",
  "model": {
    "id": 58943956,
    "project_id": "PROJECT_ID",
    "type": 1,
    "trigger": 0,
    "send_type": 0,
    "active": 1,
    "sending": 0,
    "draft": 0,
    "status": 0,
    "is_open": 0,
    "title": "API example",
    "ab": 0,
    "languages_multi": 0,
    "content_fetch": 0,
    "encryption": 0,
    "ios_push": 0,
    "ios_push_production": 0,
    "ios_push_sandbox": 0,
    "ios_push_legacy": 0,
    "android_push": 1,
    "android_push_production": 1,
    "android_push_legacy": 0,
    "web_push": 1,
    "web_push_safari": 0,
    "web_push_chrome": 1,
    "web_push_firefox": 1,
    "inbox": 0,
    "inbox_only": 0,
    "inbox_same": 0,
    "inbox_addressable": 0,
    "inapp": 0,
    "inapp_ios": 0,
    "inapp_android": 0,
    "onsite": 0,
    "email": 1,
    "email_addressable": 0,
    "sms": 0,
    "webhook_addressable": 0,
    "broadcast": 0,
    "conversions": 0,
    "retry_for": 4,
    "retry_for_period": "weeks",
    "activate_time": 1779457650,
    "last_modified": 1779457650,
    "redemptions": 0,
    "automatically_pick_winner": 0,
    "automatically_pick_winner_sample_percentage": 100,
    "throttling": 0,
    "create_time": 1779457650,
    "custom_variant_share": 0,
    "early_cancel_event_filter": 0,
    "target_authorised_devices": 0,
    "voucher_codes_enabled": 0,
    "consent_preference": 0,
    "qualification": 0,
    "enter_journey_once_ever": 0,
    "enter_journey_once_at_a_time": 0,
    "mxa_migration": 0,
    "new_mxa": 0,
    "prioritise_rcs": 0,
    "messages": {
      "2": {
        "language": "",
        "push_title": "Android push title",
        "push_text": "Android push text"
      },
      "3": {
        "language": "",
        "push_title": "Webpush title",
        "push_text": "Webpush text",
        "push_action": {
          "action": "url",
          "url": "https://example.com/"
        }
      },
      "7": {
        "email_type": 1,
        "email_html": "

Tests

", "email_subject": "Hi {{first_name}}, check out our sample API email test", "email_from_name": "María", "email_from_address": "info@example.com", "email_unsubscribe": 0, "twig": 1 } } } }
Expand All
object
success
boolean
Defaulttrue
Exampletrue
code
integer
Default0
Example200
message
string
ExampleCampaign is successfully created
model
object
id
integer
Example58943956
title
string
active
integer
Example1
400

400

Result
{
  "success": false,
  "code": 400,
  "message": "Campaign is not created"
}
Expand All
object
success
boolean
Defaulttrue
Examplefalse
code
integer
Default0
Example400
message
string
ExampleCampaign is not created
errors
object
title
Array of string
string