Skip to content

Latest commit

 

History

History
362 lines (249 loc) · 9.6 KB

File metadata and controls

362 lines (249 loc) · 9.6 KB

Brevo::WebhooksApi

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

Method HTTP request Description
create_webhook POST /webhooks Create a webhook
delete_webhook DELETE /webhooks/{webhookId} Delete a webhook
export_webhooks_history POST /webhooks/export Export all webhook events
get_webhook GET /webhooks/{webhookId} Get a webhook details
get_webhooks GET /webhooks Get all webhooks
update_webhook PUT /webhooks/{webhookId} Update a webhook

create_webhook

CreateModel create_webhook(create_webhook)

Create a webhook

Example

# load the gem
require 'brevo'
# setup authorization
Brevo.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 = Brevo::WebhooksApi.new

create_webhook = Brevo::CreateWebhook.new # CreateWebhook | Values to create a webhook


begin
  #Create a webhook
  result = api_instance.create_webhook(create_webhook)
  p result
rescue Brevo::ApiError => e
  puts "Exception when calling WebhooksApi->create_webhook: #{e}"
end

Parameters

Name Type Description Notes
create_webhook CreateWebhook Values to create a webhook

Return type

CreateModel

Authorization

api-key, partner-key

HTTP request headers

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

delete_webhook

delete_webhook(webhook_id)

Delete a webhook

Example

# load the gem
require 'brevo'
# setup authorization
Brevo.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 = Brevo::WebhooksApi.new

webhook_id = 789 # Integer | Id of the webhook


begin
  #Delete a webhook
  api_instance.delete_webhook(webhook_id)
rescue Brevo::ApiError => e
  puts "Exception when calling WebhooksApi->delete_webhook: #{e}"
end

Parameters

Name Type Description Notes
webhook_id Integer Id of the webhook

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

export_webhooks_history

CreatedProcessId export_webhooks_history(export_webhook_history)

Export all webhook events

This endpoint will submit a request to get the history of webhooks in the CSV file. The link to download the CSV file will be sent to the webhook that was provided in the notifyURL.

Example

# load the gem
require 'brevo'
# setup authorization
Brevo.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 = Brevo::WebhooksApi.new

export_webhook_history = Brevo::ExportWebhooksHistory.new # ExportWebhooksHistory | Values to submit for webhooks history


begin
  #Export all webhook events
  result = api_instance.export_webhooks_history(export_webhook_history)
  p result
rescue Brevo::ApiError => e
  puts "Exception when calling WebhooksApi->export_webhooks_history: #{e}"
end

Parameters

Name Type Description Notes
export_webhook_history ExportWebhooksHistory Values to submit for webhooks history

Return type

CreatedProcessId

Authorization

api-key, partner-key

HTTP request headers

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

get_webhook

GetWebhook get_webhook(webhook_id)

Get a webhook details

Example

# load the gem
require 'brevo'
# setup authorization
Brevo.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 = Brevo::WebhooksApi.new

webhook_id = 789 # Integer | Id of the webhook


begin
  #Get a webhook details
  result = api_instance.get_webhook(webhook_id)
  p result
rescue Brevo::ApiError => e
  puts "Exception when calling WebhooksApi->get_webhook: #{e}"
end

Parameters

Name Type Description Notes
webhook_id Integer Id of the webhook

Return type

GetWebhook

Authorization

api-key, partner-key

HTTP request headers

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

get_webhooks

GetWebhooks get_webhooks(opts)

Get all webhooks

Example

# load the gem
require 'brevo'
# setup authorization
Brevo.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 = Brevo::WebhooksApi.new

opts = { 
  type: 'transactional', # String | Filter on webhook type
  sort: 'desc' # String | Sort the results in the ascending/descending order of webhook creation
}

begin
  #Get all webhooks
  result = api_instance.get_webhooks(opts)
  p result
rescue Brevo::ApiError => e
  puts "Exception when calling WebhooksApi->get_webhooks: #{e}"
end

Parameters

Name Type Description Notes
type String Filter on webhook type [optional] [default to transactional]
sort String Sort the results in the ascending/descending order of webhook creation [optional] [default to desc]

Return type

GetWebhooks

Authorization

api-key, partner-key

HTTP request headers

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

update_webhook

update_webhook(webhook_id, update_webhook)

Update a webhook

Example

# load the gem
require 'brevo'
# setup authorization
Brevo.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 = Brevo::WebhooksApi.new

webhook_id = 789 # Integer | Id of the webhook

update_webhook = Brevo::UpdateWebhook.new # UpdateWebhook | Values to update a webhook


begin
  #Update a webhook
  api_instance.update_webhook(webhook_id, update_webhook)
rescue Brevo::ApiError => e
  puts "Exception when calling WebhooksApi->update_webhook: #{e}"
end

Parameters

Name Type Description Notes
webhook_id Integer Id of the webhook
update_webhook UpdateWebhook Values to update a webhook

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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