sendinblue 2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/sendinblue.rb +712 -0
- data/lib/sendinblue/version.rb +3 -0
- data/sendinblue.gemspec +29 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4d907e88495daf72176a0f0efb4906bca07458ba
|
4
|
+
data.tar.gz: 943c190a482a8e4192ba4098c986740a8cadb36a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1523799072e27ca448e00ee9896be53ffc86606c807a802b13267fe3fe80d3dc6ee5bd2a404aef195e239bcb75f1049747ac06b1fa0f51b011a5c2a944a1b944
|
7
|
+
data.tar.gz: e2c62f052c92a61f7f783378ffe8a8d68c8a605742697e853b780533a7df1060d7cfe7e834b45ce4c53165e5841ccc0acd4913d183a14a6f02a94634f9c8fdab
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
## Sendinblue Ruby GEM
|
2
|
+
|
3
|
+
This is [SendinBlue](https://www.sendinblue.com) provided API V2 Ruby GEM. It implements the various exposed APIs that you can read more about on https://apidocs.sendinblue.com.
|
4
|
+
|
5
|
+
SendinBlue API's use HTTP Authentication through an api key. You can create your api key from [API Console](https://my.sendinblue.com/advanced/apikey), after you sign up for an account with SendinBlue. You must use latest version 2.0, access key, for accessing APIs.
|
6
|
+
|
7
|
+
Compatibility:
|
8
|
+
|
9
|
+
- Ruby 1.9.X
|
10
|
+
- Ruby 2.X.X
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'sendinblue'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ ( sudo ) gem install sendinblue
|
27
|
+
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Interacting with the API.
|
32
|
+
Below sample is used to send mail from your application using SendinBlue API.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'sendinblue'
|
36
|
+
m = Sendinblue::Mailin.new("https://api.sendinblue.com/v2.0","your access key")
|
37
|
+
data = { "to" => {"to@example.net"=>"to whom!"},
|
38
|
+
"cc" => {"cc@example.net"=>"cc whom!"},
|
39
|
+
"bcc" => {"bcc@example.net"=>"bcc whom!"},
|
40
|
+
"from" => ["from@email.com","from email!"],
|
41
|
+
"replyto" => ["replyto@email.com","reply to!"],
|
42
|
+
"subject" => "My subject",
|
43
|
+
"text" => "This is the text",
|
44
|
+
"html" => "This is the <h1>HTML</h1><br/>
|
45
|
+
This is inline image 1.<br/>
|
46
|
+
<img src=\"{myinlineimage1.png}\" alt=\"image1\" border=\"0\"><br/>
|
47
|
+
Some text<br/>
|
48
|
+
This is inline image 2.<br/>
|
49
|
+
<img src=\"{myinlineimage2.jpg}\" alt=\"image2\" border=\"0\"><br/>
|
50
|
+
Some more text<br/>
|
51
|
+
Re-used inline image 1.<br/>
|
52
|
+
<img src=\"{myinlineimage1.png}\" alt=\"image3\" border=\"0\">",
|
53
|
+
"attachment" => [],
|
54
|
+
"headers" => {"Content-Type"=> "text/html;charset=iso-8859-1","X-param1"=> "value1", "X-param2"=> "value2","X-Mailin-custom"=>"my custom value", "X-Mailin-IP"=> "102.102.1.2", "X-Mailin-Tag" => "My tag"},
|
55
|
+
"inline_image" => {"myinlineimage1.png" => "your_png_files_base64_encoded_chunk_data","myinlineimage2.jpg" => "your_jpg_files_base64_encoded_chunk_data"}
|
56
|
+
}
|
57
|
+
|
58
|
+
result = m.send_email(data)
|
59
|
+
puts result
|
60
|
+
```
|
61
|
+
|
62
|
+
##Recommendation:
|
63
|
+
|
64
|
+
Sendinblue Ruby GEM has been upgraded to new version 2.2 with object-based wrapper & have new way of sending input parameters.
|
65
|
+
|
66
|
+
If earlier you were using version 2.0, & now upgraded to version 2.2, then you may face error in APIs like, example for send_email() api
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
/var/lib/gems/2.x.x/gems/sendinblue-2.1/lib/sendinblue.rb:360:in `send_email': wrong number of arguments (10 for 1) (ArgumentError)
|
70
|
+
from yourTestFile.rb:<line_no>:in `<main>'
|
71
|
+
```
|
72
|
+
|
73
|
+
In that case, it is highly recommended to update way of sending input parameters, then you may no longer face this issue.
|
74
|
+
Please refer new Ruby samples in [documentation website](https://apidocs.sendinblue.com).
|
75
|
+
|
76
|
+
## Support and Feedback
|
77
|
+
|
78
|
+
Be sure to visit the SendinBlue official [documentation website](https://apidocs.sendinblue.com) for additional information about our API.
|
79
|
+
|
80
|
+
If you find a bug, please submit the issue in [Github directly](https://github.com/mailin-api/mailin-api-ruby/issues).
|
81
|
+
|
82
|
+
As always, if you need additional assistance, drop us a note [here](https://apidocs.sendinblue.com/support/).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sendinblue"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/sendinblue.rb
ADDED
@@ -0,0 +1,712 @@
|
|
1
|
+
require "sendinblue/version"
|
2
|
+
require "json"
|
3
|
+
require "httparty"
|
4
|
+
|
5
|
+
module Sendinblue
|
6
|
+
class Mailin
|
7
|
+
@base_url = ""
|
8
|
+
@api_key = "Your access key"
|
9
|
+
def initialize(base_url,api_key)
|
10
|
+
@base_url = base_url
|
11
|
+
@api_key = api_key
|
12
|
+
end
|
13
|
+
def do_request(resource,method,input)
|
14
|
+
called_url = @base_url + "/" + resource
|
15
|
+
content_type = "application/json"
|
16
|
+
case method
|
17
|
+
when "GET"
|
18
|
+
response = HTTParty.get(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
|
19
|
+
when "POST"
|
20
|
+
response = HTTParty.post(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
|
21
|
+
when "PUT"
|
22
|
+
response = HTTParty.put(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
|
23
|
+
else
|
24
|
+
response = HTTParty.delete(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
|
25
|
+
end
|
26
|
+
return response.body
|
27
|
+
end
|
28
|
+
def get(resource,input)
|
29
|
+
return do_request(resource,"GET",input)
|
30
|
+
end
|
31
|
+
def post(resource,input)
|
32
|
+
return do_request(resource,"POST",input)
|
33
|
+
end
|
34
|
+
def put(resource,input)
|
35
|
+
return do_request(resource,"PUT",input)
|
36
|
+
end
|
37
|
+
def delete(resource,input)
|
38
|
+
return do_request(resource,"DELETE",input)
|
39
|
+
end
|
40
|
+
# Get Account.
|
41
|
+
# No input required
|
42
|
+
def get_account()
|
43
|
+
return self.get("account","")
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get SMTP details.
|
47
|
+
# No input required
|
48
|
+
def get_smtp_details()
|
49
|
+
return self.get("account/smtpdetail","")
|
50
|
+
end
|
51
|
+
|
52
|
+
# Create Child Account.
|
53
|
+
# @param {Array} data contains php array with key value pair.
|
54
|
+
# @options data {String} child_email: Email address of Reseller child [Mandatory]
|
55
|
+
# @options data {String} password: Password of Reseller child to login [Mandatory]
|
56
|
+
# @options data {String} company_org: Name of Reseller child’s company [Mandatory]
|
57
|
+
# @options data {String} first_name: First name of Reseller child [Mandatory]
|
58
|
+
# @options data {String} last_name: Last name of Reseller child [Mandatory]
|
59
|
+
# @options data {Array} credits: Number of email & sms credits respectively, which will be assigned to the Reseller child’s account [Optional]
|
60
|
+
# - email_credit {Integer} number of email credits
|
61
|
+
# - sms_credit {Integer} Number of sms credts
|
62
|
+
# @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
|
63
|
+
def create_child_account(data)
|
64
|
+
return self.post("account",data.to_json)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Update Child Account.
|
68
|
+
# @param {Array} data contains php array with key value pair.
|
69
|
+
# @options data {String} auth_key: 16 character authorization key of Reseller child to be modified [Mandatory]
|
70
|
+
# @options data {String} company_org: Name of Reseller child’s company [Optional]
|
71
|
+
# @options data {String} first_name: First name of Reseller child [Optional]
|
72
|
+
# @options data {String} last_name: Last name of Reseller child [Optional]
|
73
|
+
# @options data {String} password: Password of Reseller child to login [Optional]
|
74
|
+
# @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
|
75
|
+
# @options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can use commas to separate multiple IPs [Optional]
|
76
|
+
def update_child_account(data)
|
77
|
+
return self.put("account",data.to_json)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Delete Child Account.
|
81
|
+
# @param {Array} data contains php array with key value pair.
|
82
|
+
# @options data {String} auth_key: 16 character authorization key of Reseller child to be deleted [Mandatory]
|
83
|
+
def delete_child_account(data)
|
84
|
+
return self.delete("account/" + data['auth_key'],"")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Get Reseller child Account.
|
88
|
+
# @param {Array} data contains php array with key value pair.
|
89
|
+
# @options data {String} auth_key: 16 character authorization key of Reseller child. Example : To get the details of more than one child account, use, {"key1":"abC01De2fGHI3jkL","key2":"mnO45Pq6rSTU7vWX"} [Mandatory]
|
90
|
+
def get_reseller_child(data)
|
91
|
+
return self.post("account/getchildv2",data.to_json)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Add/Remove Reseller child's Email/Sms credits.
|
95
|
+
# @param {Array} data contains php array with key value pair.
|
96
|
+
# @options data {String} auth_key: 16 character authorization key of Reseller child to modify credits [Mandatory]
|
97
|
+
# @options data {Array} add_credit: Number of email & sms credits to be added. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if rmv_credit is empty]
|
98
|
+
# - email_credit {Integer} number of email credits
|
99
|
+
# - sms_credit {Integer} Number of sms credts
|
100
|
+
# @options data {Array} rmv_credit: Number of email & sms credits to be removed. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if add_credits is empty]
|
101
|
+
# - email_credit {Integer} number of email credits
|
102
|
+
# - sms_credit {Integer} Number of sms credts
|
103
|
+
def add_remove_child_credits(data)
|
104
|
+
return self.post("account/addrmvcredit",data.to_json)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Send a transactional SMS.
|
108
|
+
# @param {Array} data contains php array with key value pair.
|
109
|
+
# @options data {String} to: The mobile number to send SMS to with country code [Mandatory]
|
110
|
+
# @options data {String} from: The name of the sender. The number of characters is limited to 11 (alphanumeric format) [Mandatory]
|
111
|
+
# @options data {String} text: The text of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Mandatory]
|
112
|
+
# @options data {String} web_url: The web URL that can be called once the message is successfully delivered [Optional]
|
113
|
+
# @options data {String} tag: The tag that you can associate with the message [Optional]
|
114
|
+
# @options data {String} type: Type of message. Possible values – marketing (default) & transactional. You can use marketing for sending marketing SMS, & for sending transactional SMS, use transactional type [Optional]
|
115
|
+
def send_sms(data)
|
116
|
+
return self.post("sms",data.to_json)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Create & Schedule your SMS campaigns.
|
120
|
+
# @param {Array} data contains php array with key value pair.
|
121
|
+
# @options data {String} name: Name of the SMS campaign [Mandatory]
|
122
|
+
# @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
|
123
|
+
# @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
|
124
|
+
# @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
|
125
|
+
# @options data {Array} listid: These are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
|
126
|
+
# @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
|
127
|
+
# @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
|
128
|
+
# @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
|
129
|
+
def create_sms_campaign(data)
|
130
|
+
return self.post("sms",data.to_json)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Update your SMS campaigns.
|
134
|
+
# @param {Array} data contains php array with key value pair.
|
135
|
+
# @options data {Integer} id: Id of the SMS campaign [Mandatory]
|
136
|
+
# @options data {String} name: Name of the SMS campaign [Optional]
|
137
|
+
# @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
|
138
|
+
# @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
|
139
|
+
# @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
|
140
|
+
# @options data {Array} listid: hese are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
|
141
|
+
# @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
|
142
|
+
# @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
|
143
|
+
# @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
|
144
|
+
def update_sms_campaign(data)
|
145
|
+
id = data['id'].to_s
|
146
|
+
return self.put("sms/" + id,data.to_json)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Send a Test SMS.
|
150
|
+
# @param {Array} data contains php array with key value pair.
|
151
|
+
# @options data {Integer} id: Id of the SMS campaign [Mandatory]
|
152
|
+
# @options data {String} to: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Mandatory]
|
153
|
+
def send_bat_sms(data)
|
154
|
+
id = data['id'].to_s
|
155
|
+
return self.get("sms/" + id,data.to_json)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Get all campaigns detail.
|
159
|
+
# @param {Array} data contains php array with key value pair.
|
160
|
+
# @options data {String} type: Type of campaign. Possible values – classic, trigger, sms, template ( case sensitive ) [Optional]
|
161
|
+
# @options data {String} status: Status of campaign. Possible values – draft, sent, archive, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional]
|
162
|
+
# @options data {Integer} page: Maximum number of records per request is 500, if there are more than 500 campaigns then you can use this parameter to get next 500 results [Optional]
|
163
|
+
# @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
|
164
|
+
def get_campaigns_v2(data)
|
165
|
+
if data['type'] == "" and data['status'] == "" and data['page'] == "" and data['page_limit'] == ""
|
166
|
+
return self.get("campaign/detailsv2/","")
|
167
|
+
else
|
168
|
+
return self.get("campaign/detailsv2/type/" + data['type'] + "/status/" + data['status'] + "/page/" + data['page'].to_s + "/page_limit/" + data['page_limit'].to_s + "/","")
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Get a particular campaign detail.
|
173
|
+
# @param {Array} data contains php array with key value pair.
|
174
|
+
# @options data {Integer} id: Unique Id of the campaign [Mandatory]
|
175
|
+
def get_campaign_v2(data)
|
176
|
+
id = data['id'].to_s
|
177
|
+
return self.get("campaign/" + id + "/detailsv2/","")
|
178
|
+
end
|
179
|
+
|
180
|
+
# Create and Schedule your campaigns. It returns the ID of the created campaign.
|
181
|
+
# @param {Array} data contains php array with key value pair.
|
182
|
+
# @options data {String} category: Tag name of the campaign [Optional]
|
183
|
+
# @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
184
|
+
# @options data {String} name: Name of the campaign [Mandatory]
|
185
|
+
# @options data {String} bat: Email address for test mail [Optional]
|
186
|
+
# @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
|
187
|
+
# @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
|
188
|
+
# @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
|
189
|
+
# @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
190
|
+
# @options data {String} subject: Subject of the campaign [Mandatory]
|
191
|
+
# @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
192
|
+
# @options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
193
|
+
# @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM] To use the contact attributes here, these should already exist in SendinBlue account [Optional]
|
194
|
+
# @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
|
195
|
+
# @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
196
|
+
# @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
|
197
|
+
# @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
|
198
|
+
# @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
|
199
|
+
def create_campaign(data)
|
200
|
+
return self.post("campaign",data.to_json)
|
201
|
+
end
|
202
|
+
|
203
|
+
# Delete your campaigns.
|
204
|
+
# @param {Array} data contains php array with key value pair.
|
205
|
+
# @options data {Integer} id: Id of campaign to be deleted [Mandatory]
|
206
|
+
def delete_campaign(data)
|
207
|
+
id = data['id'].to_s
|
208
|
+
return self.delete("campaign/" + id,"")
|
209
|
+
end
|
210
|
+
|
211
|
+
# Update your campaign.
|
212
|
+
# @param {Array} data contains php array with key value pair.
|
213
|
+
# @options data {Integer} id: Id of campaign to be modified [Mandatory]
|
214
|
+
# @options data {String} category: Tag name of the campaign [Optional]
|
215
|
+
# @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
216
|
+
# @options data {String} name: Name of the campaign [Optional]
|
217
|
+
# @options data {String} bat: Email address for test mail [Optional]
|
218
|
+
# @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Optional]
|
219
|
+
# @options data {String} html_url: Url which content is the body of content [Optional]
|
220
|
+
# @options data {Array} listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
|
221
|
+
# @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
222
|
+
# @options data {String} subject: Subject of the campaign.
|
223
|
+
# @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
224
|
+
# @options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
225
|
+
# @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
|
226
|
+
# @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
|
227
|
+
# @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
228
|
+
# @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
|
229
|
+
# @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
|
230
|
+
# @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
|
231
|
+
def update_campaign(data)
|
232
|
+
id = data['id'].to_s
|
233
|
+
return self.put("campaign/" + id,data.to_json)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Send report of Sent and Archived campaign.
|
237
|
+
# @param {Array} data contains php array with key value pair.
|
238
|
+
# @options data {Integer} id: Id of campaign to send its report [Mandatory]
|
239
|
+
# @options data {String} lang: Language of email content. Possible values – fr (default), en, es, it & pt [Optional]
|
240
|
+
# @options data {String} email_subject: Message subject [Mandatory]
|
241
|
+
# @options data {Array} email_to: Email address of the recipient(s). Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
|
242
|
+
# @options data {String} email_content_type: Body of the message in text/HTML version. Possible values – text & html [Mandatory]
|
243
|
+
# @options data {Array} email_bcc: Same as email_to but for Bcc [Optional]
|
244
|
+
# @options data {Array} email_cc: Same as email_to but for Cc [Optional]
|
245
|
+
# @options data {String} email_body: Body of the message [Mandatory]
|
246
|
+
def campaign_report_email(data)
|
247
|
+
id = data['id'].to_s
|
248
|
+
return self.post("campaign/" + id + "/report",data.to_json)
|
249
|
+
end
|
250
|
+
|
251
|
+
# Export the recipients of a specified campaign.
|
252
|
+
# @param {Array} data contains php array with key value pair.
|
253
|
+
# @options data {Integer} id: Id of campaign to export its recipients [Mandatory]
|
254
|
+
# @options data {String} notify_url: URL that will be called once the export process is finished [Mandatory]
|
255
|
+
# @options data {String} type: Type of recipients. Possible values – all, non_clicker, non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory]
|
256
|
+
def campaign_recipients_export(data)
|
257
|
+
id = data['id'].to_s
|
258
|
+
return self.post("campaign/" + id + "/recipients",data.to_json)
|
259
|
+
end
|
260
|
+
|
261
|
+
# Send a Test Campaign.
|
262
|
+
# @param {Array} data contains php array with key value pair.
|
263
|
+
# @options data {Integer} id: Id of the campaign [Mandatory]
|
264
|
+
# @options data {Array} emails: Email address of recipient(s) existing in the one of the lists & should not be blacklisted. Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
|
265
|
+
def send_bat_email(data)
|
266
|
+
id = data['id'].to_s
|
267
|
+
return self.post("campaign/" + id + "/test",data.to_json)
|
268
|
+
end
|
269
|
+
|
270
|
+
# Get all the processes information under the account.
|
271
|
+
# @param {Array} data contains php array with key value pair.
|
272
|
+
# @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
|
273
|
+
# @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
274
|
+
def get_processes(data)
|
275
|
+
return self.get("process",data.to_json)
|
276
|
+
end
|
277
|
+
|
278
|
+
# Get the process information.
|
279
|
+
# @param {Array} data contains php array with key value pair.
|
280
|
+
# @options data {Integer} id: Id of process to get details [Mandatory]
|
281
|
+
def get_process(data)
|
282
|
+
id = data['id'].to_s
|
283
|
+
return self.get("process/" + id.to_s,"")
|
284
|
+
end
|
285
|
+
|
286
|
+
# Get all lists detail.
|
287
|
+
# @param {Array} data contains php array with key value pair.
|
288
|
+
# @options data {Integer} list_parent: This is the existing folder id & can be used to get all lists belonging to it [Optional]
|
289
|
+
# @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
|
290
|
+
# @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
291
|
+
def get_lists(data)
|
292
|
+
return self.get("list",data.to_json)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Get a particular list detail.
|
296
|
+
# @param {Array} data contains php array with key value pair.
|
297
|
+
# @options data {Integer} id: Id of list to get details [Mandatory]
|
298
|
+
def get_list(data)
|
299
|
+
id = data['id'].to_s
|
300
|
+
return self.get("list/" + id.to_s,"")
|
301
|
+
end
|
302
|
+
|
303
|
+
# Create a new list.
|
304
|
+
# @param {Array} data contains php array with key value pair.
|
305
|
+
# @options data {String} list_name: Desired name of the list to be created [Mandatory]
|
306
|
+
# @options data {Integer} list_parent: Folder ID [Mandatory]
|
307
|
+
def create_list(data)
|
308
|
+
return self.post("list",data.to_json)
|
309
|
+
end
|
310
|
+
|
311
|
+
# Delete a specific list.
|
312
|
+
# @param {Array} data contains php array with key value pair.
|
313
|
+
# @options data {Integer} id: Id of list to be deleted [Mandatory]
|
314
|
+
def delete_list(data)
|
315
|
+
id = data['id'].to_s
|
316
|
+
return self.delete("list/" + id,"")
|
317
|
+
end
|
318
|
+
|
319
|
+
# Update a list.
|
320
|
+
# @param {Array} data contains php array with key value pair.
|
321
|
+
# @options data {Integer} id: Id of list to be modified [Mandatory]
|
322
|
+
# @options data {String} list_name: Desired name of the list to be modified [Optional]
|
323
|
+
# @options data {Integer} list_parent: Folder ID [Mandatory]
|
324
|
+
def update_list(data)
|
325
|
+
id = data['id'].to_s
|
326
|
+
return self.put("list/" + id,data.to_json)
|
327
|
+
end
|
328
|
+
|
329
|
+
# Add already existing users in the SendinBlue contacts to the list.
|
330
|
+
# @param {Array} data contains php array with key value pair.
|
331
|
+
# @options data {Integer} id: Id of list to link users in it [Mandatory]
|
332
|
+
# @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
|
333
|
+
def add_users_list(data)
|
334
|
+
id = data['id'].to_s
|
335
|
+
return self.post("list/" + id + "/users",data.to_json)
|
336
|
+
end
|
337
|
+
|
338
|
+
# Delete already existing users in the SendinBlue contacts from the list.
|
339
|
+
# @param {Array} data contains php array with key value pair.
|
340
|
+
# @options data {Integer} id: Id of list to unlink users from it [Mandatory]
|
341
|
+
# @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts to be modified. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
|
342
|
+
def delete_users_list(data)
|
343
|
+
id = data['id'].to_s
|
344
|
+
return self.delete("list/" + id + "/delusers",data.to_json)
|
345
|
+
end
|
346
|
+
|
347
|
+
# Send Transactional Email.
|
348
|
+
# @param {Array} data contains php array with key value pair.
|
349
|
+
# @options data {Array} to: Email address of the recipient(s). It should be sent as an associative array. Example: array("to@example.net"=>"to whom"). You can use commas to separate multiple recipients [Mandatory]
|
350
|
+
# @options data {String} subject: Message subject [Mandatory]
|
351
|
+
# @options data {Array} from Email address for From header. It should be sent as an array. Example: array("from@email.com","from email") [Mandatory]
|
352
|
+
# @options data {String} html: Body of the message. (HTML version) [Mandatory]. To send inline images, use <img src="{YourFileName.Extension}" alt="image" border="0" >, the 'src' attribute value inside {} (curly braces) should be same as the filename used in 'inline_image' parameter
|
353
|
+
# @options data {String} text: Body of the message. (text version) [Optional]
|
354
|
+
# @options data {Array} cc: Same as to but for Cc. Example: array("cc@example.net","cc whom") [Optional]
|
355
|
+
# @options data {Array} bcc: Same as to but for Bcc. Example: array("bcc@example.net","bcc whom") [Optional]
|
356
|
+
# @options data {Array} replyto: Same as from but for Reply To. Example: array("from@email.com","from email") [Optional]
|
357
|
+
# @options data {Array} attachment: Provide the absolute url of the attachment/s. Possible extension values = gif, png, bmp, cgm, jpg, jpeg, txt, css, shtml, html, htm, csv, zip, pdf, xml, doc, xls, ppt, tar, and ez. To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple attachments [Optional]
|
358
|
+
# @options data {Array} headers: The headers will be sent along with the mail headers in original email. Example: array("Content-Type"=>"text/html; charset=iso-8859-1"). You can use commas to separate multiple headers [Optional]
|
359
|
+
# @options data {Array} inline_image: Pass your inline image/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple inline images [Optional]
|
360
|
+
def send_email(data)
|
361
|
+
return self.post("email",data.to_json)
|
362
|
+
end
|
363
|
+
|
364
|
+
# To retrieve details of all webhooks.
|
365
|
+
# @param {Array} data contains php array with key value pair.
|
366
|
+
# @options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all webhooks, use $is_plat="" [Optional]
|
367
|
+
def get_webhooks(data)
|
368
|
+
return self.get("webhook",data.to_json)
|
369
|
+
end
|
370
|
+
|
371
|
+
# To retrieve details of any particular webhook.
|
372
|
+
# @param {Array} data contains php array with key value pair.
|
373
|
+
# @options data {Integer} id: Id of webhook to get details [Mandatory]
|
374
|
+
|
375
|
+
def get_webhook(data)
|
376
|
+
id = data['id'].to_s
|
377
|
+
return self.get("webhook/" + id,"")
|
378
|
+
end
|
379
|
+
|
380
|
+
# Create a Webhook.
|
381
|
+
# @param {Array} data contains php array with key value pair.
|
382
|
+
# @options data {String} url: URL that will be triggered by a webhook [Mandatory]
|
383
|
+
# @options data {String} description: Webook description [Optional]
|
384
|
+
# @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
|
385
|
+
# @options data {Integer} is_plat: Flag to create webhook type. Possible values – 0 (default) & 1. Example: to create Transactional webhooks, use $is_plat=0, & to create Marketing webhooks, use $is_plat=1 [Optional]
|
386
|
+
def create_webhook(data)
|
387
|
+
return self.post("webhook",data.to_json)
|
388
|
+
end
|
389
|
+
|
390
|
+
# Delete a webhook.
|
391
|
+
# @param {Array} data contains php array with key value pair.
|
392
|
+
# @options data {Integer} id: Id of webhook to be deleted [Mandatory]
|
393
|
+
def delete_webhook(data)
|
394
|
+
id = data['id'].to_s
|
395
|
+
return self.delete("webhook/" + id,"")
|
396
|
+
end
|
397
|
+
|
398
|
+
# Update a webhook.
|
399
|
+
# @param {Array} data contains php array with key value pair.
|
400
|
+
# @options data {Integer} id: Id of webhook to be modified [Mandatory]
|
401
|
+
# @options data {String} url: URL that will be triggered by a webhook [Mandatory]
|
402
|
+
# @options data {String} description: Webook description [Optional]
|
403
|
+
# @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
|
404
|
+
def update_webhook(data)
|
405
|
+
id = data['id'].to_s
|
406
|
+
return self.put("webhook/" + id,data.to_json)
|
407
|
+
end
|
408
|
+
|
409
|
+
# Aggregate / date-wise report of the SendinBlue SMTP account.
|
410
|
+
# @param {Array} data contains php array with key value pair.
|
411
|
+
# @options data {Integer} aggregate: This is used to indicate, you are interested in all-time totals. Possible values – 0 & 1. aggregate = 0 means it will not aggregate records, and will show stats per day/date wise [Optional]
|
412
|
+
# @options data {String} start_date: The start date to look up statistics. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
|
413
|
+
# @options data {String} end_date: The end date to look up statistics. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
|
414
|
+
# @options data {Integer} days: Number of days in the past to include statistics ( Includes today ). It must be an integer greater than 0 [Optional]
|
415
|
+
# @options data {String} tag: The tag you will specify to retrieve detailed stats. It must be an existing tag that has statistics [Optional]
|
416
|
+
def get_statistics(data)
|
417
|
+
return self.post("statistics",data.to_json)
|
418
|
+
end
|
419
|
+
|
420
|
+
# Get Access a specific user Information.
|
421
|
+
# @param {Array} data contains php array with key value pair.
|
422
|
+
# @options data {String} email: Email address of the already existing user in the SendinBlue contacts [Mandatory]
|
423
|
+
def get_user(data)
|
424
|
+
id = data['email']
|
425
|
+
return self.get("user/" + id,"")
|
426
|
+
end
|
427
|
+
|
428
|
+
# Unlink existing user from all lists.
|
429
|
+
# @param {Array} data contains php array with key value pair.
|
430
|
+
# @options data {String} email: Email address of the already existing user in the SendinBlue contacts to be unlinked from all lists [Mandatory]
|
431
|
+
def delete_user(data)
|
432
|
+
id = data['email']
|
433
|
+
return self.delete("user/" + id,"")
|
434
|
+
end
|
435
|
+
|
436
|
+
# Import Users Information.
|
437
|
+
# @param {Array} data contains php array with key value pair.
|
438
|
+
# @options data {String} url: The URL of the file to be imported. Possible file types – .txt, .csv [Mandatory: if body is empty]
|
439
|
+
# @options data {String} body: The Body with csv content to be imported. Example: ‘NAME;SURNAME;EMAIL\n"Name1";"Surname1";"example1@example.net"\n"Name2";"Surname2";"example2@example.net"‘, where \n separates each user data. You can use semicolon to separate multiple attributes [Mandatory: if url is empty]
|
440
|
+
# @options data {Array} listids: These are the list ids in which the the users will be imported [Mandatory: if name is empty]
|
441
|
+
# @options data {String} notify_url: URL that will be called once the import process is finished [Optional] In notify_url, we are sending the content using POST method
|
442
|
+
# @options data {String} name: This is new list name which will be created first & then users will be imported in it [Mandatory: if listids is empty]
|
443
|
+
# @options data {Integer} list_parent: This is the existing folder id & can be used with name parameter to make newly created list’s desired parent [Optional]
|
444
|
+
def import_users(data)
|
445
|
+
return self.post("user/import",data.to_json)
|
446
|
+
end
|
447
|
+
|
448
|
+
# Export Users Information.
|
449
|
+
# @param {Array} data contains php array with key value pair.
|
450
|
+
# @options data {String} export_attrib: The name of attribute present in your SendinBlue account. You can use commas to separate multiple attributes. Example: "EMAIL,NAME,SMS" [Optional]
|
451
|
+
# @options data {String} filter: Filter can be added to export users. Example: "{\"blacklisted\":1}", will export all blacklisted users [Mandatory]
|
452
|
+
# @options data {String} notify_url: URL that will be called once the export process is finished [Optional]
|
453
|
+
def export_users(data)
|
454
|
+
return self.post("user/export",data.to_json)
|
455
|
+
end
|
456
|
+
|
457
|
+
# Create a new user if an email provided as input, doesn’t exists in the contact list of your SendinBlue account, otherwise it will update the existing user.
|
458
|
+
# @param {Array} data contains php array with key value pair.
|
459
|
+
# @options data {String} email: Email address of the user to be created in SendinBlue contacts. Already existing email address of user in the SendinBlue contacts to be modified [Mandatory]
|
460
|
+
# @options data {Array} attributes: The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
|
461
|
+
# @options data {Integer} blacklisted: This is used to blacklist/ Unblacklist a user. Possible values – 0 & 1. blacklisted = 1 means user has been blacklisted [Optional]
|
462
|
+
# @options data {Array} listid: The list id(s) to be linked from user [Optional]
|
463
|
+
# @options data {Array} listid_unlink: The list id(s) to be unlinked from user [Optional]
|
464
|
+
# @options data {Array} blacklisted_sms: This is used to blacklist/ Unblacklist a user’s SMS number. Possible values – 0 & 1. blacklisted_sms = 1 means user’s SMS number has been blacklisted [Optional]
|
465
|
+
def create_update_user(data)
|
466
|
+
return self.post("user/createdituser",data.to_json)
|
467
|
+
end
|
468
|
+
|
469
|
+
# Access all the attributes information under the account.
|
470
|
+
# No input required
|
471
|
+
def get_attributes()
|
472
|
+
return self.get("attribute","")
|
473
|
+
end
|
474
|
+
|
475
|
+
# Access the specific type of attribute information.
|
476
|
+
# @param {Array} data contains php array with key value pair.
|
477
|
+
# @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global [Optional]
|
478
|
+
def get_attribute(data)
|
479
|
+
type = data['type']
|
480
|
+
return self.get("attribute/" + type,"")
|
481
|
+
end
|
482
|
+
|
483
|
+
# Create an Attribute.
|
484
|
+
# @param {Array} data contains php array with key value pair.
|
485
|
+
# @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global ( case sensitive ) [Mandatory]
|
486
|
+
# @options data {Array} data: The name and data type of ‘normal’ & ‘transactional’ attribute to be created in your SendinBlue account. It should be sent as an associative array. Example: array(‘ATTRIBUTE_NAME1′ => ‘DATA_TYPE1′, ‘ATTRIBUTE_NAME2’=> ‘DATA_TYPE2′).
|
487
|
+
# The name and data value of ‘category’, ‘calculated’ & ‘global’, should be sent as JSON string. Example: ‘[{ "name":"ATTRIBUTE_NAME1", "value":"Attribute_value1" }, { "name":"ATTRIBUTE_NAME2", "value":"Attribute_value2" }]’. You can use commas to separate multiple attributes [Mandatory]
|
488
|
+
def create_attribute(data)
|
489
|
+
return self.post("attribute",data.to_json)
|
490
|
+
end
|
491
|
+
|
492
|
+
# Delete a specific type of attribute information.
|
493
|
+
# @param {Array} data contains php array with key value pair.
|
494
|
+
# @options data {Integer} type: Type of attribute to be deleted [Mandatory]
|
495
|
+
def delete_attribute(data)
|
496
|
+
type = data['type']
|
497
|
+
return self.post("attribute/" + type,data.to_json)
|
498
|
+
end
|
499
|
+
|
500
|
+
# Get Email Event report.
|
501
|
+
# @param {Array} data contains php array with key value pair.
|
502
|
+
# @options data {Integer} limit: To limit the number of results returned. It should be an integer [Optional]
|
503
|
+
# @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
|
504
|
+
# @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
|
505
|
+
# @options data {Integer} offset: Beginning point in the list to retrieve from. It should be an integer [Optional]
|
506
|
+
# @options data {String} date: Specific date to get its report. Date must be in YYYY-MM-DD format and should be earlier than todays date [Optional]
|
507
|
+
# @options data {Integer} days: Number of days in the past (includes today). If specified, must be an integer greater than 0 [Optional]
|
508
|
+
# @options data {String} email: Email address to search report for [Optional]
|
509
|
+
def get_report(data)
|
510
|
+
return self.post("report",data.to_json)
|
511
|
+
end
|
512
|
+
|
513
|
+
# Get all folders detail.
|
514
|
+
# @param {Array} data contains php array with key value pair.
|
515
|
+
# @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 folders then you can use this parameter to get next 50 results [Mandatory]
|
516
|
+
# @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
517
|
+
def get_folders(data)
|
518
|
+
return self.get("folder",data.to_json)
|
519
|
+
end
|
520
|
+
|
521
|
+
# Get a particular folder detail.
|
522
|
+
# @param {Array} data contains php array with key value pair.
|
523
|
+
# @options data {Integer} id: Id of folder to get details [Mandatory]
|
524
|
+
def get_folder(data)
|
525
|
+
id = data['id'].to_s
|
526
|
+
return self.get("folder/" + id,"")
|
527
|
+
end
|
528
|
+
|
529
|
+
# Create a new folder.
|
530
|
+
# @param {Array} data contains php array with key value pair.
|
531
|
+
# @options data {String} name: Desired name of the folder to be created [Mandatory]
|
532
|
+
def create_folder(data)
|
533
|
+
return self.post("folder",data.to_json)
|
534
|
+
end
|
535
|
+
|
536
|
+
# Delete a specific folder information.
|
537
|
+
# @param {Array} data contains php array with key value pair.
|
538
|
+
# @options data {Integer} id: Id of folder to be deleted [Mandatory]
|
539
|
+
def delete_folder(data)
|
540
|
+
id = data['id'].to_s
|
541
|
+
return self.delete("folder/" + id,"")
|
542
|
+
end
|
543
|
+
|
544
|
+
# Update an existing folder.
|
545
|
+
# @param {Array} data contains php array with key value pair.
|
546
|
+
# @options data {Integer} id: Id of folder to be modified [Mandatory]
|
547
|
+
# @options data {String} name: Desired name of the folder to be modified [Mandatory]
|
548
|
+
def update_folder(data)
|
549
|
+
id = data['id'].to_s
|
550
|
+
return self.put("folder/" + id,data.to_json)
|
551
|
+
end
|
552
|
+
|
553
|
+
# Delete any hardbounce, which actually would have been blocked due to some temporary ISP failures.
|
554
|
+
# @param {Array} data contains php array with key value pair.
|
555
|
+
# @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
|
556
|
+
# @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
|
557
|
+
# @options data {String} email: Email address to delete its bounces [Optional]
|
558
|
+
def delete_bounces(data)
|
559
|
+
return self.post("bounces",data.to_json)
|
560
|
+
end
|
561
|
+
|
562
|
+
# Send templates created on SendinBlue, through SendinBlue SMTP (transactional mails).
|
563
|
+
# @param {Array} data contains php array with key value pair.
|
564
|
+
# @options data {Integer} id: Id of the template created on SendinBlue account [Mandatory]
|
565
|
+
# @options data {String} to: Email address of the recipient(s). You can use pipe ( | ) to separate multiple recipients. Example: "to-example@example.net|to2-example@example.net" [Mandatory]
|
566
|
+
# @options data {String} cc: Same as to but for Cc [Optional]
|
567
|
+
# @options data {String} bcc: Same as to but for Bcc [Optional]
|
568
|
+
# @options data {Array} attr: The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
|
569
|
+
# @options data {String} attachment_url: Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere [Optional]
|
570
|
+
# @options data {Array} attachment: To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array [Optional]
|
571
|
+
def send_transactional_template(data)
|
572
|
+
id = data['id'].to_s
|
573
|
+
return self.put("template/" + id,data.to_json)
|
574
|
+
end
|
575
|
+
|
576
|
+
# Create and schedule your Trigger campaigns.
|
577
|
+
# @param {Array} data contains php array with key value pair.
|
578
|
+
# @options data {String} category: Tag name of the campaign [Optional]
|
579
|
+
# @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
580
|
+
# @options data {String} trigger_name: Name of the campaign [Mandatory]
|
581
|
+
# @options data {String} bat: Email address for test mail [Optional]
|
582
|
+
# @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
|
583
|
+
# @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
|
584
|
+
# @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
|
585
|
+
# @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
586
|
+
# @options data {String} subject: Subject of the campaign [Mandatory]
|
587
|
+
# @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
588
|
+
# @options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
589
|
+
# @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
|
590
|
+
# @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
|
591
|
+
# @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
|
592
|
+
# @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
593
|
+
# @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
|
594
|
+
# @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
|
595
|
+
# @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
|
596
|
+
def create_trigger_campaign(data)
|
597
|
+
return self.post("campaign",data.to_json)
|
598
|
+
end
|
599
|
+
|
600
|
+
# Update and schedule your Trigger campaigns.
|
601
|
+
# @param {Array} data contains php array with key value pair.
|
602
|
+
# @options data {Integer} id: Id of Trigger campaign to be modified [Mandatory]
|
603
|
+
# @options data {String} category: Tag name of the campaign [Optional]
|
604
|
+
# @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
605
|
+
# @options data {String} trigger_name: Name of the campaign [Mandatory]
|
606
|
+
# @options data {String} bat Email address for test mail [Optional]
|
607
|
+
# @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
|
608
|
+
# @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
|
609
|
+
# @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
|
610
|
+
# @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
611
|
+
# @options data {String} subject: Subject of the campaign [Mandatory]
|
612
|
+
# @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
613
|
+
# @options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
614
|
+
# @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
|
615
|
+
# @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
|
616
|
+
# @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
|
617
|
+
# @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
618
|
+
# @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
|
619
|
+
# @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
|
620
|
+
# @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
|
621
|
+
def update_trigger_campaign(data)
|
622
|
+
id = data['id'].to_s
|
623
|
+
return self.put("campaign/" + id,data.to_json)
|
624
|
+
end
|
625
|
+
|
626
|
+
# Create a Template.
|
627
|
+
# @param {Array} data contains php array with key value pair.
|
628
|
+
# @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
629
|
+
# @options data {String} template_name: Name of the Template [Mandatory]
|
630
|
+
# @options data {String} bat: Email address for test mail [Optional]
|
631
|
+
# @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
|
632
|
+
# @options data {String} html_url Url: which content is the body of content [Mandatory: if html_content is empty]
|
633
|
+
# @options data {String} subject: Subject of the campaign [Mandatory]
|
634
|
+
# @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
635
|
+
# @options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
636
|
+
# @options data {String} to_fieldv This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
|
637
|
+
# @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
|
638
|
+
# @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
|
639
|
+
def create_template(data)
|
640
|
+
return self.post("template",data.to_json)
|
641
|
+
end
|
642
|
+
|
643
|
+
# Update a Template.
|
644
|
+
# @param {Array} data contains php array with key value pair.
|
645
|
+
# @options data {Integer} id: Id of Template to be modified [Mandatory]
|
646
|
+
# @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
647
|
+
# @options data {String} template_name: Name of the Template [Mandatory]
|
648
|
+
# @options data {String} bat: Email address for test mail [Optional]
|
649
|
+
# @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
|
650
|
+
# @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
|
651
|
+
# @options data {String} subject: Subject of the campaign [Mandatory]
|
652
|
+
# @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
653
|
+
# @options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
654
|
+
# @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
|
655
|
+
# @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
|
656
|
+
# @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
|
657
|
+
def update_template(data)
|
658
|
+
id = data['id'].to_s
|
659
|
+
return self.put("template/" + id,data.to_json)
|
660
|
+
end
|
661
|
+
|
662
|
+
# Get the Campaign name, subject and share link of the classic type campaigns only which are sent, for those which are not sent and the rest of campaign types like trigger, template & sms, will return an error message of share link not available.
|
663
|
+
# @param {Array} data contains php array with key value pair.
|
664
|
+
# @options data {Array} camp_ids: Id of campaign to get share link. You can use commas to separate multiple ids [Mandatory]
|
665
|
+
def share_campaign(data)
|
666
|
+
return self.post("campaign/sharelinkv2",data.to_json)
|
667
|
+
end
|
668
|
+
|
669
|
+
# Update the Campaign status.
|
670
|
+
# @param {Array} data contains php array with key value pair.
|
671
|
+
# @options data {Integer} id: Id of campaign to update its status [Mandatory]
|
672
|
+
# @options data {String} status: Types of status. Possible values – suspended, archive, darchive, sent, queued, replicate and replicate_template ( case sensitive ) [Mandatory]
|
673
|
+
def update_campaign_status(data)
|
674
|
+
id = data['id'].to_s
|
675
|
+
return self.put("campaign/" + id + "/updatecampstatus",data.to_json)
|
676
|
+
end
|
677
|
+
|
678
|
+
# Get Access of created senders information.
|
679
|
+
# @param {Array} data contains php array with key value pair.
|
680
|
+
# @options data {String} option: Options to get senders. Possible options – IP-wise, & Domain-wise ( only for dedicated IP clients ). Example: to get senders with specific IP, use $option=’1.2.3.4′, to get senders with specific domain use, $option=’domain.com’, & to get all senders, use $option="" [Optional]
|
681
|
+
def get_senders(data)
|
682
|
+
return self.get("advanced",data.to_json)
|
683
|
+
end
|
684
|
+
|
685
|
+
# Create your Senders.
|
686
|
+
# @param {Array} data contains php array with key value pair.
|
687
|
+
# @options data {String} name: Name of the sender [Mandatory]
|
688
|
+
# @options data {String} email: Email address of the sender [Mandatory]
|
689
|
+
# @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
|
690
|
+
def create_sender(data)
|
691
|
+
return self.post("advanced",data.to_json)
|
692
|
+
end
|
693
|
+
|
694
|
+
# Update your Senders.
|
695
|
+
# @param {Array} data contains php array with key value pair.
|
696
|
+
# @options data {Integer} id: Id of sender to be modified [Mandatory]
|
697
|
+
# @options data {String} name: Name of the sender [Mandatory]
|
698
|
+
# @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
|
699
|
+
def update_sender(data)
|
700
|
+
id = data['id'].to_s
|
701
|
+
return self.put("advanced/" + id,data.to_json)
|
702
|
+
end
|
703
|
+
|
704
|
+
# Delete your Sender Information.
|
705
|
+
# @param {Array} data contains php array with key value pair.
|
706
|
+
# @options data {Integer} id: Id of sender to be deleted [Mandatory]
|
707
|
+
def delete_sender(data)
|
708
|
+
id = data['id'].to_s
|
709
|
+
return self.delete("advanced/" + data,"")
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|
data/sendinblue.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sendinblue/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sendinblue"
|
8
|
+
spec.version = Sendinblue::VERSION
|
9
|
+
spec.date = "2015-09-11"
|
10
|
+
spec.authors = ["SendinBlue Developers"]
|
11
|
+
spec.email = ["contact@sendinblue.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Official SendinBlue API V2 Ruby GEM}
|
14
|
+
spec.description = %q{This is official SendinBlue provided API V2 Ruby GEM. It implements the various exposed APIs that you can read more about on https://apidocs.sendinblue.com.}
|
15
|
+
spec.homepage = "https://www.sendinblue.com/"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
spec.post_install_message = "Thanks for installing!"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "json"
|
25
|
+
spec.add_runtime_dependency "httparty"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sendinblue
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '2.2'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SendinBlue Developers
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: This is official SendinBlue provided API V2 Ruby GEM. It implements the
|
70
|
+
various exposed APIs that you can read more about on https://apidocs.sendinblue.com.
|
71
|
+
email:
|
72
|
+
- contact@sendinblue.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- bin/console
|
82
|
+
- bin/setup
|
83
|
+
- lib/sendinblue.rb
|
84
|
+
- lib/sendinblue/version.rb
|
85
|
+
- sendinblue.gemspec
|
86
|
+
homepage: https://www.sendinblue.com/
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message: Thanks for installing!
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.8
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Official SendinBlue API V2 Ruby GEM
|
110
|
+
test_files: []
|