Learn how to configure and add your first contact with SendX Ruby SDK
gem install sendx-ruby-sdk
# 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
Was this page helpful?