Skip to content
Wire2AirWire2Air

Campaigns

List, read, create, edit and delete Text2Join and Developer API campaigns with the REST API v1.

Last updated

A campaign ties a keyword on one of your short codes to what happens when someone texts it: a Text2Join list, a Developer API callback, a survey and so on. Every campaign type can be listed and read; only Text2Join and Developer API campaigns can be created, edited and deleted through the API.

MethodPathDoes
GET/campaignList campaigns
GET/campaign/{ID}Get a campaign
POST/campaignCreate a campaign
POST/campaign/{ID}Edit a campaign
DELETE/campaign/{ID}Delete a campaign

The campaign object

FieldExampleMeaning
ID234553234The campaign's unique ID.
CampaignTypeText2JoinOne of Text2Join, Email2Text, Text2Email, AutoResponder, TextSurvey, TextVoting.
CampaignNameWeekly Coupon ClubYour name for the campaign.
Shortcode27126The number people text.
KeywordThe campaign keyword.
AutoResponseText2Join only: the automatic reply.
ProcessorURLDeveloper API only: the URL that receives incoming messages.
SubscribersCount0Number of subscribers (contacts) on the list.

Responses also include HelpResponse, OptOutResponse, StickySession, ForwardEmail, ForwardMobile, Description, Action and URI; see the parameters under create a campaign.

List campaigns

GEThttps://msgapi.wire2air.com/rest/v1/campaign
Credential
REST API key, sent in the apikey header
Response
JSON, paginated
Parameters
ParameterDescription
PageNo
integeroptional
in query
The results page to return.
Default: 1
PageSize
integeroptional
in query
Results per page.
Default: 10
curl -G "https://msgapi.wire2air.com/rest/v1/campaign" \
  -H "apikey: YOUR_API_KEY" \
  --data-urlencode "PageNo=1" \
  --data-urlencode "PageSize=10"
200 OK
{
  "PageNo": 1,
  "PageSize": 10,
  "TotalPages": 12.0,
  "TotalRecords": 118,
  "RowStart": 1,
  "RowEnd": 10,
  "ListItems": [
    {
      "CampaignId": 9999999,
      "CampaignType": "Email2Text",
      "CampaignName": "demo@wire2air.com",
      "Shortcode": "",
      "Keyword": "",
      "AutoResponse": "",
      "ProcessorURL": "",
      "HelpResponse": "mZone  Text Service. std msg charges apply.",
      "OptOutResponse": "You have successfully opted out from  Text service and will not receive any messages. std msg charges apply.",
      "StickySession": null,
      "Action": "",
      "ForwardEmail": "",
      "ForwardMobile": "",
      "Description": "",
      "SubscribersCount": 0,
      "URI": "v1/campaign/9999999",
      "ID": "9999999"
    }
  ]
}

Get a campaign

GEThttps://msgapi.wire2air.com/rest/v1/campaign/{ID}
Credential
REST API key, sent in the apikey header
Response
JSON

Takes no parameters besides the ID in the path. Returns one campaign object, the same as one item of ListItems above.

curl "https://msgapi.wire2air.com/rest/v1/campaign/CAMPAIGN_ID" \
  -H "apikey: YOUR_API_KEY"

Create a campaign

POSThttps://msgapi.wire2air.com/rest/v1/campaign
Credential
REST API key, sent in the apikey header
Response
JSON

Only Text2Join and DeveloperAPI campaigns can be created.

Parameters
ParameterDescription
CampaignType
stringrequired
in body
Text2Join or DeveloperAPI.
Example: Text2Join
Shortcode
stringrequired
in body
The short code Wire2Air assigned to your account.
Example: 27126
Keyword
stringoptional
in body
The keyword people text. Required for DeveloperAPI campaigns; marked optional for Text2Join.
Example: coupon
CampaignName
stringrequired
in body
Your name for the campaign.
Example: Weekly coupons
HelpResponse
stringoptional
in body
Automatic reply to the HELP command. URL-encoded; any UTF-8 characters (see encoding).
OptOutResponse
stringoptional
in body
Automatic reply to the STOP command. URL-encoded; any UTF-8 characters.
ForwardEmail
stringoptional
in body
Text2Join only: email address notified of each new lead.
ForwardMobile
stringoptional
in body
Text2Join only: mobile number, in international format, that gets an SMS for each new lead.
Example: 12123005984
ProcessorURL
stringoptional
in body
Required for DeveloperAPI campaigns: the URL that receives incoming messages. See webhooks.
Example: https://example.com/wire2air/inbound
StickySession
integeroptional
in body
DeveloperAPI only. 1: after someone texts the keyword, their later messages reach your ProcessorURL without the keyword. Inactive sessions stay valid for 72 hours. 0: off.
Example: 1
curl "https://msgapi.wire2air.com/rest/v1/campaign" \
  -H "apikey: YOUR_API_KEY" \
  --data-urlencode "CampaignType=Text2Join" \
  --data-urlencode "Keyword=coupon" \
  --data-urlencode "Shortcode=27126" \
  --data-urlencode "CampaignName=Weekly coupon deal" \
  --data-urlencode "HelpResponse=Weekly Coupon Deal. Reply STOP to cancel. Msg&Data rates may apply." \
  --data-urlencode "OptOutResponse=You have been removed from the Weekly Coupon Deal list. Msg&Data rates may apply."

Edit a campaign

POSThttps://msgapi.wire2air.com/rest/v1/campaign/{ID}
Credential
REST API key, sent in the apikey header
Response
JSON

Edit uses POST (not PUT) to the campaign's URL, with the same parameters as create. Only Text2Join and DeveloperAPI campaigns can be edited.

curl "https://msgapi.wire2air.com/rest/v1/campaign/CAMPAIGN_ID" \
  -H "apikey: YOUR_API_KEY" \
  --data-urlencode "CampaignType=DeveloperAPI" \
  --data-urlencode "Keyword=orders" \
  --data-urlencode "Shortcode=27126" \
  --data-urlencode "CampaignName=Order updates" \
  --data-urlencode "ProcessorURL=https://example.com/wire2air/inbound" \
  --data-urlencode "StickySession=1"

Delete a campaign

DELETEhttps://msgapi.wire2air.com/rest/v1/campaign/{ID}
Credential
REST API key, sent in the apikey header
Response
JSON

Only Text2Join and DeveloperAPI campaigns can be deleted.

curl -X DELETE "https://msgapi.wire2air.com/rest/v1/campaign/CAMPAIGN_ID" \
  -H "apikey: YOUR_API_KEY"