« Back to Documentation Overviewadd_campaign
Section: Campaigns
Version: 1.5.0
Add campaign to account.
Conditions
- `name` (mandatory) – Value of name must be composed of lowercase letters, digits and underscores only.
- `description` (optional) – User friendly name of campaign.
- `from_field` (mandatory) – `FROM_FIELD_ID` obtained from get_account_from_fields. It is default From header (name and email) in messages sent from this campaign.
- `reply_to_field` (mandatory) – `FROM_FIELD_ID` obtained from get_account_from_fields.
- `confirmation_subject` (mandatory) – `CONFIRMATION_SUBJECT_ID` obtained from get_confirmation_subjects. Used in confirmation messages sent from this campaign if double-optin is set for given subscription method.
- `confirmation_body` (mandatory) – `CONFIRMATION_BODY_ID` obtained from get_confirmation_bodies. Used in confirmation messages sent from this campaign if double-optin is set for given subscription method.
- `language_code` (optional) – Language of subscription reminder and change details / unsubscribe footer. List of available ISO 639-1 (2-letter) codes is available here: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes. If we don’t have version in requested language then English version will be used.
Warning: Account has limit of 500 campaigns.
Warning: Campaign added through API will be visible on web interface after next log-in.
Parameters
|
---|
string | API_KEY |
object | string | name | my_new_campaign | string | description | My new campaign | string | from_field | FROM_FIELD_ID | string | reply_to_field | FROM_FIELD_ID | string | confirmation_subject | CONFIRMATION_SUBJECT_ID | string | confirmation_body | CONFIRMATION_BODY_ID | string | language_code | PL |
|
Return Value
|
---|
string | CAMPAIGN_ID | abc123 |
integer | added | 1 |
Example Request JSON
[
"API_KEY",
{
"name": "my_new_campaign",
"description": "My new campaign",
"from_field": "FROM_FIELD_ID",
"reply_to_field": "FROM_FIELD_ID",
"confirmation_subject": "CONFIRMATION_SUBJECT_ID",
"confirmation_body": "CONFIRMATION_BODY_ID",
"language_code": "PL"
}
]
Example Response JSON
{
"CAMPAIGN_ID": "abc123",
"added": 1
}
Example Error Response JSON
{
"code": -1,
"message": "Invalid language code"
}
Method-specific Errors
|
---|
Total limit of campaigns exceeded |
Invalid email syntax |
Name already taken |
Missing From field |
Missing Reply-To field |
Missing confirmation subject |
Missing confirmation body |
Invalid language code |
API-wide Errors
|
---|
API key verification failed
| API key verification failed |
API client IP not allowed
| API client IP not allowed |
Invalid params
| Attribute params must be reference to hash |