Trigv home

Search docs

Getting started
  • Overview
  • How Trigv works
Help
  • Send test
  • API keys
  • Channels
  • Image attachments
Guides
  • All guides
  • cURL
  • Laravel
  • AI coding agents
  • Cursor
  • Claude Code
  • OpenAI Codex
  • Other agents
SDKs
  • All SDKs
  • JavaScript
  • Python
  • PHP
  • Go
  • Ruby
  • CLI
API reference
  • API overview
  • POST /api/v1/events
  • Errors & rate limits
  • API security
More
  • OpenAPI spec
Open in ChatGPT ↗ Ask questions about this page Open in Claude ↗ Ask questions about this page Open Markdown https://trigv.com/docs-md/sdks/ruby.md

Ruby SDK

Use the official Trigv Ruby SDK to send push notifications from Rails apps, scripts, background jobs, deploy hooks, and CI pipelines.

Install

Add the gem to your Gemfile:

Code
gem 'trigv', '~> 0.1'

Then install:

Code
bundle install

Send a notification

Code
require "trigv"

client = Trigv::Client.new(api_key: ENV.fetch("TRIGV_API_KEY"))

result = client.send_event(
	channel: "general",
	title: "Job finished",
	description: "Nightly sync completed",
	level: "success",
	event_type: "job.completed"
)

puts result.event.public_id

Event fields

FieldRequiredDescription
channelYesChannel slug, such as general, deploys, or payments.
titleYesPush notification title.
descriptionNoBody text shown in the notification.
image_urlNoHTTPS image URL for screenshots, charts, camera snapshots, or previews.
urlNoDestination URL opened from the notification.
levelNoinfo, success, warning, or error. Defaults to info.
delivery_urgencyNostandard or time_sensitive. Defaults to standard.
event_typeNoFree-form event label such as deploy.completed or cron.failed.
idempotency_keyNoDeduplication key for safe retries.

Safe retries with idempotency

Code
result = client.send_event(
	channel: "deploys",
	title: "Production deploy complete",
	idempotency_key: "deploy-prod-42"
)

puts result.duplicate ? "duplicate" : "new"

Configuration

OptionDefaultDescription
api_keyTRIGV_API_KEYWorkspace API key.
base_urlhttps://api.trigv.com/apiAPI base URL.
timeout30Request timeout in seconds.
max_retries2Retry count for retryable failures.

Verify the API key

Code
connection = client.verify_connection
puts connection.workspace.name

Error handling

Code
begin
	client.send_event(channel: "general", title: "Hello")
rescue Trigv::ValidationError => e
	puts e.errors
rescue Trigv::NotFoundError
	puts "Channel not found"
rescue Trigv::RateLimitError => e
	puts e.retryable ? "Retry later" : "Monthly limit reached"
end

Good places to use it

  • Rails jobs, mailers, commands, and operational scripts
  • Sidekiq, GoodJob, Resque, and scheduled background work
  • Deploy hooks and CI pipelines that need a phone alert

Additional resources

Gem RubyGems package Install the official Trigv Ruby SDK from RubyGems. Source code View the Ruby SDK source on GitHub.
Previous Go Next CLI

On this page

    Native push alerts for developers. Send alerts from webhooks, cron jobs, and scripts. We deliver alerts to your devices, but don't keep the message or notification history on our servers.

    Follow @trigvapp →

    Built by Harish Chouhan

    Product

    • Features
    • How it works
    • Pricing
    • Docs
    • Integrations
    • SDKs
    • API
    • Full LLMs text

    Company

    • About
    • Support
    • Changelog

    Legal

    • Terms & Conditions
    • Privacy Policy
    • Cookie Policy
    • API Security
    All systems ok. Get back to coding.

    © 2026 Webtions OU (dba Trigv)