Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sending smart transactional email results in CreateSend::ServerError #42

Open
fredmcgroarty opened this issue Aug 26, 2015 · 1 comment

Comments

@fredmcgroarty
Copy link

I'm not sure if this an issue or not. But as the issue says I am trying to send smart transactional emails and can't get past this error

CreateSend::ServerError: CreateSend::ServerError
from /Users/*******/.rvm/gems/ruby-2.2.0/gems/createsend-4.1.0/lib/createsend/createsend.rb:283:in `handle_response'

verbatim, this is the ruby class from which I am trying to make calls to campaign monitor


class Indigo 
  require 'createsend'

  extend Formats

  API_KEY = "*********************"
  BOOKING_CONFIRMATION_ID = "028ec00a-e764-4291-a294-***********"

  def self.booking_confirmation(booking) 
    hashify_and_send_booking(BOOKING_CONFIRMATION_ID, booking) if booking
  end

  def self.hashify_and_send_booking(type, booking)
    smart_transactional_email(type).send(hashify_booking(booking)) 
  end

  private

  def self.hashify_booking(booking)
    h=Hash.new.tap do |ph|
      ph[:To] = [booking.firstname, "<#{booking.email}>"]
      ph[:Data] = Hash.new.tap do |dh|
        dh["firstName"] = booking.firstname
        dh["spaceTitle"] = booking.space_title
        dh["venueTitle"] = booking.venue_title
        dh["bookingDate"] = formatted_datetime booking.booked_from
        dh["bookingId"] = booking.id
      end
    end
    JSON.generate h      
  end

  def self.smart_transactional_email(type)
    CreateSend::Transactional::SmartEmail.new({api_key: API_KEY}, type)
  end

end 

I can't be sure if it an error with createsend or something i am doing wrong

@asadighi
Copy link

Hi,

Thanks for reaching out. My name is Aidin and I am the Technical Lead for Integrations and APIs in Campaign Monitor. I would be more than happy to help out.

Do you still experience this issue?

Thanks,
Aidin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants