Create a key to copy examples filled with your team.
Send emails with Ruby
POST /sends with Net::HTTP.
POST /sends with Net::HTTP. PostShiba has no official gem.
send.rb
1
require "net/http"
2
require "json"
3
4
uri = URI("https://postshiba.com/api/v1/teams/1/clusters/4/sends")
5
http = Net::HTTP.new(uri.host, uri.port)
6
http.use_ssl = true
7
8
request = Net::HTTP::Post.new(uri)
9
request["Authorization"] = "Bearer YOUR_API_KEY"
10
request["Content-Type"] = "application/json"
11
request.body = {
12
send: {
13
from: "hello@mail.example.com",
14
to: ["you@example.com"],
15
subject: "PostShiba test",
16
text: "hello from PostShiba",
17
html: "<p>hello from PostShiba</p>",
18
unique_args: {campaign_id: "cmp_123", site: "docs"}
19
}
20
}.to_json
21
22
response = http.request(request)
23
puts response.body