Skip to content

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

Description

@fredmcgroarty

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions