Blueticks Ruby SDK

Official Ruby client for the Blueticks API. Send WhatsApp messages, manage audiences, run campaigns, and verify webhooks.

Installation

# Gemfile
gem "blueticks"
bundle install
# or:
gem install blueticks

Requires Ruby 3.0 or later. No runtime dependencies — only stdlib.

Usage

require "blueticks"

client = Blueticks::Client.new(api_key: ENV["BLUETICKS_API_KEY"])

message = client.messages.send(to: "12025550100", text: "Hello from Ruby!")
puts message.id
puts message.status

The client falls back to ENV["BLUETICKS_API_KEY"] and ENV["BLUETICKS_BASE_URL"] if you don't pass them explicitly.

Resources

  • client.account
  • client.ping
  • client.messages
  • client.webhooks
  • client.chats
  • client.audiences
  • client.campaigns
  • client.groups
  • client.engines
  • client.contacts
  • client.utils

Webhook signature verification

event = Blueticks::Webhooks.verify(
  payload: request.raw_post,
  headers: request.headers,
  secret: ENV["BLUETICKS_WEBHOOK_SECRET"]
)

puts event.type    # "message.delivered"
puts event.data    # Hash with the event payload

Raises Blueticks::Errors::WebhookVerificationError if the signature, timestamp, or payload doesn't match.

Errors

All API failures raise subclasses of Blueticks::Errors::BluetickError:

  • AuthenticationError (401)
  • PermissionDeniedError (403)
  • NotFoundError (404)
  • BadRequestError (400 / 422)
  • RateLimitError (429)
  • APIError (5xx and other unrecognized statuses)
  • APIConnectionError (network failures)
  • ValidationError (response payload didn't match the expected shape)

Documentation

Full API reference: https://dev.blueticks.co/docs/api

License

MIT — see LICENSE.