Ruby SDK

Setup & Initialization

  1. Install:
gem install pingram

Or add to your Gemfile:

gem 'pingram'
  1. Require and initialize:
require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
NameTypeDescription
api_key*stringYour Pingram API key. You can get it from your dashboard under Environments.
base_urlstringOptional. Override the base URL. Use https://api.ca.pingram.io for the Canada region, and https://api.eu.pingram.io for the EU region. Default: US region.

* required

Region specific example:

client = Pingram::Client.new(api_key: 'YOUR_API_KEY', base_url: 'https://api.eu.pingram.io')

Send

call_send()

Send a notification

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::SenderPostBody.new # configure as needed

begin
  result = client.send(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling call_send: #{e}"
end

Parameters

NameTypeDescriptionNotes
sender_post_bodySenderPostBodySee Request Body Properties below

Request Body Properties

NameTypeDescription
typestring
toobject
to.idstring
to.emailstring
to.numberstring
to.pushTokensobject[]
to.pushTokens[].type”FCM” | “APN”(required)
to.pushTokens[].tokenstring(required)
to.pushTokens[].deviceobject(required)
to.pushTokens[].device.app_idstring
to.pushTokens[].device.ad_idstring
to.pushTokens[].device.device_idstring(required)
to.pushTokens[].device.platformstring
to.pushTokens[].device.manufacturerstring
to.pushTokens[].device.modelstring
to.pushTokens[].environmentstringused by APN to differentiate between sandbox and production builds (sandbox/undefined or production)
to.webPushTokensobject[]
to.webPushTokens[].subobject(required) Configuration for a Push Subscription. This can be obtained on the frontend by calling serviceWorkerRegistration.pushManager.subscribe(). The expected format is the same output as JSON.stringify’ing a PushSubscription in the browser.
to.webPushTokens[].sub.endpointstring(required)
to.webPushTokens[].sub.keysobject(required)
to.webPushTokens[].sub.keys.p256dhstring(required)
to.webPushTokens[].sub.keys.authstring(required)
to.timezonestring
to.slackChannelstringThe destination channel of slack notifications sent to this user. Can be either of the following: - Channel name, e.g. “test” - Channel name with # prefix, e.g. “#test” - Channel ID, e.g. “C1234567890” - User ID for DM, e.g. “U1234567890” - Username with @ prefix, e.g. “@test”
to.slackTokenobject
to.slackToken.access_tokenstring
to.slackToken.app_idstring
to.slackToken.authed_userobject
to.slackToken.authed_user.access_tokenstring
to.slackToken.authed_user.expires_innumber
to.slackToken.authed_user.idstring
to.slackToken.authed_user.refresh_tokenstring
to.slackToken.authed_user.scopestring
to.slackToken.authed_user.token_typestring
to.slackToken.bot_user_idstring
to.slackToken.enterpriseobject
to.slackToken.enterprise.idstring
to.slackToken.enterprise.namestring
to.slackToken.errorstring
to.slackToken.expires_innumber
to.slackToken.incoming_webhookobject
to.slackToken.incoming_webhook.channelstring
to.slackToken.incoming_webhook.channel_idstring
to.slackToken.incoming_webhook.configuration_urlstring
to.slackToken.incoming_webhook.urlstring
to.slackToken.is_enterprise_installboolean
to.slackToken.neededstring
to.slackToken.okboolean(required)
to.slackToken.providedstring
to.slackToken.refresh_tokenstring
to.slackToken.scopestring
to.slackToken.teamobject
to.slackToken.team.idstring
to.slackToken.team.namestring
to.slackToken.token_typestring
to.slackToken.warningstring
to.slackToken.response_metadataobject
to.slackToken.response_metadata.warningsstring[]
to.slackToken.response_metadata.next_cursorstring
to.slackToken.response_metadata.scopesstring[]
to.slackToken.response_metadata.acceptedScopesstring[]
to.slackToken.response_metadata.retryAfternumber
to.slackToken.response_metadata.messagesstring[]
to.lastSeenTimestring
to.updatedAtstring
to.createdAtstring
to.emailSuppressionStatusobject
to.emailSuppressionStatus.reason”Bounce” | “Complaint”(required)
to.emailSuppressionStatus.detailsobject(required)
forceChannels(“EMAIL” | “INAPP_WEB” | “SMS” | “CALL” | “PUSH” | “WEB_PUSH” | “SLACK”)[]
parametersRecord<string, any>
secondaryIdstring
templateIdstring
subNotificationIdstring
optionsobject
options.emailobject
options.email.replyToAddressesstring[]
options.email.ccAddressesstring[]
options.email.bccAddressesstring[]
options.email.fromAddressstring
options.email.fromNamestring
options.email.attachments(object | object)[]
options.email.conditionstring
options.apnobject
options.apn.expirynumber
options.apn.prioritynumber
options.apn.collapseIdstring
options.apn.threadIdstring
options.apn.badgenumber
options.apn.soundstring
options.apn.contentAvailableboolean
options.fcmobject
options.fcm.androidobject
options.fcm.android.collapseKeystring
options.fcm.android.priority”high” | “normal”
options.fcm.android.ttlnumber
options.fcm.android.restrictedPackageNamestring
schedulestring
emailobject
email.subjectstring(required)
email.htmlstring(required)
email.previewTextstring
email.senderNamestring
email.senderEmailstring
inappobject
inapp.titlestring(required)
inapp.urlstring
inapp.imagestring
smsobject
sms.messagestring
sms.autoReplyobject
sms.autoReply.messagestring(required)
callobject
call.messagestring(required)
web_pushobject
web_push.titlestring(required)
web_push.messagestring(required)
web_push.iconstring
web_push.urlstring
mobile_pushobject
mobile_push.titlestring(required)
mobile_push.messagestring(required)
slackobject
slack.textstring(required)
slack.blocksRecord<string, any>[]
slack.usernamestring
slack.iconstring
slack.thread_tsstring
slack.reply_broadcastboolean
slack.parse”full” | “none”
slack.link_namesboolean
slack.mrkdwnboolean
slack.unfurl_linksboolean
slack.unfurl_mediaboolean
slack.metadataobjectSlack message metadata with optional work object entities. Combines standard Slack message metadata fields with an array of entity objects.
slack.metadata.entitiesobject[]An array of work object entities.
slack.metadata.entities[].entity_typestring(required) Entity type (e.g., ‘slack#/entities/task’, ‘slack#/entities/file’).
slack.metadata.entities[].entity_payloadRecord<string, any>(required) Schema for the given entity type.
slack.metadata.entities[].external_refobject(required) Reference used to identify an entity within the developer’s system.
slack.metadata.entities[].external_ref.idstring(required)
slack.metadata.entities[].external_ref.typestring
slack.metadata.entities[].urlstring(required) URL used to identify an entity within the developer’s system.
slack.metadata.entities[].app_unfurl_urlstringThe exact URL posted in the source message. Required in metadata passed to chat.unfurl.
slack.metadata.event_typestringA human readable alphanumeric string representing your application’s metadata event.
slack.metadata.event_payloadRecord<string, any>A free-form object containing whatever data your application wishes to attach to messages.

Return Type

SenderPostResponse

Domains

domains_add_domain()

Request to verify a new sender domain

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::PostSendersRequestBody.new # configure as needed

begin
  result = client.domains.domains_add_domain(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling domains_add_domain: #{e}"
end

Parameters

NameTypeDescriptionNotes
post_senders_request_bodyPostSendersRequestBodySee Request Body Properties below

Request Body Properties

NameTypeDescription
senderstring(required)

Return Type

Array&lt;GetSendersResponseInner&gt;

domains_delete_domain()

Delete a sender domain or email address

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.domains.domains_delete_domain
  p result
rescue Pingram::ApiError => e
  puts "Error when calling domains_delete_domain: #{e}"
end

Parameters

NameTypeDescriptionNotes
senderStringSender domain or email address (URL encoded)

Return Type

SuccessResponse

domains_list_domains()

Get all sender domains configured for the account

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.domains.domains_list_domains
  p result
rescue Pingram::ApiError => e
  puts "Error when calling domains_list_domains: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

Array&lt;GetSendersResponseInner&gt;

Environments

environments_create_environment()

Create a new environment for the account

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::EnvironmentCreateRequest.new # configure as needed

begin
  result = client.environments.environments_create_environment(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling environments_create_environment: #{e}"
end

Parameters

NameTypeDescriptionNotes
environment_create_requestEnvironmentCreateRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
titlestring(required)

Return Type

Environment

environments_list_environments()

Get all environments for the authenticated account

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.environments.environments_list_environments
  p result
rescue Pingram::ApiError => e
  puts "Error when calling environments_list_environments: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

Array&lt;GetEnvironmentsResponseInner&gt;

environments_update_environment()

Update environment settings (title, secret, disable sending, secure mode)

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::EnvironmentPatchRequest.new # configure as needed

begin
  result = client.environments.environments_update_environment(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling environments_update_environment: #{e}"
end

Parameters

NameTypeDescriptionNotes
client_idStringEnvironment client ID
environment_patch_requestEnvironmentPatchRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
resetSecretboolean
disableSending(“EMAIL” | “INAPP_WEB” | “SMS” | “CALL” | “PUSH” | “WEB_PUSH” | “SLACK”)[]
titlestring
secureModeboolean

Return Type

Environment

Logs

logs_get_log_retention()

Get log retention period in days for the account

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.logs.logs_get_log_retention
  p result
rescue Pingram::ApiError => e
  puts "Error when calling logs_get_log_retention: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

LogsRetentionResponse

logs_get_logs()

List logs for the authenticated account

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.logs.logs_get_logs
  p result
rescue Pingram::ApiError => e
  puts "Error when calling logs_get_logs: #{e}"
end

Parameters

NameTypeDescriptionNotes
limitFloatMaximum number of logs to return (default[optional]
cursorStringPagination cursor for next page[optional]

Return Type

GetLogsResponse

logs_get_logs_by_tracking_ids()

Get logs by tracking IDs (comma-separated, max 25 IDs)

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.logs.logs_get_logs_by_tracking_ids
  p result
rescue Pingram::ApiError => e
  puts "Error when calling logs_get_logs_by_tracking_ids: #{e}"
end

Parameters

NameTypeDescriptionNotes
tracking_idsStringComma-separated tracking IDs (URL encoded)

Return Type

LogsGetResponse

logs_get_logs_query_result()

Get results from a query ID

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.logs.logs_get_logs_query_result
  p result
rescue Pingram::ApiError => e
  puts "Error when calling logs_get_logs_query_result: #{e}"
end

Parameters

NameTypeDescriptionNotes
query_idStringQuery ID

Return Type

LogsQueryResultResponse

logs_start_logs_query()

Start a log query and return query ID for asynchronous log searching

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::LogQueryPostBody.new # configure as needed

begin
  result = client.logs.logs_start_logs_query(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling logs_start_logs_query: #{e}"
end

Parameters

NameTypeDescriptionNotes
log_query_post_bodyLogQueryPostBodySee Request Body Properties below

Request Body Properties

NameTypeDescription
dateRangeFilternumber[]A tuple of [startTime, endTime] for the date range filter, each representing a unix timestamp.
userFilterstring
envIdFilterstring[]
statusFilterstring
channelFilter(“email” | “inapp” | “sms” | “call” | “web_push” | “mobile_push” | “slack”)[]
notificationFilterstring[]

Return Type

LogsQueryResponse

logs_tail_logs()

Get last 100 logs from the stream

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.logs.logs_tail_logs
  p result
rescue Pingram::ApiError => e
  puts "Error when calling logs_tail_logs: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

LogsTailResponse

Sender

sender_delete_schedule()

Delete (unschedule) an already scheduled notification

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.sender.sender_delete_schedule
  p result
rescue Pingram::ApiError => e
  puts "Error when calling sender_delete_schedule: #{e}"
end

Parameters

NameTypeDescriptionNotes
tracking_idStringThe tracking ID of the scheduled notification

Return Type

MessageResponse

sender_update_schedule()

Update the body or schedule of an already scheduled notification.

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::SenderPostBody.new # configure as needed

begin
  result = client.sender.sender_update_schedule(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling sender_update_schedule: #{e}"
end

Parameters

NameTypeDescriptionNotes
tracking_idStringThe tracking ID of the scheduled notification
sender_post_bodySenderPostBodySee Request Body Properties below

Request Body Properties

NameTypeDescription
typestring
toobject
to.idstring
to.emailstring
to.numberstring
to.pushTokensobject[]
to.pushTokens[].type”FCM” | “APN”(required)
to.pushTokens[].tokenstring(required)
to.pushTokens[].deviceobject(required)
to.pushTokens[].device.app_idstring
to.pushTokens[].device.ad_idstring
to.pushTokens[].device.device_idstring(required)
to.pushTokens[].device.platformstring
to.pushTokens[].device.manufacturerstring
to.pushTokens[].device.modelstring
to.pushTokens[].environmentstringused by APN to differentiate between sandbox and production builds (sandbox/undefined or production)
to.webPushTokensobject[]
to.webPushTokens[].subobject(required) Configuration for a Push Subscription. This can be obtained on the frontend by calling serviceWorkerRegistration.pushManager.subscribe(). The expected format is the same output as JSON.stringify’ing a PushSubscription in the browser.
to.webPushTokens[].sub.endpointstring(required)
to.webPushTokens[].sub.keysobject(required)
to.webPushTokens[].sub.keys.p256dhstring(required)
to.webPushTokens[].sub.keys.authstring(required)
to.timezonestring
to.slackChannelstringThe destination channel of slack notifications sent to this user. Can be either of the following: - Channel name, e.g. “test” - Channel name with # prefix, e.g. “#test” - Channel ID, e.g. “C1234567890” - User ID for DM, e.g. “U1234567890” - Username with @ prefix, e.g. “@test”
to.slackTokenobject
to.slackToken.access_tokenstring
to.slackToken.app_idstring
to.slackToken.authed_userobject
to.slackToken.authed_user.access_tokenstring
to.slackToken.authed_user.expires_innumber
to.slackToken.authed_user.idstring
to.slackToken.authed_user.refresh_tokenstring
to.slackToken.authed_user.scopestring
to.slackToken.authed_user.token_typestring
to.slackToken.bot_user_idstring
to.slackToken.enterpriseobject
to.slackToken.enterprise.idstring
to.slackToken.enterprise.namestring
to.slackToken.errorstring
to.slackToken.expires_innumber
to.slackToken.incoming_webhookobject
to.slackToken.incoming_webhook.channelstring
to.slackToken.incoming_webhook.channel_idstring
to.slackToken.incoming_webhook.configuration_urlstring
to.slackToken.incoming_webhook.urlstring
to.slackToken.is_enterprise_installboolean
to.slackToken.neededstring
to.slackToken.okboolean(required)
to.slackToken.providedstring
to.slackToken.refresh_tokenstring
to.slackToken.scopestring
to.slackToken.teamobject
to.slackToken.team.idstring
to.slackToken.team.namestring
to.slackToken.token_typestring
to.slackToken.warningstring
to.slackToken.response_metadataobject
to.slackToken.response_metadata.warningsstring[]
to.slackToken.response_metadata.next_cursorstring
to.slackToken.response_metadata.scopesstring[]
to.slackToken.response_metadata.acceptedScopesstring[]
to.slackToken.response_metadata.retryAfternumber
to.slackToken.response_metadata.messagesstring[]
to.lastSeenTimestring
to.updatedAtstring
to.createdAtstring
to.emailSuppressionStatusobject
to.emailSuppressionStatus.reason”Bounce” | “Complaint”(required)
to.emailSuppressionStatus.detailsobject(required)
forceChannels(“EMAIL” | “INAPP_WEB” | “SMS” | “CALL” | “PUSH” | “WEB_PUSH” | “SLACK”)[]
parametersRecord<string, any>
secondaryIdstring
templateIdstring
subNotificationIdstring
optionsobject
options.emailobject
options.email.replyToAddressesstring[]
options.email.ccAddressesstring[]
options.email.bccAddressesstring[]
options.email.fromAddressstring
options.email.fromNamestring
options.email.attachments(object | object)[]
options.email.conditionstring
options.apnobject
options.apn.expirynumber
options.apn.prioritynumber
options.apn.collapseIdstring
options.apn.threadIdstring
options.apn.badgenumber
options.apn.soundstring
options.apn.contentAvailableboolean
options.fcmobject
options.fcm.androidobject
options.fcm.android.collapseKeystring
options.fcm.android.priority”high” | “normal”
options.fcm.android.ttlnumber
options.fcm.android.restrictedPackageNamestring
schedulestring
emailobject
email.subjectstring(required)
email.htmlstring(required)
email.previewTextstring
email.senderNamestring
email.senderEmailstring
inappobject
inapp.titlestring(required)
inapp.urlstring
inapp.imagestring
smsobject
sms.messagestring
sms.autoReplyobject
sms.autoReply.messagestring(required)
callobject
call.messagestring(required)
web_pushobject
web_push.titlestring(required)
web_push.messagestring(required)
web_push.iconstring
web_push.urlstring
mobile_pushobject
mobile_push.titlestring(required)
mobile_push.messagestring(required)
slackobject
slack.textstring(required)
slack.blocksRecord<string, any>[]
slack.usernamestring
slack.iconstring
slack.thread_tsstring
slack.reply_broadcastboolean
slack.parse”full” | “none”
slack.link_namesboolean
slack.mrkdwnboolean
slack.unfurl_linksboolean
slack.unfurl_mediaboolean
slack.metadataobjectSlack message metadata with optional work object entities. Combines standard Slack message metadata fields with an array of entity objects.
slack.metadata.entitiesobject[]An array of work object entities.
slack.metadata.entities[].entity_typestring(required) Entity type (e.g., ‘slack#/entities/task’, ‘slack#/entities/file’).
slack.metadata.entities[].entity_payloadRecord<string, any>(required) Schema for the given entity type.
slack.metadata.entities[].external_refobject(required) Reference used to identify an entity within the developer’s system.
slack.metadata.entities[].external_ref.idstring(required)
slack.metadata.entities[].external_ref.typestring
slack.metadata.entities[].urlstring(required) URL used to identify an entity within the developer’s system.
slack.metadata.entities[].app_unfurl_urlstringThe exact URL posted in the source message. Required in metadata passed to chat.unfurl.
slack.metadata.event_typestringA human readable alphanumeric string representing your application’s metadata event.
slack.metadata.event_payloadRecord<string, any>A free-form object containing whatever data your application wishes to attach to messages.

Return Type

MessageResponse

Templates

templates_create_template()

Create a new template for a notification

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::TemplatePostRequest.new # configure as needed

begin
  result = client.templates.templates_create_template(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling templates_create_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringNotification ID
channelStringChannel type
template_post_requestTemplatePostRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
templateIdstring(required) Unique ID for this template within the notification and channel. Required.
htmlstringHTML body of the email.
previewTextstringPreview text (e.g. for inbox).
internalstringInternal editor representation of the email content (e.g. Bee or Redactor JSON). Used for editing and component embedding; the actual email sent to recipients uses the html field.
subjectstringEmail subject line.
senderNamestringSender display name.
senderEmailstringSender email address.
migrationstringMigration metadata (e.g. from template migration).
titlestringNotification title (in-app).
redirectURLstringURL to open when the user taps the notification.
imageURLstringImage URL shown in the in-app notification.
instantobjectCopy for instant (real-time) delivery.
instant.titlestring
instant.redirectURLstring
instant.imageURLstring(required)
batchobjectCopy for batch delivery.
batch.titlestring(required)
batch.redirectURLstring(required)
batch.imageURLstring(required)
textstringMessage text (SMS or call).
messagestringPush notification body text. (title is shared with INAPP_WEB above.)
iconstringWeb push: icon URL. Slack: bot icon (emoji or URL).
urlstringWeb push: URL to open when the notification is clicked.
blocksRecord<string, any>[]Slack message blocks (optional).
usernamestringSlack bot username.

Return Type

Template

templates_delete_template()


```ruby
require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.templates.templates_delete_template
  p result
rescue Pingram::ApiError => e
  puts "Error when calling templates_delete_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringNotification ID
channelStringChannel type
template_idStringTemplate ID

Return Type

nil (empty response body)

templates_get_template()

Get a single template by ID

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.templates.templates_get_template
  p result
rescue Pingram::ApiError => e
  puts "Error when calling templates_get_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringNotification ID
channelStringChannel type
template_idStringTemplate ID

Return Type

GetTemplatesResponse

templates_list_templates()

List all templates for a notification and channel

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.templates.templates_list_templates
  p result
rescue Pingram::ApiError => e
  puts "Error when calling templates_list_templates: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringNotification ID
channelStringChannel type

Return Type

Array&lt;GetTemplatesListResponseInner&gt;

templates_set_default_template()

Set a template as default for specific delivery modes

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::SetDefaultTemplateRequest.new # configure as needed

begin
  result = client.templates.templates_set_default_template(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling templates_set_default_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringNotification ID
channelStringChannel type
set_default_template_requestSetDefaultTemplateRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
templateIdstring(required)
modes(“instant” | “hourly” | “daily” | “weekly” | “monthly”)[](required)

Return Type

Template

templates_update_template()

Update a template’s properties

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::TemplatePatchRequest.new # configure as needed

begin
  result = client.templates.templates_update_template(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling templates_update_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringNotification ID
channelStringChannel type
template_idStringTemplate ID
template_patch_requestTemplatePatchRequestSee Request Body Properties below

Return Type

Template

Types

types_create_notification_type()

Create a new notification

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::NotificationCreateRequest.new # configure as needed

begin
  result = client.types.types_create_notification_type(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling types_create_notification_type: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_create_requestNotificationCreateRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
notificationIdstring(required)
titlestring(required)
channelsstring[](required)
optionsobject
options.EMAILobject
options.EMAIL.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.EMAIL.offobject
options.EMAIL.off.enabledboolean(required)
options.EMAIL.instantobject
options.EMAIL.instant.enabledboolean(required)
options.EMAIL.hourlyobject
options.EMAIL.hourly.enabledboolean(required)
options.EMAIL.dailyobject
options.EMAIL.daily.enabledboolean(required)
options.EMAIL.daily.hourstring
options.EMAIL.weeklyobject
options.EMAIL.weekly.enabledboolean(required)
options.EMAIL.weekly.hourstring
options.EMAIL.weekly.daystring
options.EMAIL.monthlyobject
options.EMAIL.monthly.enabledboolean(required)
options.EMAIL.monthly.hourstring
options.EMAIL.monthly.date”first” | “last”
options.INAPP_WEBobject
options.INAPP_WEB.defaultDeliveryOption”off” | “instant”(required)
options.INAPP_WEB.offobject
options.INAPP_WEB.off.enabledboolean(required)
options.INAPP_WEB.instantobject
options.INAPP_WEB.instant.enabledboolean(required)
options.INAPP_WEB.instant.batchingboolean
options.INAPP_WEB.instant.batchingKeystring
options.INAPP_WEB.instant.batchingWindownumber
options.SMSobject
options.SMS.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.SMS.offobject
options.SMS.off.enabledboolean(required)
options.SMS.instantobject
options.SMS.instant.enabledboolean(required)
options.SMS.hourlyobject
options.SMS.hourly.enabledboolean(required)
options.SMS.dailyobject
options.SMS.daily.enabledboolean(required)
options.SMS.daily.hourstring
options.SMS.weeklyobject
options.SMS.weekly.enabledboolean(required)
options.SMS.weekly.hourstring
options.SMS.weekly.daystring
options.SMS.monthlyobject
options.SMS.monthly.enabledboolean(required)
options.SMS.monthly.hourstring
options.SMS.monthly.date”first” | “last”
options.CALLobject
options.CALL.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.CALL.offobject
options.CALL.off.enabledboolean(required)
options.CALL.instantobject
options.CALL.instant.enabledboolean(required)
options.CALL.hourlyobject
options.CALL.hourly.enabledboolean(required)
options.CALL.dailyobject
options.CALL.daily.enabledboolean(required)
options.CALL.daily.hourstring
options.CALL.weeklyobject
options.CALL.weekly.enabledboolean(required)
options.CALL.weekly.hourstring
options.CALL.weekly.daystring
options.CALL.monthlyobject
options.CALL.monthly.enabledboolean(required)
options.CALL.monthly.hourstring
options.CALL.monthly.date”first” | “last”
options.PUSHobject
options.PUSH.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.PUSH.offobject
options.PUSH.off.enabledboolean(required)
options.PUSH.instantobject
options.PUSH.instant.enabledboolean(required)
options.PUSH.hourlyobject
options.PUSH.hourly.enabledboolean(required)
options.PUSH.dailyobject
options.PUSH.daily.enabledboolean(required)
options.PUSH.daily.hourstring
options.PUSH.weeklyobject
options.PUSH.weekly.enabledboolean(required)
options.PUSH.weekly.hourstring
options.PUSH.weekly.daystring
options.PUSH.monthlyobject
options.PUSH.monthly.enabledboolean(required)
options.PUSH.monthly.hourstring
options.PUSH.monthly.date”first” | “last”
options.WEB_PUSHobject
options.WEB_PUSH.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.WEB_PUSH.offobject
options.WEB_PUSH.off.enabledboolean(required)
options.WEB_PUSH.instantobject
options.WEB_PUSH.instant.enabledboolean(required)
options.WEB_PUSH.hourlyobject
options.WEB_PUSH.hourly.enabledboolean(required)
options.WEB_PUSH.dailyobject
options.WEB_PUSH.daily.enabledboolean(required)
options.WEB_PUSH.daily.hourstring
options.WEB_PUSH.weeklyobject
options.WEB_PUSH.weekly.enabledboolean(required)
options.WEB_PUSH.weekly.hourstring
options.WEB_PUSH.weekly.daystring
options.WEB_PUSH.monthlyobject
options.WEB_PUSH.monthly.enabledboolean(required)
options.WEB_PUSH.monthly.hourstring
options.WEB_PUSH.monthly.date”first” | “last”
options.SLACKobject
options.SLACK.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.SLACK.offobject
options.SLACK.off.enabledboolean(required)
options.SLACK.instantobject
options.SLACK.instant.enabledboolean(required)
options.SLACK.hourlyobject
options.SLACK.hourly.enabledboolean(required)
options.SLACK.dailyobject
options.SLACK.daily.enabledboolean(required)
options.SLACK.daily.hourstring
options.SLACK.weeklyobject
options.SLACK.weekly.enabledboolean(required)
options.SLACK.weekly.hourstring
options.SLACK.weekly.daystring
options.SLACK.monthlyobject
options.SLACK.monthly.enabledboolean(required)
options.SLACK.monthly.hourstring
options.SLACK.monthly.date”first” | “last”

Return Type

Notification

types_delete_notification_type()


```ruby
require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.types.types_delete_notification_type
  p result
rescue Pingram::ApiError => e
  puts "Error when calling types_delete_notification_type: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringThe notification ID

Return Type

nil (empty response body)

types_get_notification_type()

Get a specific notification by ID

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.types.types_get_notification_type
  p result
rescue Pingram::ApiError => e
  puts "Error when calling types_get_notification_type: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringThe notification ID

Return Type

Array&lt;GetNotificationsResponseInner&gt;

types_list_notification_types()

Get all notifications for an account with their templates

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.types.types_list_notification_types
  p result
rescue Pingram::ApiError => e
  puts "Error when calling types_list_notification_types: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

Array&lt;GetNotificationsResponseInner&gt;

types_update_notification_type()

Update a notification’s settings

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::NotificationPatchRequest.new # configure as needed

begin
  result = client.types.types_update_notification_type(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling types_update_notification_type: #{e}"
end

Parameters

NameTypeDescriptionNotes
notification_idStringThe notification ID
notification_patch_requestNotificationPatchRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
titlestring
channels(“EMAIL” | “INAPP_WEB” | “SMS” | “CALL” | “PUSH” | “WEB_PUSH” | “SLACK”)[]
enabledboolean
deduplicationobject
deduplication.durationnumber(required)
throttlingobject
throttling.maxnumber(required)
throttling.periodnumber(required)
throttling.unit”seconds” | “minutes” | “hours” | “days” | “months” | “years”(required)
throttling.foreverboolean(required)
throttling.scope(“userId” | “notificationId”)[](required)
retentionnumber
optionsobject
options.EMAILobject
options.EMAIL.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.EMAIL.offobject
options.EMAIL.off.enabledboolean(required)
options.EMAIL.instantobject
options.EMAIL.instant.enabledboolean(required)
options.EMAIL.hourlyobject
options.EMAIL.hourly.enabledboolean(required)
options.EMAIL.dailyobject
options.EMAIL.daily.enabledboolean(required)
options.EMAIL.daily.hourstring
options.EMAIL.weeklyobject
options.EMAIL.weekly.enabledboolean(required)
options.EMAIL.weekly.hourstring
options.EMAIL.weekly.daystring
options.EMAIL.monthlyobject
options.EMAIL.monthly.enabledboolean(required)
options.EMAIL.monthly.hourstring
options.EMAIL.monthly.date”first” | “last”
options.INAPP_WEBobject
options.INAPP_WEB.defaultDeliveryOption”off” | “instant”(required)
options.INAPP_WEB.offobject
options.INAPP_WEB.off.enabledboolean(required)
options.INAPP_WEB.instantobject
options.INAPP_WEB.instant.enabledboolean(required)
options.INAPP_WEB.instant.batchingboolean
options.INAPP_WEB.instant.batchingKeystring
options.INAPP_WEB.instant.batchingWindownumber
options.SMSobject
options.SMS.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.SMS.offobject
options.SMS.off.enabledboolean(required)
options.SMS.instantobject
options.SMS.instant.enabledboolean(required)
options.SMS.hourlyobject
options.SMS.hourly.enabledboolean(required)
options.SMS.dailyobject
options.SMS.daily.enabledboolean(required)
options.SMS.daily.hourstring
options.SMS.weeklyobject
options.SMS.weekly.enabledboolean(required)
options.SMS.weekly.hourstring
options.SMS.weekly.daystring
options.SMS.monthlyobject
options.SMS.monthly.enabledboolean(required)
options.SMS.monthly.hourstring
options.SMS.monthly.date”first” | “last”
options.CALLobject
options.CALL.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.CALL.offobject
options.CALL.off.enabledboolean(required)
options.CALL.instantobject
options.CALL.instant.enabledboolean(required)
options.CALL.hourlyobject
options.CALL.hourly.enabledboolean(required)
options.CALL.dailyobject
options.CALL.daily.enabledboolean(required)
options.CALL.daily.hourstring
options.CALL.weeklyobject
options.CALL.weekly.enabledboolean(required)
options.CALL.weekly.hourstring
options.CALL.weekly.daystring
options.CALL.monthlyobject
options.CALL.monthly.enabledboolean(required)
options.CALL.monthly.hourstring
options.CALL.monthly.date”first” | “last”
options.PUSHobject
options.PUSH.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.PUSH.offobject
options.PUSH.off.enabledboolean(required)
options.PUSH.instantobject
options.PUSH.instant.enabledboolean(required)
options.PUSH.hourlyobject
options.PUSH.hourly.enabledboolean(required)
options.PUSH.dailyobject
options.PUSH.daily.enabledboolean(required)
options.PUSH.daily.hourstring
options.PUSH.weeklyobject
options.PUSH.weekly.enabledboolean(required)
options.PUSH.weekly.hourstring
options.PUSH.weekly.daystring
options.PUSH.monthlyobject
options.PUSH.monthly.enabledboolean(required)
options.PUSH.monthly.hourstring
options.PUSH.monthly.date”first” | “last”
options.WEB_PUSHobject
options.WEB_PUSH.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.WEB_PUSH.offobject
options.WEB_PUSH.off.enabledboolean(required)
options.WEB_PUSH.instantobject
options.WEB_PUSH.instant.enabledboolean(required)
options.WEB_PUSH.hourlyobject
options.WEB_PUSH.hourly.enabledboolean(required)
options.WEB_PUSH.dailyobject
options.WEB_PUSH.daily.enabledboolean(required)
options.WEB_PUSH.daily.hourstring
options.WEB_PUSH.weeklyobject
options.WEB_PUSH.weekly.enabledboolean(required)
options.WEB_PUSH.weekly.hourstring
options.WEB_PUSH.weekly.daystring
options.WEB_PUSH.monthlyobject
options.WEB_PUSH.monthly.enabledboolean(required)
options.WEB_PUSH.monthly.hourstring
options.WEB_PUSH.monthly.date”first” | “last”
options.SLACKobject
options.SLACK.defaultDeliveryOption”off” | “instant” | “hourly” | “daily” | “weekly” | “monthly”(required)
options.SLACK.offobject
options.SLACK.off.enabledboolean(required)
options.SLACK.instantobject
options.SLACK.instant.enabledboolean(required)
options.SLACK.hourlyobject
options.SLACK.hourly.enabledboolean(required)
options.SLACK.dailyobject
options.SLACK.daily.enabledboolean(required)
options.SLACK.daily.hourstring
options.SLACK.weeklyobject
options.SLACK.weekly.enabledboolean(required)
options.SLACK.weekly.hourstring
options.SLACK.weekly.daystring
options.SLACK.monthlyobject
options.SLACK.monthly.enabledboolean(required)
options.SLACK.monthly.hourstring
options.SLACK.monthly.date”first” | “last”

Return Type

Notification

User

user_get_account_metadata()

Get account-level metadata including logo, VAPID key, and web push status

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.user.user_get_account_metadata
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_get_account_metadata: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

GetAccountMetadataResponse

user_get_available_slack_channels()


```ruby
require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.user.user_get_available_slack_channels
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_get_available_slack_channels: #{e}"
end

Parameters

NameTypeDescriptionNotes
user_idStringUser ID

Return Type

nil (empty response body)

user_get_in_app_notifications()

Get in-app notifications for a user

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.user.user_get_in_app_notifications
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_get_in_app_notifications: #{e}"
end

Parameters

NameTypeDescriptionNotes
beforeStringTimestamp or ISO date to fetch notifications before[optional]
countFloatNumber of notifications to return (default 10)[optional]

Return Type

GetInappNotificationsResponse

user_get_in_app_unread_count()

Get the count of unread in-app notifications for a user

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.user.user_get_in_app_unread_count
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_get_in_app_unread_count: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return Type

InappUnreadCountResponse

user_get_user()

Get a user by ID. All users exist implicitly, returns basic user object if not found in DB.

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.user.user_get_user
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_get_user: #{e}"
end

Parameters

NameTypeDescriptionNotes
user_idStringUser ID

Return Type

User

user_identify()

Create or update a user with the given ID. Updates lastSeenTime automatically.

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::PostUserRequest.new # configure as needed

begin
  result = client.user.user_identify(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_identify: #{e}"
end

Parameters

NameTypeDescriptionNotes
user_idStringUser ID
post_user_requestPostUserRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
idstring
emailstring
numberstring
pushTokensobject[]
pushTokens[].type”FCM” | “APN”(required)
pushTokens[].tokenstring(required)
pushTokens[].deviceobject(required)
pushTokens[].device.app_idstring
pushTokens[].device.ad_idstring
pushTokens[].device.device_idstring(required)
pushTokens[].device.platformstring
pushTokens[].device.manufacturerstring
pushTokens[].device.modelstring
pushTokens[].environmentstringused by APN to differentiate between sandbox and production builds (sandbox/undefined or production)
webPushTokensobject[]
webPushTokens[].subobject(required) Configuration for a Push Subscription. This can be obtained on the frontend by calling serviceWorkerRegistration.pushManager.subscribe(). The expected format is the same output as JSON.stringify’ing a PushSubscription in the browser.
webPushTokens[].sub.endpointstring(required)
webPushTokens[].sub.keysobject(required)
webPushTokens[].sub.keys.p256dhstring(required)
webPushTokens[].sub.keys.authstring(required)
timezonestring
slackChannelstringThe destination channel of slack notifications sent to this user. Can be either of the following: - Channel name, e.g. “test” - Channel name with # prefix, e.g. “#test” - Channel ID, e.g. “C1234567890” - User ID for DM, e.g. “U1234567890” - Username with @ prefix, e.g. “@test”
slackTokenobject
slackToken.access_tokenstring
slackToken.app_idstring
slackToken.authed_userobject
slackToken.authed_user.access_tokenstring
slackToken.authed_user.expires_innumber
slackToken.authed_user.idstring
slackToken.authed_user.refresh_tokenstring
slackToken.authed_user.scopestring
slackToken.authed_user.token_typestring
slackToken.bot_user_idstring
slackToken.enterpriseobject
slackToken.enterprise.idstring
slackToken.enterprise.namestring
slackToken.errorstring
slackToken.expires_innumber
slackToken.incoming_webhookobject
slackToken.incoming_webhook.channelstring
slackToken.incoming_webhook.channel_idstring
slackToken.incoming_webhook.configuration_urlstring
slackToken.incoming_webhook.urlstring
slackToken.is_enterprise_installboolean
slackToken.neededstring
slackToken.okboolean(required)
slackToken.providedstring
slackToken.refresh_tokenstring
slackToken.scopestring
slackToken.teamobject
slackToken.team.idstring
slackToken.team.namestring
slackToken.token_typestring
slackToken.warningstring
slackToken.response_metadataobject
slackToken.response_metadata.warningsstring[]
slackToken.response_metadata.next_cursorstring
slackToken.response_metadata.scopesstring[]
slackToken.response_metadata.acceptedScopesstring[]
slackToken.response_metadata.retryAfternumber
slackToken.response_metadata.messagesstring[]

Return Type

User

user_mark_in_app_notifications_as_seen()

Mark in-app web notifications as seen/read for a user

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::InAppNotificationUnreadClearRequest.new # configure as needed

begin
  result = client.user.user_mark_in_app_notifications_as_seen(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_mark_in_app_notifications_as_seen: #{e}"
end

Parameters

NameTypeDescriptionNotes
in_app_notification_unread_clear_requestInAppNotificationUnreadClearRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
notificationIdstring
trackingIdstring

Return Type

SuccessResponse

user_update_in_app_notification_status()

Update in-app web notification status (opened, archived, clicked, etc.)

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')
body = Pingram::InAppNotificationPatchRequest.new # configure as needed

begin
  result = client.user.user_update_in_app_notification_status(body)
  p result
rescue Pingram::ApiError => e
  puts "Error when calling user_update_in_app_notification_status: #{e}"
end

Parameters

NameTypeDescriptionNotes
in_app_notification_patch_requestInAppNotificationPatchRequestSee Request Body Properties below

Request Body Properties

NameTypeDescription
trackingIdsstring[](required)
openedstring
clickedstring
archivedstring
actioned1string
actioned2string
replyobject
reply.datestring(required)
reply.messagestring(required)
repliesobject[]
replies[].datestring(required)
replies[].messagestring(required)

Return Type

SuccessResponse

Users

users_delete_user()

Delete a user and all associated data (in-app notifications, preferences, and user record)

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.users.users_delete_user
  p result
rescue Pingram::ApiError => e
  puts "Error when calling users_delete_user: #{e}"
end

Parameters

NameTypeDescriptionNotes
user_idStringUser ID
env_idStringEnvironment ID (required when using JWT auth)[optional]

Return Type

DeleteUserResponse

users_list_users()

Get all users for an environment with pagination support

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.users.users_list_users
  p result
rescue Pingram::ApiError => e
  puts "Error when calling users_list_users: #{e}"
end

Parameters

NameTypeDescriptionNotes
limitFloatMaximum number of users to return (default
next_tokenStringPagination token for next page
env_idStringEnvironment ID (required when using JWT auth)[optional]

Return Type

GetUsersResponse

users_remove_user_from_suppression()

Remove user suppression status for a specific channel

require 'pingram'

client = Pingram::Client.new(api_key: 'YOUR_API_KEY')

begin
  result = client.users.users_remove_user_from_suppression
  p result
rescue Pingram::ApiError => e
  puts "Error when calling users_remove_user_from_suppression: #{e}"
end

Parameters

NameTypeDescriptionNotes
user_idStringUser ID
channelStringChannel type (EMAIL)
env_idStringEnvironment ID (required when using JWT auth)[optional]

Return Type

UserSuppressionDeleteResponse