Giter VIP home page Giter VIP logo

apiv3-ruby-library's People

Contributors

aakanksha-sib avatar nagendrasib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

apiv3-ruby-library's Issues

params for a template

Hello again,

I noticed another difference between v2 and v3 api. If you define a HTML template and you pass some params (send_transac_email) via api to it, in version 2 it was possible to send html in these params to the template, which was very useful. In v3 however the html-params gets insert as text.

SSL peer certificate or SSH remote key was not OK

Hello Brevo-Team,

I am trying to configure the api_instance according to the guide in the README.md and receive following error:
SSL peer certificate or SSH remote key was not OK

I am providing the correct API key and even pass it as a direct string to config.api_key['api-key'], though I am still receiving the error above.

This is my code in Ruby:

require 'sib-api-v3-sdk'

SibApiV3Sdk.configure do |config|
  config.api_key['api-key'] = ENV["BREVO_API"]
end

api_instance = SibApiV3Sdk::AccountApi.new

begin
  result = api_instance.get_account
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "#{e}"
end

It would be nice to know what exactly I am doing wrong. Thank you in advance.

PS: It seems I can't label my own issue, sorry about that.

template_id with smtp ActionMailer::Base

Hello guys,

I am trying to pass in template_id with transactional email that is send from my email class

mail to: email, subject: subject, template_id: '14'

Can i reuse default ActionMailer to send email with template id ?
Like this one

Send bcc email to multiple recipients

I cannot send a transactional bcc email to multiple recipients without having the email.to. Specifically the following code works.

`
api_instance = SibApiV3Sdk::TransactionalEmailsApi.new

email = SibApiV3Sdk::SendSmtpEmail.new
email.sender = {
  "name": "Sender_name",
  "email": "[email protected]"
}

email.to = [{ "email": "[email protected]" } ] #bad request when this line is not present
email.bcc = [{ "email": "[email protected]"}, { "email": "[email protected]"} ]

email.text_content = body_text
email.subject = subject_text

api_instance.send_transac_email(email)

`

However, without the email.to line I get a SibApiV3Sdk::ApiError (Bad Request) with response_code=400.

How can I resolve this?

URI.escape is obsolete (Ruby 2.7)

In Ruby 2.7, URI.escape (aliased as URI.encode) is marked as obsolete and displays a warning:

/Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/sib-api-v3-sdk-7.1.0/lib/sib-api-v3-sdk/configuration.rb:178: warning: URI.escape is obsolete
/Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/sib-api-v3-sdk-7.1.0/lib/sib-api-v3-sdk/api_client.rb:267: warning: URI.escape is obsolete

This method has been marked as deprecated for a long time and will be removed in Ruby 3.0.

There are several ways to replace it, depending on the result you want (URI.escape behaviour was wrong when handling certain characters, like spaces).

For example you can use URI.encode_www_form_component(string) but this will replace spaces with +. So you could also do URI.encode_www_form_component(string).gsub('+', '%20').
Another way is to use the addressable gem. See for example docusign/docusign-esign-ruby-client#45 (comment)

Error Date::Error (invalid date) on get_email_campaigns method

I get this error with this command:

irb(main):004:0> api_instance = SibApiV3Sdk::EmailCampaignsApi.new
irb(main):005:0> result = api_instance.get_email_campaign(3)
/gems/ruby/2.7.0/gems/sib-api-v3-sdk-5.2.5/lib/sib-api-v3-sdk/configuration.rb:178: warning: URI.escape is obsolete
/gems/ruby/2.7.0/gems/sib-api-v3-sdk-5.2.5/lib/sib-api-v3-sdk/api_client.rb:267: warning: URI.escape is obsolete
ETHON: performed EASY effective_url=https://api.sendinblue.com/v3/emailCampaigns/3 response_code=200 return_code=ok total_time=0.773227
Traceback (most recent call last):
        1: from (irb):5
Date::Error (invalid date)

Bad documentation error

Hi,

You really should take care about your documentation (along with better error descriptions). The following cost me and my employer 2 working days.

Under send_transac_email the api call wants an object SibApiV3Sdk::SendSmtpEmail.
Since I wanted to use a predefined template I added as the documentation states template_id. But that is the wrong key. It wants templateId.

how to configure smtp setting for sent all emails using this gem in development.rb

Hi,

