Skip to main content

Ruby Example

ruby example
require 'rest-client'
require 'json'
api_key = 'XYZ'
everylog_url = "https://api.everylog.io/api/v1/log-entries"
body = {
projectId: "project-name",
title: "New subscription",
summary: "A new user has subscribed to base plan",
body: "foo@bar.com just subscribed to plan XYZ",
tags: [
"new subscriber",
"welcome"
],
groups: [
"first-group",
"second-group"
],
roles: [
"admin",
"developers"
],
users: [
"user1@example.com",
"user2@example.com"
],
properties: [
{key: "value"},
{key2: "value2"}
],
externalChannels: [
"channel-code",
"other-channel-code"
],
icon: "🤪",
link: "https://www.example.com",
push: true
}

RestClient.post(everylog_url,
body.to_json,
{Authorization: "Bearer #{api_key}",
content_type: :json})