SendX Ruby SDK

Gem Version

SendX - the Ruby gem for the SendX REST API

Introduction

SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations.

The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request.

Installation

Build a gem

To install the gem:

Install via command line

gem install sendx-ruby-sdk

Install via Gemfile

source "https://rubygems.pkg.github.com/sendx" do
  gem "sendx-ruby-sdk", "1.1.0"
end

Install from Git

The Ruby gem is hosted at a git repository: https://github.com/sendx/sendx-ruby-sdk, add the following in the Gemfile:

gem 'sendx-ruby-sdk', :git => 'https://github.com/sendx/sendx-ruby-sdk.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# 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: "[email protected]",
  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

Documentation for API Endpoints

All URIs are relative to https://api.sendx.io/api/v1/rest

Class Method HTTP request Description
SendX::CampaignApi create_campaign POST /campaign Create Campaign
SendX::CampaignApi delete_campaign DELETE /campaign/campaignId Delete Campaign
SendX::CampaignApi edit_campaign PUT /campaign/campaignId Edit Campaign
SendX::CampaignApi get_all_campaigns GET /campaign Get All Campaigns
SendX::CampaignApi get_campaign_by_id GET /campaign/campaignId Get Campaign By Id
SendX::ContactApi create_contact POST /contact Create a contact
SendX::ContactApi delete_contact DELETE /contact/identifier Delete Contact
SendX::ContactApi get_all_contacts GET /contact Get All Contacts
SendX::ContactApi get_contact_by_id GET /contact/identifier Get Contact by Identifier
SendX::ContactApi unsubscribe_contact POST /contact/unsubscribe/identifier Unsubscribe Contact
SendX::ContactApi update_contact PUT /contact/identifier Update Contact
SendX::EventApi create_revenue_event POST /events/revenue Record a revenue event for a specific contact
SendX::EventApi push_custom_event POST /events/custom Push a custom event associated with a contact
SendX::GettingStartedApi identify_contact POST /contact/identify Identify contact
SendX::GettingStartedApi tracking_contact POST /contact/track Add Tracking info
SendX::ListApi create_list POST /list Create List
SendX::ListApi delete_list DELETE /list/listId Delete List
SendX::ListApi get_all_lists GET /list Get All Lists
SendX::ListApi get_list_by_id GET /list/listId Get List
SendX::ListApi update_list PUT /list/listId Update List
SendX::ReportsApi get_campaign_report GET /report/campaign/campaignId Get CampaignReport Data
SendX::SenderApi create_sender POST /sender Create Sender
SendX::SenderApi get_all_senders GET /sender Get All Senders
SendX::TagsApi create_tag POST /tag Create a Tag
SendX::TagsApi delete_tag DELETE /tag/tagId Delete a Tag
SendX::TagsApi get_all_tags GET /tag Get All Tags
SendX::TagsApi get_tag_by_id GET /tag/tagId Get a Tag by ID
SendX::TagsApi update_tag PUT /tag/tagId Update a Tag

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

apiKeyAuth

  • Type: API key
  • API key parameter name: X-Team-ApiKey
  • Location: HTTP header