import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const campaigns = await client.campaign.list({ brandId: 'brandId' });
console.log(campaigns.page);{
"records": [
{
"ageGated": true,
"autoRenewal": true,
"billedDate": "<string>",
"brandId": "d2ca9d69-641b-4131-83fa-5d0744f4c8a9",
"brandDisplayName": "ABC Mobile",
"campaignId": "823d6b1a-6ed6-41a3-9c50-c8ff41b682ba",
"tcrBrandId": "BBRAND1",
"tcrCampaignId": "CCAMP1",
"createDate": "<string>",
"cspId": "<string>",
"description": "<string>",
"directLending": true,
"embeddedLink": true,
"embeddedPhone": true,
"helpKeywords": "<string>",
"helpMessage": "<string>",
"messageFlow": "<string>",
"mock": true,
"nextRenewalOrExpirationDate": "<string>",
"numberPool": true,
"optinKeywords": "<string>",
"optinMessage": "<string>",
"optoutKeywords": "<string>",
"optoutMessage": "<string>",
"referenceId": "<string>",
"resellerId": "<string>",
"sample1": "<string>",
"sample2": "<string>",
"sample3": "<string>",
"sample4": "<string>",
"sample5": "<string>",
"status": "<string>",
"subUsecases": [
"<string>"
],
"subscriberHelp": true,
"subscriberOptin": true,
"subscriberOptout": true,
"termsAndConditions": true,
"usecase": "<string>",
"vertical": "<string>",
"webhookURL": "https://example.com/webhook",
"webhookFailoverURL": "https://example.com/failover-webhook",
"isTMobileRegistered": true,
"isTMobileSuspended": true,
"isTMobileNumberPoolingEnabled": true,
"failureReasons": "<string>",
"submissionStatus": "CREATED",
"campaignStatus": "TCR_ACCEPTED",
"privacyPolicyLink": "<string>",
"termsAndConditionsLink": "<string>",
"embeddedLinkSample": "<string>",
"assignedPhoneNumbersCount": 3
}
],
"page": 123,
"totalRecords": 123
}Retrieve a list of campaigns associated with a supplied brandId.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const campaigns = await client.campaign.list({ brandId: 'brandId' });
console.log(campaigns.page);{
"records": [
{
"ageGated": true,
"autoRenewal": true,
"billedDate": "<string>",
"brandId": "d2ca9d69-641b-4131-83fa-5d0744f4c8a9",
"brandDisplayName": "ABC Mobile",
"campaignId": "823d6b1a-6ed6-41a3-9c50-c8ff41b682ba",
"tcrBrandId": "BBRAND1",
"tcrCampaignId": "CCAMP1",
"createDate": "<string>",
"cspId": "<string>",
"description": "<string>",
"directLending": true,
"embeddedLink": true,
"embeddedPhone": true,
"helpKeywords": "<string>",
"helpMessage": "<string>",
"messageFlow": "<string>",
"mock": true,
"nextRenewalOrExpirationDate": "<string>",
"numberPool": true,
"optinKeywords": "<string>",
"optinMessage": "<string>",
"optoutKeywords": "<string>",
"optoutMessage": "<string>",
"referenceId": "<string>",
"resellerId": "<string>",
"sample1": "<string>",
"sample2": "<string>",
"sample3": "<string>",
"sample4": "<string>",
"sample5": "<string>",
"status": "<string>",
"subUsecases": [
"<string>"
],
"subscriberHelp": true,
"subscriberOptin": true,
"subscriberOptout": true,
"termsAndConditions": true,
"usecase": "<string>",
"vertical": "<string>",
"webhookURL": "https://example.com/webhook",
"webhookFailoverURL": "https://example.com/failover-webhook",
"isTMobileRegistered": true,
"isTMobileSuspended": true,
"isTMobileNumberPoolingEnabled": true,
"failureReasons": "<string>",
"submissionStatus": "CREATED",
"campaignStatus": "TCR_ACCEPTED",
"privacyPolicyLink": "<string>",
"termsAndConditionsLink": "<string>",
"embeddedLinkSample": "<string>",
"assignedPhoneNumbersCount": 3
}
],
"page": 123,
"totalRecords": 123
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The 1-indexed page number to get. The default value is 1.
The 1-indexed page number to get. The default value is 1.
The amount of records per page, limited to between 1 and 500 inclusive. The default value is 10.
The amount of records per page, limited to between 1 and 500 inclusive. The default value is 10.
Specifies the sort order for results. If not given, results are sorted by createdAt in descending order. Specifies the sort order for results. If not given, results are sorted by created_at in descending order.
assignedPhoneNumbersCount, -assignedPhoneNumbersCount, campaignId, -campaignId, createdAt, -createdAt, status, -status, tcrCampaignId, -tcrCampaignId Successful Response
Show child attributes
Age gated content in campaign.
Campaign subscription auto-renewal status.
Campaign recent billed date.
Unique identifier assigned to the brand.
"d2ca9d69-641b-4131-83fa-5d0744f4c8a9"
Display or marketing name of the brand.
"ABC Mobile"
Unique identifier for a campaign.
"823d6b1a-6ed6-41a3-9c50-c8ff41b682ba"
Unique identifier assigned to the brand by the registry.
"BBRAND1"
Unique identifier assigned to the campaign by the registry.
"CCAMP1"
Unix timestamp when campaign was created.
Alphanumeric identifier of the CSP associated with this campaign.
Summary description of this campaign.
Does message generated by the campaign include URL link in SMS?
Does message generated by the campaign include phone number in SMS?
Subscriber help keywords. Multiple keywords are comma separated without space.
Help message of the campaign.
Message flow description.
Campaign created from mock brand. Mocked campaign cannot be shared with an upstream CNP.
When the campaign would be due for its next renew/bill date.
Does campaign utilize pool of phone numbers?
Subscriber opt-in keywords. Multiple keywords are comma separated without space.
Subscriber opt-in message.
Subscriber opt-out keywords. Multiple keywords are comma separated without space.
Subscriber opt-out message.
Caller supplied campaign reference ID. If supplied, the value must be unique across all submitted campaigns. Can be used to prevent duplicate campaign registrations.
Alphanumeric identifier of the reseller that you want to associate with this campaign.
Message sample. Some campaign tiers require 1 or more message samples.
Message sample. Some campaign tiers require 2 or more message samples.
Message sample. Some campaign tiers require 3 or more message samples.
Message sample. Some campaign tiers require 4 or more message samples.
Message sample. Some campaign tiers require 5 or more message samples.
Current campaign status. Possible values: ACTIVE, EXPIRED. A newly created campaign defaults to ACTIVE status.
Campaign sub-usecases. Must be of defined valid sub-usecase types. Use /registry/enum/usecase operation to retrieve list of valid sub-usecases
Does campaign responds to help keyword(s)?
Does campaign require subscriber to opt-in before SMS is sent to subscriber?
Does campaign support subscriber opt-out keyword(s)?
Is terms & conditions accepted?
Campaign usecase. Must be of defined valid types. Use /registry/enum/usecase operation to retrieve usecases available for given brand.
Business/industry segment of this campaign (Deprecated). Must be of defined valid types. Use /registry/enum/vertical operation to retrieve verticals available for given brand, vertical combination.
This field is deprecated.
Webhook to which campaign status updates are sent.
"https://example.com/webhook"
Failover webhook to which campaign status updates are sent.
"https://example.com/failover-webhook"
Indicates whether the campaign is registered with T-Mobile.
Indicates whether the campaign is suspended with T-Mobile.
Indicates whether the campaign has a T-Mobile number pool ID associated with it.
Failure reasons if campaign submission failed
Campaign submission status
CREATED, FAILED, PENDING Campaign status
TCR_PENDING, TCR_SUSPENDED, TCR_EXPIRED, TCR_ACCEPTED, TCR_FAILED, TELNYX_ACCEPTED, TELNYX_FAILED, MNO_PENDING, MNO_ACCEPTED, MNO_REJECTED, MNO_PROVISIONED, MNO_PROVISIONING_FAILED "TCR_ACCEPTED"
Link to the campaign's privacy policy.
Link to the campaign's terms and conditions.
Sample of an embedded link that will be sent to subscribers.
Number of phone numbers associated with the campaign
3
Was this page helpful?