Skip to content

Latest commit

 

History

History
606 lines (450 loc) · 22.9 KB

SMSCampaignsApi.md

File metadata and controls

606 lines (450 loc) · 22.9 KB

brevo_python.SMSCampaignsApi

All URIs are relative to https://api.brevo.com/v3

Method HTTP request Description
create_sms_campaign POST /smsCampaigns Creates an SMS campaign
delete_sms_campaign DELETE /smsCampaigns/{campaignId} Delete an SMS campaign
get_sms_campaign GET /smsCampaigns/{campaignId} Get an SMS campaign
get_sms_campaigns GET /smsCampaigns Returns the information for all your created SMS campaigns
request_sms_recipient_export POST /smsCampaigns/{campaignId}/exportRecipients Export an SMS campaign's recipients
send_sms_campaign_now POST /smsCampaigns/{campaignId}/sendNow Send your SMS campaign immediately
send_sms_report POST /smsCampaigns/{campaignId}/sendReport Send an SMS campaign's report
send_test_sms POST /smsCampaigns/{campaignId}/sendTest Send a test SMS campaign
update_sms_campaign PUT /smsCampaigns/{campaignId} Update an SMS campaign
update_sms_campaign_status PUT /smsCampaigns/{campaignId}/status Update a campaign's status

create_sms_campaign

CreateModel create_sms_campaign(create_sms_campaign)

Creates an SMS campaign

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
create_sms_campaign = brevo_python.CreateSmsCampaign() # CreateSmsCampaign | Values to create an SMS Campaign

try:
    # Creates an SMS campaign
    api_response = api_instance.create_sms_campaign(create_sms_campaign)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->create_sms_campaign: %s\n" % e)

Parameters

Name Type Description Notes
create_sms_campaign CreateSmsCampaign Values to create an SMS Campaign

Return type

CreateModel

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_sms_campaign

delete_sms_campaign(campaign_id)

Delete an SMS campaign

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the SMS campaign

try:
    # Delete an SMS campaign
    api_instance.delete_sms_campaign(campaign_id)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->delete_sms_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the SMS campaign

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_sms_campaign

GetSmsCampaign get_sms_campaign(campaign_id)

Get an SMS campaign

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the SMS campaign

try:
    # Get an SMS campaign
    api_response = api_instance.get_sms_campaign(campaign_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->get_sms_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the SMS campaign

Return type

GetSmsCampaign

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_sms_campaigns

GetSmsCampaigns get_sms_campaigns(status=status, start_date=start_date, end_date=end_date, limit=limit, offset=offset, sort=sort)

Returns the information for all your created SMS campaigns

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
status = 'status_example' # str | Status of campaign. (optional)
start_date = 'start_date_example' # str | Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
end_date = 'end_date_example' # str | Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
limit = 500 # int | Number limitation for the result returned (optional) (default to 500)
offset = 0 # int | Beginning point in the list to retrieve from. (optional) (default to 0)
sort = 'desc' # str | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional) (default to desc)

try:
    # Returns the information for all your created SMS campaigns
    api_response = api_instance.get_sms_campaigns(status=status, start_date=start_date, end_date=end_date, limit=limit, offset=offset, sort=sort)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->get_sms_campaigns: %s\n" % e)

Parameters

Name Type Description Notes
status str Status of campaign. [optional]
start_date str Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) [optional]
end_date str Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) [optional]
limit int Number limitation for the result returned [optional] [default to 500]
offset int Beginning point in the list to retrieve from. [optional] [default to 0]
sort str Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed [optional] [default to desc]

Return type

GetSmsCampaigns

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

request_sms_recipient_export

CreatedProcessId request_sms_recipient_export(campaign_id, recipient_export=recipient_export)

Export an SMS campaign's recipients

It returns the background process ID which on completion calls the notify URL that you have set in the input.

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the campaign
recipient_export = brevo_python.RequestSmsRecipientExport() # RequestSmsRecipientExport | Values to send for a recipient export request (optional)

try:
    # Export an SMS campaign's recipients
    api_response = api_instance.request_sms_recipient_export(campaign_id, recipient_export=recipient_export)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->request_sms_recipient_export: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the campaign
recipient_export RequestSmsRecipientExport Values to send for a recipient export request [optional]

Return type

CreatedProcessId

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

send_sms_campaign_now

send_sms_campaign_now(campaign_id)

Send your SMS campaign immediately

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the campaign

try:
    # Send your SMS campaign immediately
    api_instance.send_sms_campaign_now(campaign_id)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->send_sms_campaign_now: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the campaign

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

send_sms_report

send_sms_report(campaign_id, send_report)

Send an SMS campaign's report

Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the campaign
send_report = brevo_python.SendReport() # SendReport | Values for send a report

try:
    # Send an SMS campaign's report
    api_instance.send_sms_report(campaign_id, send_report)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->send_sms_report: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the campaign
send_report SendReport Values for send a report

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

send_test_sms

send_test_sms(campaign_id, phone_number)

Send a test SMS campaign

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | Id of the SMS campaign
phone_number = brevo_python.SendTestSms() # SendTestSms | Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted

try:
    # Send a test SMS campaign
    api_instance.send_test_sms(campaign_id, phone_number)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->send_test_sms: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int Id of the SMS campaign
phone_number SendTestSms Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_sms_campaign

update_sms_campaign(campaign_id, update_sms_campaign)

Update an SMS campaign

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the SMS campaign
update_sms_campaign = brevo_python.UpdateSmsCampaign() # UpdateSmsCampaign | Values to update an SMS Campaign

try:
    # Update an SMS campaign
    api_instance.update_sms_campaign(campaign_id, update_sms_campaign)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->update_sms_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the SMS campaign
update_sms_campaign UpdateSmsCampaign Values to update an SMS Campaign

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_sms_campaign_status

update_sms_campaign_status(campaign_id, status)

Update a campaign's status

Example

from __future__ import print_function
import time
import brevo_python
from brevo_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: api-key
configuration = brevo_python.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: partner-key
configuration = brevo_python.Configuration()
configuration.api_key['partner-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['partner-key'] = 'Bearer'

# create an instance of the API class
api_instance = brevo_python.SMSCampaignsApi(brevo_python.ApiClient(configuration))
campaign_id = 789 # int | id of the campaign
status = brevo_python.UpdateCampaignStatus() # UpdateCampaignStatus | Status of the campaign.

try:
    # Update a campaign's status
    api_instance.update_sms_campaign_status(campaign_id, status)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->update_sms_campaign_status: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int id of the campaign
status UpdateCampaignStatus Status of the campaign.

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]