Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

Get the ruby sendx sdk

shell
gem install sendx-ruby-sdk

2. Getting Started

Ruby
# Load the gem
require 'time'
require 'sendx-ruby-sdk'
# setup authorization
SendX.configure do |config|
  # Configure API key authorization: apiKeyAuth
  config.api_key['apiKeyAuth'] = 'YOUR API KEY'
  config.server_index = 2
end

api_instance = SendX::ContactApi.new
contact_request = SendX::ContactRequest.new(
  email: "john@doe.com",
  first_name: "John",
  last_name: "Doe",
  company: "SendX",
  last_tracked_ip: "34.94.159.140",
  tags: ["MKdhTovsTJDetCyrJmRySL"],
  custom_fields: {
        'fnwfnke23kn4kn' => "VIP",
        "9i0jinjn0ib0"=> "Subscribers"
    },
)

begin
  # Create a contact
  result = api_instance.create_contact(contact_request)
  p result
rescue SendX::ApiError => e
  puts "Error when calling ContactApi->create_contact: #{e}"
end

3. Try it yourself

Ruby Example

See detailed sdk example