i'm using brevo for sent welcome emails to users. here is smtp setting that i get from brevo.

      SMTP Server: smtp-relay.brevo.com
      Port: 587
      Login: [email protected]
      SMTP key: kjdsjdsfjsdj-323646623hjjkfshdhfjdsh
      API key: jjdfk3423423jk23jk423j42jjkj4k23-3432jkjjkjkjkjjjkj23jjj-jfklsjdjsfdkjfsjdkfjksjkdjk

here is my development.rb settings

      config.action_mailer.default_url_options = { host: 'localhost:3000' }

      config.action_mailer.smtp_settings = {
         :address              => "smtp-relay.brevo.com",
         :port                 => 587,
         :user_name            => '[email protected]',
         :password             => "   'I TRY "SMTP KEY and also API KEY HERE'   ",
         :authentication       => "plain",
         :enable_starttls_auto => true
        }

Rails console show me to sent email to desired address. But receive no email in that address. there is no error.

Any help please.

Thanks

mailer is not testable

we want to use sendinblue for our new rails project. But we can not find any way to test our code using this gem. Looking at https://github.com/postageapp/postageapp-ruby the integration into ActionMailer is very different. Postageapp gives keeps the rails interface working and we can test the code.

class UserMailer < ApplicationMailer

  def invitation_instructions(record, token, opts={})
    @sendinblue = SibApiV3Sdk::TransactionalEmailsApi.new
    @email.subject = "You are invited to Elloworks"
    @sendinblue.send_transac_email(@email)
  end

With sendinblue we are not able to test any of the mailings we send out - so sending out emails could break with any release without us knowing about it. Did we miss anything? Can you help us out? If we use smtp it is fine - but we wanted to use the API and templates managed in sendinblue.

Snakecase doesn't work, have to use camelcase

Using snakecase for API attributes written in documentation doesn't seem to work. We have to send options in camelcase to match REST API.

Simple example for create_contact - this doesn't work:

SibApiV3Sdk::ContactsApi.new.create_contact(
  email: email,
  list_ids: [list_id],
  update_enabled: true,
)

While this works:

SibApiV3Sdk::ContactsApi.new.create_contact(
  email: email,
  listIds: [list_id],
  updateEnabled: true,
)

Speed up Gem load time

Hello

When I run bumbler (bumbler --all) SIB is by fare the slowest gem to load.
This is slowing down every rails s / rails c commands

Is there a way to speed up this loading time ?
I only need a few methods from this gem, is there a way to require only a few API routes? (I tried but didn't succeeded)

Thanks

Unable to assign new contact to list using create_contact method

def create
  sib = SibApiV3Sdk::ContactsApi.new
  contact = Contact.new(contact_params)
  return render_error unless contact.valid?
  begin
    result = sib.create_contact(email: contact.email, attributes: { COUNTRY: contact.country }, list_ids: [5], update_enabled: true)
  rescue SibApiV3Sdk::ApiError => e
    puts e
  end
end

Using the above the code I am unable to assign a new contact to a list with id: 5. But the contact is added to the global contact list, and a contact ID is returned from the API.

Please can you advise. Thanks

getting same email twice via send_transac_email

I use gem 'sib-api-v3-sdk', '~> 7.1.0' & ruby 2.7.2.

Have a problem with sending emails. When I use SibApiV3Sdk::TransactionalEmailsApi.new.send_transac_email(@email) then same email is sent twice.

Screenshot 2021-07-02 at 13 43 09
Screenshot 2021-07-02 at 12 57 54

It is happening on stage env, and only via a cron task (use whenever gem, the task is running every 5 minutes). Can't reproduce it locally (works as expected), when run it with rake mailing:send_timed_reminders on stage works fine as well (sends only 1 email)

I put puts before SibApiV3Sdk::TransactionalEmailsApi.new.send_transac_email(@email) and here on the screen is proof that code was run only once, but on the screenshots above you can see 2 emails were sent.
Screenshot 2021-07-02 at 13 21 23

Does anyone have an idea why is it happening? thanks for the help in advance)

You need to install gem addressable

Hi there
In your api_client.rb you are calling

require 'addressable/uri'

but there is no dependecy declared

I had to install addressable by my side.

Date type regression since 7.4.0

Hello.

When using this code:

sib = SibApiV3Sdk::TransactionalEmailsApi.new
resp = sib.get_email_event_report(...etc...)
date = resp.events.first.date
[date, date.class]

