Create a campaign
Creates a campaign on a Website, SMS, Twilio SMS or WhatsApp inbox; any other inbox type is rejected. You do not choose the campaign type — a website inbox produces an ongoing campaign and its scheduled_at is cleared, while the three messaging inboxes produce a one_off campaign scheduled for now unless you give a time.
curl --request POST \
--url https://app.tied.com/api/v1/accounts/{account_id}/campaigns \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"campaign": {
"title": "Docs launch announcement",
"description": "Points web chat visitors on the pricing page at the new API reference.",
"message": "Our API reference just doubled in size. Want the link?",
"inbox_id": 4,
"enabled": true,
"trigger_only_during_business_hours": false,
"trigger_rules": {
"url": "https://tied.com/pricing",
"time_on_page": 20
}
}
}
'import requests
url = "https://app.tied.com/api/v1/accounts/{account_id}/campaigns"
payload = { "campaign": {
"title": "Docs launch announcement",
"description": "Points web chat visitors on the pricing page at the new API reference.",
"message": "Our API reference just doubled in size. Want the link?",
"inbox_id": 4,
"enabled": True,
"trigger_only_during_business_hours": False,
"trigger_rules": {
"url": "https://tied.com/pricing",
"time_on_page": 20
}
} }
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
campaign: {
title: 'Docs launch announcement',
description: 'Points web chat visitors on the pricing page at the new API reference.',
message: 'Our API reference just doubled in size. Want the link?',
inbox_id: 4,
enabled: true,
trigger_only_during_business_hours: false,
trigger_rules: {url: 'https://tied.com/pricing', time_on_page: 20}
}
})
};
fetch('https://app.tied.com/api/v1/accounts/{account_id}/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://app.tied.com/api/v1/accounts/{account_id}/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaign\": {\n \"title\": \"Docs launch announcement\",\n \"description\": \"Points web chat visitors on the pricing page at the new API reference.\",\n \"message\": \"Our API reference just doubled in size. Want the link?\",\n \"inbox_id\": 4,\n \"enabled\": true,\n \"trigger_only_during_business_hours\": false,\n \"trigger_rules\": {\n \"url\": \"https://tied.com/pricing\",\n \"time_on_page\": 20\n }\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.tied.com/api/v1/accounts/{account_id}/campaigns"
payload := strings.NewReader("{\n \"campaign\": {\n \"title\": \"Docs launch announcement\",\n \"description\": \"Points web chat visitors on the pricing page at the new API reference.\",\n \"message\": \"Our API reference just doubled in size. Want the link?\",\n \"inbox_id\": 4,\n \"enabled\": true,\n \"trigger_only_during_business_hours\": false,\n \"trigger_rules\": {\n \"url\": \"https://tied.com/pricing\",\n \"time_on_page\": 20\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_access_token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": 4,
"title": "Docs launch announcement",
"description": "Points web chat visitors on the pricing page at the new API reference.",
"account_id": 1,
"inbox": {
"id": 4,
"avatar_url": "https://app.tied.com/rails/active_storage/blobs/proxy/EXAMPLE/tied-app-icon.png",
"channel_id": 1,
"name": "Webchat",
"channel_type": "Channel::WebWidget",
"greeting_enabled": false,
"greeting_message": null,
"working_hours_enabled": false,
"enable_email_collect": true,
"csat_survey_enabled": false,
"csat_config": {},
"enable_auto_assignment": true,
"auto_assignment_config": {},
"out_of_office_message": null,
"working_hours": [
{
"day_of_week": 0,
"closed_all_day": true,
"open_hour": null,
"open_minutes": null,
"close_hour": null,
"close_minutes": null,
"open_all_day": false
},
{
"day_of_week": 1,
"closed_all_day": false,
"open_hour": 9,
"open_minutes": 0,
"close_hour": 17,
"close_minutes": 0,
"open_all_day": false
}
],
"timezone": "UTC",
"callback_webhook_url": null,
"allow_messages_after_resolved": true,
"lock_to_single_conversation": false,
"sender_name_type": "friendly",
"business_name": null,
"allowed_domains": "",
"widget_color": "#FF073B",
"website_url": "https://tied.com",
"hmac_mandatory": false,
"welcome_title": null,
"welcome_tagline": null,
"web_widget_script": "\n <script>\n (function(d,t) {\n var BASE_URL=\"https://app.tied.com\";\n var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\n g.src=BASE_URL+\"/packs/js/sdk.js\";\n g.async = true;\n s.parentNode.inse…",
"website_token": "EXAMPLE_WEBSITE_TOKEN",
"selected_feature_flags": [
"attachments",
"emoji_picker"
],
"reply_time": "in_a_few_minutes",
"hmac_token": "EXAMPLE_HMAC_TOKEN",
"pre_chat_form_enabled": false,
"pre_chat_form_options": {
"pre_chat_fields": [
{
"name": "emailAddress",
"type": "email",
"label": "Email Id",
"enabled": false,
"required": true,
"field_type": "standard"
},
{
"name": "fullName",
"type": "text",
"label": "Full name",
"enabled": false,
"required": false,
"field_type": "standard"
}
],
"pre_chat_message": "Share your queries or comments here."
},
"continuity_via_email": true,
"messaging_service_sid": null,
"phone_number": null,
"provider": null
},
"message": "Our API reference just doubled in size. Want the link?",
"template_params": null,
"campaign_status": "active",
"enabled": true,
"campaign_type": "ongoing",
"trigger_rules": {
"url": "https://tied.com/pricing",
"time_on_page": 20
},
"trigger_only_during_business_hours": false,
"created_at": "2026-09-21T03:21:40.981Z",
"updated_at": "2026-09-21T03:21:40.981Z"
}{
"error": "Resource could not be found"
}{
"message": "Url has already been taken",
"attributes": [
"url"
]
}Authorizations
This token can be obtained by visiting the profile page or via rails console. Provides access to endpoints based on the user permissions levels. This token can be saved by an external system when user is created via API, to perform activities on behalf of the user.
Path Parameters
The numeric ID of the account
Body
The campaign to create or update.
Show child attributes
Show child attributes
Response
Success
The campaign's display_id. This is the value the campaign endpoints take in the path.
Internal name for the campaign.
Internal description. Not shown to contacts.
The account the campaign belongs to.
Show child attributes
Show child attributes
The message body sent to the contact.
WhatsApp template parameters, for campaigns on a WhatsApp inbox that send an approved template.
A one-off campaign becomes completed once it has been sent. A completed campaign cannot be updated.
active, completed Whether the campaign is live. An ongoing campaign with enabled: false stops triggering.
Derived from the inbox, never from the request. A website inbox always produces ongoing; an SMS, Twilio SMS or WhatsApp inbox always produces one_off.
ongoing, one_off Conditions for an ongoing campaign. url is the page the visitor must be on, and time_on_page the seconds to wait before sending.
Whether to suppress the campaign outside the inbox's configured business hours.
When a one-off campaign is due to send. Always null on an ongoing campaign — it is cleared on save.
ISO-8601 timestamp of creation.
ISO-8601 timestamp of the last update.
Was this page helpful?
curl --request POST \
--url https://app.tied.com/api/v1/accounts/{account_id}/campaigns \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"campaign": {
"title": "Docs launch announcement",
"description": "Points web chat visitors on the pricing page at the new API reference.",
"message": "Our API reference just doubled in size. Want the link?",
"inbox_id": 4,
"enabled": true,
"trigger_only_during_business_hours": false,
"trigger_rules": {
"url": "https://tied.com/pricing",
"time_on_page": 20
}
}
}
'import requests
url = "https://app.tied.com/api/v1/accounts/{account_id}/campaigns"
payload = { "campaign": {
"title": "Docs launch announcement",
"description": "Points web chat visitors on the pricing page at the new API reference.",
"message": "Our API reference just doubled in size. Want the link?",
"inbox_id": 4,
"enabled": True,
"trigger_only_during_business_hours": False,
"trigger_rules": {
"url": "https://tied.com/pricing",
"time_on_page": 20
}
} }
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
campaign: {
title: 'Docs launch announcement',
description: 'Points web chat visitors on the pricing page at the new API reference.',
message: 'Our API reference just doubled in size. Want the link?',
inbox_id: 4,
enabled: true,
trigger_only_during_business_hours: false,
trigger_rules: {url: 'https://tied.com/pricing', time_on_page: 20}
}
})
};
fetch('https://app.tied.com/api/v1/accounts/{account_id}/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://app.tied.com/api/v1/accounts/{account_id}/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaign\": {\n \"title\": \"Docs launch announcement\",\n \"description\": \"Points web chat visitors on the pricing page at the new API reference.\",\n \"message\": \"Our API reference just doubled in size. Want the link?\",\n \"inbox_id\": 4,\n \"enabled\": true,\n \"trigger_only_during_business_hours\": false,\n \"trigger_rules\": {\n \"url\": \"https://tied.com/pricing\",\n \"time_on_page\": 20\n }\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.tied.com/api/v1/accounts/{account_id}/campaigns"
payload := strings.NewReader("{\n \"campaign\": {\n \"title\": \"Docs launch announcement\",\n \"description\": \"Points web chat visitors on the pricing page at the new API reference.\",\n \"message\": \"Our API reference just doubled in size. Want the link?\",\n \"inbox_id\": 4,\n \"enabled\": true,\n \"trigger_only_during_business_hours\": false,\n \"trigger_rules\": {\n \"url\": \"https://tied.com/pricing\",\n \"time_on_page\": 20\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_access_token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": 4,
"title": "Docs launch announcement",
"description": "Points web chat visitors on the pricing page at the new API reference.",
"account_id": 1,
"inbox": {
"id": 4,
"avatar_url": "https://app.tied.com/rails/active_storage/blobs/proxy/EXAMPLE/tied-app-icon.png",
"channel_id": 1,
"name": "Webchat",
"channel_type": "Channel::WebWidget",
"greeting_enabled": false,
"greeting_message": null,
"working_hours_enabled": false,
"enable_email_collect": true,
"csat_survey_enabled": false,
"csat_config": {},
"enable_auto_assignment": true,
"auto_assignment_config": {},
"out_of_office_message": null,
"working_hours": [
{
"day_of_week": 0,
"closed_all_day": true,
"open_hour": null,
"open_minutes": null,
"close_hour": null,
"close_minutes": null,
"open_all_day": false
},
{
"day_of_week": 1,
"closed_all_day": false,
"open_hour": 9,
"open_minutes": 0,
"close_hour": 17,
"close_minutes": 0,
"open_all_day": false
}
],
"timezone": "UTC",
"callback_webhook_url": null,
"allow_messages_after_resolved": true,
"lock_to_single_conversation": false,
"sender_name_type": "friendly",
"business_name": null,
"allowed_domains": "",
"widget_color": "#FF073B",
"website_url": "https://tied.com",
"hmac_mandatory": false,
"welcome_title": null,
"welcome_tagline": null,
"web_widget_script": "\n <script>\n (function(d,t) {\n var BASE_URL=\"https://app.tied.com\";\n var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\n g.src=BASE_URL+\"/packs/js/sdk.js\";\n g.async = true;\n s.parentNode.inse…",
"website_token": "EXAMPLE_WEBSITE_TOKEN",
"selected_feature_flags": [
"attachments",
"emoji_picker"
],
"reply_time": "in_a_few_minutes",
"hmac_token": "EXAMPLE_HMAC_TOKEN",
"pre_chat_form_enabled": false,
"pre_chat_form_options": {
"pre_chat_fields": [
{
"name": "emailAddress",
"type": "email",
"label": "Email Id",
"enabled": false,
"required": true,
"field_type": "standard"
},
{
"name": "fullName",
"type": "text",
"label": "Full name",
"enabled": false,
"required": false,
"field_type": "standard"
}
],
"pre_chat_message": "Share your queries or comments here."
},
"continuity_via_email": true,
"messaging_service_sid": null,
"phone_number": null,
"provider": null
},
"message": "Our API reference just doubled in size. Want the link?",
"template_params": null,
"campaign_status": "active",
"enabled": true,
"campaign_type": "ongoing",
"trigger_rules": {
"url": "https://tied.com/pricing",
"time_on_page": 20
},
"trigger_only_during_business_hours": false,
"created_at": "2026-09-21T03:21:40.981Z",
"updated_at": "2026-09-21T03:21:40.981Z"
}{
"error": "Resource could not be found"
}{
"message": "Url has already been taken",
"attributes": [
"url"
]
}