Skip to content

Latest commit

 

History

History
791 lines (547 loc) · 24.2 KB

EmailCampaignsApi.md

File metadata and controls

791 lines (547 loc) · 24.2 KB

SibApiV3Sdk::EmailCampaignsApi

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

Method HTTP request Description
create_email_campaign POST /emailCampaigns Create an email campaign
delete_email_campaign DELETE /emailCampaigns/{campaignId} Delete an email campaign
email_export_recipients POST /emailCampaigns/{campaignId}/exportRecipients Export the recipients of an email campaign
get_ab_test_campaign_result GET /emailCampaigns/{campaignId}/abTestCampaignResult Get an A/B test email campaign results
get_email_campaign GET /emailCampaigns/{campaignId} Get an email campaign report
get_email_campaigns GET /emailCampaigns Return all your created email campaigns
get_shared_template_url GET /emailCampaigns/{campaignId}/sharedUrl Get a shared template url
send_email_campaign_now POST /emailCampaigns/{campaignId}/sendNow Send an email campaign immediately, based on campaignId
send_report POST /emailCampaigns/{campaignId}/sendReport Send the report of a campaign
send_test_email POST /emailCampaigns/{campaignId}/sendTest Send an email campaign to your test list
update_campaign_status PUT /emailCampaigns/{campaignId}/status Update an email campaign status
update_email_campaign PUT /emailCampaigns/{campaignId} Update an email campaign
upload_image_to_gallery POST /emailCampaigns/images Upload an image to your account's image gallery

create_email_campaign

CreateModel create_email_campaign(email_campaigns)

Create an email campaign

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

email_campaigns = SibApiV3Sdk::CreateEmailCampaign.new # CreateEmailCampaign | Values to create a campaign


begin
  #Create an email campaign
  result = api_instance.create_email_campaign(email_campaigns)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->create_email_campaign: #{e}"
end

Parameters

Name Type Description Notes
email_campaigns CreateEmailCampaign Values to create a campaign

Return type

CreateModel

Authorization

api-key, partner-key

HTTP request headers

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

delete_email_campaign

delete_email_campaign(campaign_id)

Delete an email campaign

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | id of the campaign


begin
  #Delete an email campaign
  api_instance.delete_email_campaign(campaign_id)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->delete_email_campaign: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer id of the campaign

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

email_export_recipients

CreatedProcessId email_export_recipients(campaign_id, opts)

Export the recipients of an email campaign

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign

opts = { 
  recipient_export: SibApiV3Sdk::EmailExportRecipients.new # EmailExportRecipients | Values to send for a recipient export request
}

begin
  #Export the recipients of an email campaign
  result = api_instance.email_export_recipients(campaign_id, opts)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->email_export_recipients: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign
recipient_export EmailExportRecipients 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

get_ab_test_campaign_result

AbTestCampaignResult get_ab_test_campaign_result(campaign_id)

Get an A/B test email campaign results

Obtain winning version of an A/B test email campaign

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the A/B test campaign


begin
  #Get an A/B test email campaign results
  result = api_instance.get_ab_test_campaign_result(campaign_id)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->get_ab_test_campaign_result: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the A/B test campaign

Return type

AbTestCampaignResult

Authorization

api-key, partner-key

HTTP request headers

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

get_email_campaign

GetEmailCampaign get_email_campaign(campaign_id)

Get an email campaign report

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign


begin
  #Get an email campaign report
  result = api_instance.get_email_campaign(campaign_id)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->get_email_campaign: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign

Return type

GetEmailCampaign

Authorization

api-key, partner-key

HTTP request headers

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

get_email_campaigns

GetEmailCampaigns get_email_campaigns(opts)

Return all your created email campaigns

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

opts = { 
  type: 'type_example', # String | Filter on the type of the campaigns
  status: 'status_example', # String | Filter on the status of the campaign
  start_date: 'start_date_example', # String | Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email 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' )
  end_date: 'end_date_example', # String | Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email 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' )
  limit: 50, # Integer | Number of documents per page
  offset: 0, # Integer | Index of the first document in the page
  sort: 'desc' # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
}

begin
  #Return all your created email campaigns
  result = api_instance.get_email_campaigns(opts)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->get_email_campaigns: #{e}"
end

Parameters

Name Type Description Notes
type String Filter on the type of the campaigns [optional]
status String Filter on the status of the campaign [optional]
start_date String Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email 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 String Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email 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 Integer Number of documents per page [optional] [default to 50]
offset Integer Index of the first document in the page [optional] [default to 0]
sort String 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

GetEmailCampaigns

Authorization

api-key, partner-key

HTTP request headers

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

get_shared_template_url

GetSharedTemplateUrl get_shared_template_url(campaign_id)

Get a shared template url

Get a unique URL to share & import an email template from one Sendinblue account to another.

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign or template


begin
  #Get a shared template url
  result = api_instance.get_shared_template_url(campaign_id)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->get_shared_template_url: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign or template

Return type

GetSharedTemplateUrl

Authorization

api-key, partner-key

HTTP request headers

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

send_email_campaign_now

send_email_campaign_now(campaign_id)

Send an email campaign immediately, based on campaignId

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign


begin
  #Send an email campaign immediately, based on campaignId
  api_instance.send_email_campaign_now(campaign_id)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->send_email_campaign_now: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

send_report

send_report(campaign_id, send_report)

Send the report of a campaign

A PDF will be sent to the specified email addresses

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign

send_report = SibApiV3Sdk::SendReport.new # SendReport | Values for send a report


begin
  #Send the report of a campaign
  api_instance.send_report(campaign_id, send_report)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->send_report: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign
send_report SendReport Values for send a report

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

send_test_email

send_test_email(campaign_id, email_to)

Send an email campaign to your test list

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign

email_to = SibApiV3Sdk::SendTestEmail.new # SendTestEmail | 


begin
  #Send an email campaign to your test list
  api_instance.send_test_email(campaign_id, email_to)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->send_test_email: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign
email_to SendTestEmail

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

update_campaign_status

update_campaign_status(campaign_id, status)

Update an email campaign status

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign

status = SibApiV3Sdk::UpdateCampaignStatus.new # UpdateCampaignStatus | Status of the campaign


begin
  #Update an email campaign status
  api_instance.update_campaign_status(campaign_id, status)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->update_campaign_status: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign
status UpdateCampaignStatus Status of the campaign

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

update_email_campaign

update_email_campaign(campaign_id, email_campaign)

Update an email campaign

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

campaign_id = 789 # Integer | Id of the campaign

email_campaign = SibApiV3Sdk::UpdateEmailCampaign.new # UpdateEmailCampaign | Values to update a campaign


begin
  #Update an email campaign
  api_instance.update_email_campaign(campaign_id, email_campaign)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->update_email_campaign: #{e}"
end

Parameters

Name Type Description Notes
campaign_id Integer Id of the campaign
email_campaign UpdateEmailCampaign Values to update a campaign

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

upload_image_to_gallery

UploadImageModel upload_image_to_gallery(upload_image)

Upload an image to your account's image gallery

Example

# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: partner-key
  config.api_key['partner-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['partner-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::EmailCampaignsApi.new

upload_image = SibApiV3Sdk::UploadImageToGallery.new # UploadImageToGallery | Parameters to upload an image


begin
  #Upload an image to your account's image gallery
  result = api_instance.upload_image_to_gallery(upload_image)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling EmailCampaignsApi->upload_image_to_gallery: #{e}"
end

Parameters

Name Type Description Notes
upload_image UploadImageToGallery Parameters to upload an image

Return type

UploadImageModel

Authorization

api-key, partner-key

HTTP request headers

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