0

I am trying to setup a Triggered Send within my Rails-5.1.1 app. It is transactional upon creating an object. I am using the Marketing Cloud SDK formally named as Fuel SDK.

Objective:

  1. Add Subscriber Data to either List -or- Data Extension. (Both are set-up)

  2. Send an Email to new Subscriber

I am assigning the List Name of which I would like to send to as the CustomerKey, and I would like to know if this correct?

I have a List created which a TriggeredSend is using as Subscriber management.

The error and code are below. I am positive this is not setup correctly and would like some direction. Appreciate any help.

Rails 5.1.1

Ruby 2.3.1

gem 'marketingcloudsdk'

Error

"Send Status: false"
"Code: 200"
"Message: Error"
"Result Count: 1"
"Results: [{:status_code=>\"Error\", :status_message=>\"The Triggered Send is not completely configured or in a new status.  Please check Triggered Send Definition configuration.\", :ordinal_id=>\"0\", :error_code=>\"18002\", :new_id=>\"0\", :\"@xsi:type\"=>\"TriggeredSendCreateResult\"}]"
"Exception: Failure sending TriggerSend"

Function

  require 'marketingcloudsdk'
  def thank_you_email
    begin
      myclient = MarketingCloudSDK::Client.new({'client' => {'id' => ENV['SF_CLIENT_ID'],
                                                            'secret' => ENV['SF_CLIENT_SECRET']}})
      sendTrig = MarketingCloudSDK::TriggeredSend.new
      sendTrig.authStub = myclient
      sendTrig.props = [{"CustomerKey" => "ENV['SF_TRIGGERED_SEND_EXTERNAL_KEY']",
                         "Subscribers" => {"EmailAddress"=>"#{self.concierge_email}",
                                           "SubscriberKey" => "#{self.concierge_email}"},
                         "Attributes" => {
                            "concierge_email" => "#{self.concierge_email}",
                            "concierge_name" => "#{self.concierge_name}",
                            "concierge_number" => "#{self.concierge_number}"
                            }
                        }]
      results = sendTrig.send

      p 'Send Status: ' + results.status.to_s
      p 'Code: ' + results.code.to_s
      p 'Message: ' + results.message.to_s
      p 'Result Count: ' + results.results.size.to_s
      p 'Results: ' + results.results.inspect

      raise 'Failure sending TriggerSend' unless results.success?
    rescue => e
      p 'Exception: ' + e.message.to_s
    end
  end
0

The CustomerKey is the external key of the triggered send you set up in Email Studio under Interactions. The List of your Audience needs to be selected when creating the triggered send and subscribers are automatically added to this list if you selected this option when defining the triggered send.

Creating a triggered email in Email Studio works like this:

  1. Go to Email Studio -> Interactions -> Messages -> Email -> Triggered Sends -> Create
  2. Create Triggered Send
  3. Complete Properties-form (here you select your external key you need as CustomerKey)
  4. Select the created email to send
  5. Complete Subscribers management-form
  6. Set send options
  7. Save

Additional and detailed information on the various options can be found in the following documentation article: Create a Triggered Email Message.

EDIT: Before you can use the triggered send you need to start it. That's the reason for the error message in the updated question. The full process can be found in the documentation about the Triggered Email Creation Process.

Starting a Triggered Email can be done in Email Studio -> Interactions -> Messages -> Email -> Triggered Sends by selecting the triggered send and clicking on the "Start/Restart" button above the table containing your triggered sends.

  • Thank you. I have set-up the triggered send to use a list I created for Subscriber management. I updated my code to use the External Key from this triggered send and now receive the new error I displayed. Appreciate the help. – Alexander Smith Jun 14 '17 at 16:18
  • Before you can use the triggered send you need to start it. That's the reason for the error message in the updated question. – Markus Slabina Jun 14 '17 at 16:19
  • You are welcome, glad I could help! – Markus Slabina Jun 14 '17 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.