With version 7.3 the result was:
[Mon, 07 Mar 2022 16:53:41 +0100, DateTime]
The SDK provided a DateTime object as event date.

Starting with version 7.4 the result is:
["2022-03-07T16:53:41.137+01:00", String]
The SDK now provides a String as event date, in ISO-8601 format (also used in JSON I think).

We discovered this regression while upgrading to version 8.1.0 for "loaded by proxy" event type support. And then found the changing gem version by trying gem versions one by one.

From a SDK in my opinion we expect ready-to-use objects like DateTime, not Strings we need to parse first.

Cannot find a way to send bulk personalized emails

New to the platform and API; we're trying to send a bulk template to ~10,000 users, each recipient personalized with params.

It seems SibApiV3Sdk::SMTPApi#send_transac_email is only capable of one recipient and/or params object at a time?

And the same goes for SibApiV3Sdk::EmailCampaignsApi#send_email_campaign_now. It can take multiple recipients but only a single params object? So I cannot send to multiple people, the same template, personalized for each of them?

Minimum version for gem 'json'

Hello guys,
We are going to use your sdk in our project.
We got an error while installing this gem:

Bundler could not find compatible versions for gem "json":
  In snapshot (Gemfile.lock):
    json (= 1.8.6)

  In Gemfile:
    dm-serializer was resolved to 1.2.2, which depends on
      json (~> 1.6)

    sib-api-v3-sdk was resolved to 5.2.4, which depends on
      json (>= 2.1.0, ~> 2.1)

We have few gems which depends on json (~> 1.6). So, it's hard to us to update them.
I've create PR for it. Could you please take a look at #32

Better Errors

Currently when there is an error with the API request, the gem just returns Bad request, would be nice to receive the same message as when we send the same request by CURL (usually states what is wrong, be it a missing parameter or something else).

Multiple Reply To

Is there a way to have multiple reply_to?

Using SendInBlue with Rails ActionMailer allows to set up multiple reply_to emails
mail(to: "[email protected]", subject: "Subject", message: "Message", reply_to: ["[email protected]", "[email protected]"])

However, when using the SendInBlue API I can only set one
https://github.com/sendinblue/APIv3-ruby-library/blob/master/docs/SendSmtpEmailReplyTo.md

From https://www.rfc-editor.org/rfc/rfc5322#section-3.6.2

In either case, an optional reply-to field MAY also be included, which contains the field name "Reply-To" and a comma-separated list of one or more addresses.

send transactional sms Error

Hi there !

api_key = "xkeysib-XXXXXXX"

SibApiV3Sdk.configure do |config|
  config.api_key['api-key'] = api_key
  onfig.api_key['partner-key'] = api_key
end

api_instance = SibApiV3Sdk::TransactionalSMSApi.new
send_transac_sms = SibApiV3Sdk::SendTransacSms.new

send_transac_sms_params = {"sender":"test", "recipient":"+336XXXXXXX", "content":"content test"}

api_instance.send_transac_sms(send_transac_sms_params)

I got the error below

ETHON: performed EASY effective_url=https://api.sendinblue.com/v3/transactionalSMS/sms response_code=400 return_code=ok total_time=0.174188
SibApiV3Sdk::ApiError: 
from /Users/vincentsimon/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sib-api-v3-sdk-7.4.0/lib/sib-api-v3-sdk/api_client.rb:65:in `call_api'

New event type loadedByProxy is filtered out

A few days ago the SIB API v3 was modified to provide a new event type "loadedByProxy".
However these events are filtered out by the Ruby SDK when using e.g. :
SibApiV3Sdk::TransactionalEmailsApi#get_email_event_report()

By the way I suggest that the list of event types relevant for emails could be "factorized" somewhere in the SDK, instead of being repeated in multiple methods (DRY principle).

New "sort" param for GetEmailEventReport

Hello.

(I take the opportunity to emphasize the quality of code and documentation here. :-)

It seems that a "sort" query parameter was added recently for GetEmailEventReport :
https://developers.sendinblue.com/reference#getemaileventreport-1

sort (string) = asc | desc
Sort the results in the ascending/descending order of record creation

Do you plan to also add that parameter in the SDK ?
https://github.com/sendinblue/APIv3-ruby-library/blob/master/docs/GetEmailEventReportEvents.md

BTW, the API change breaks compatibility: the default is now to return events in "most recent first" order. Unless we get this parameter very soon, we will have to change our code substantially.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.