Adding a campaign
Overview
- Call name: add-campaign
- Endpoint URL: https://api0.spaaza.com/internal/add-campaign
- Request methods: Form POST or JSON POST
- Auth required: yes
This API call creates a new campaign. Campaigns are a generic mechanism for doing time based discounting and personal pricing actions. There are multiple types of campaigns.
HTTP Parameters
The following HTTP parameters can be passed to the API:
business_id or chain_id (mandatory, not both) the ID of the business or chain (entity) which the campaign is to be associated with.
type (mandatory) A string which indicates the campaign type. The following types are allowed:
basket
birthday
cashback
competition
content
interaction
item_purchase_count
login
loyalty
matching_item
mobile_content
points_wallet
product
profile_completion
progress
purchase_count
referral
signup
subscription
wallet
Different campaign types in Spaaza require different parameters to be passed. For a detailed breakdown of campaign types and fields see this page
Permissions
The performing user needs to be logged in and have write access to the entity (business or chain) to which the campaign is connected and the user must have permissions_business_chain_campaign set to true in the permissions table.
Output
Returns an OK code and a JSON representation of the newly created campaign. Note that it includes an empty rules
field which will hold information about each rule that is part of this campaign. To add rules, use :ref:add-campaign-rule
after adding a campaign.
Returns an OK code and a JSON representation of the newly created campaign. A sample is below:
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"campaign": {
"id": 2,
"chain_id": 1,
"title": "ACME Login Campaign",
"description": "€10 reward for logging into our app for the first time",
"active": true,
"active_time_from": "12:13",
"active_time_until": "13:14",
"active_weekdays": "7",
"operator_type": "or",
"created_date": "2021-04-02T11:58:15+00:00",
"last_modified_date": "2021-04-02T11:58:15+00:00",
"rounding_strategy": "neutral",
"rounding_precision": 2,
"created_voucher_claimed_by_default": false,
"voucher_expiry_days": 365,
"excludes_assignment_matches": false,
"recipient_reward_method": "voucher",
"recipient_reward_amount": 5,
"recipient_reward_discount_ratio": 0,
"user_channel": "mobile:ios",
"currency": {
"currency_id": 2,
"currency_code": "EUR",
"currency_name_en": "Euro",
"currency_symbol": "\u20ac"
},
"is_active": false,
"is_deleted": false,
"is_default": false,
"excludes_referred_users": false,
"visible_to_all_user_segments": true,
"type": "login",
"minimum_basket_total_value": 0,
"last_updated_date": null,
"field_localisations": null,
"assignment_count": 0,
"parameters": [],
"image_filename": null,
"image_url": null,
"image_link": null,
"image_dimension_x": null,
"image_dimension_y": null,
"supports_contribution": false,
"is_contributor": false,
"recipient_campaign_id": null,
"supports_user_segments": true,
"user_segment_id": null,
"excluded_user_segment_id": null,
"voucher_title": null,
"voucher_description": null,
"voucher_notes": null,
"voucher_text": null,
"voucher_image_url": null
},
"result_type": "add-campaign"
}
}