SmoochApi - the Ruby gem for the Smooch API
The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our official documentation.
This SDK is automatically generated by the Swagger Codegen project using the Smooch api spec.
Install the gem:
gem install smooch-api
Add this to the Gemfile:
gem 'smooch-api', '~> 1.5.0'
JSON Web Tokens (JWTs) are an industry standard authentication mechanism. A great introduction to the technology is available here, and a broad set of supported JWT libraries for a variety of languages and platforms are available.
A JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued.
Before you can make calls to the Smooch API, you'll need to create a JWT that proves you are authorized to use the API.
Step 1 Generate a KEY ID and SECRET on the settings tab in the Smooch Dashboard.
Using the ruby-jwt gem:
require 'jwt'
payload = {:scope => 'app'}
jwtHeader = {:kid => KEY_ID}
token = JWT.encode payload, SECRET, 'HS256', jwtHeader
# Load the gem
require 'smooch-api'
# Setup authorization
SmoochApi.configure do |config|
# Configure API key authorization: jwt
config.api_key['Authorization'] = 'YOUR JWT'
config.api_key_prefix['Authorization'] = 'Bearer'
end
api_instance = SmoochApi::AppApi.new
app_create_body = SmoochApi::AppCreate.new # AppCreate | Body for a createApp request.
begin
result = api_instance.create_app(app_create_body)
p result
rescue SmoochApi::ApiError => e
puts "Exception when calling AppApi->create_app: #{e}"
end
All URIs are relative to https://api.smooch.io/v1
Class | Method | HTTP request | Description |
---|---|---|---|
SmoochApi::AppApi | create_app | POST /apps | |
SmoochApi::AppApi | create_secret_key | POST /apps/{appId}/keys | |
SmoochApi::AppApi | delete_app | DELETE /apps/{appId} | |
SmoochApi::AppApi | delete_secret_key | DELETE /apps/{appId}/keys/{keyId} | |
SmoochApi::AppApi | get_app | GET /apps/{appId} | |
SmoochApi::AppApi | get_app_jwt | GET /apps/{appId}/keys/{keyId}/jwt | |
SmoochApi::AppApi | get_secret_key | GET /apps/{appId}/keys/{keyId} | |
SmoochApi::AppApi | list_apps | GET /apps | |
SmoochApi::AppApi | list_secret_keys | GET /apps/{appId}/keys | |
SmoochApi::AppApi | update_app | PUT /apps/{appId} | |
SmoochApi::AppUserApi | app_user_device_update | PUT /appusers/{userId}/devices/{deviceId} | |
SmoochApi::AppUserApi | delete_app_user_profile | DELETE /appusers/{userId}/profile | |
SmoochApi::AppUserApi | get_app_user | GET /appusers/{userId} | |
SmoochApi::AppUserApi | get_app_user_entity_ids | GET /appusers/{userId}/channels | |
SmoochApi::AppUserApi | link_app_user | POST /appusers/{userId}/channels | |
SmoochApi::AppUserApi | post_image_message | POST /appusers/{userId}/images | |
SmoochApi::AppUserApi | pre_create_app_user | POST /appusers | |
SmoochApi::AppUserApi | track_event | POST /appusers/{userId}/events | |
SmoochApi::AppUserApi | unlink_app_user | DELETE /appusers/{userId}/channels/{channel} | |
SmoochApi::AppUserApi | update_app_user | PUT /appusers/{userId} | |
SmoochApi::ConversationApi | delete_messages | DELETE /appusers/{userId}/messages | |
SmoochApi::ConversationApi | get_messages | GET /appusers/{userId}/messages | |
SmoochApi::ConversationApi | post_message | POST /appusers/{userId}/messages | |
SmoochApi::ConversationApi | reset_unread_count | POST /appusers/{userId}/conversation/read | |
SmoochApi::ConversationApi | trigger_typing_activity | POST /appusers/{userId}/conversation/activity | |
SmoochApi::InitApi | init | POST /init | |
SmoochApi::IntegrationApi | create_integration | POST /apps/{appId}/integrations | |
SmoochApi::IntegrationApi | create_integration_menu | POST /apps/{appId}/integrations/{integrationId}/menu | |
SmoochApi::IntegrationApi | delete_integration | DELETE /apps/{appId}/integrations/{integrationId} | |
SmoochApi::IntegrationApi | delete_integration_menu | DELETE /apps/{appId}/integrations/{integrationId}/menu | |
SmoochApi::IntegrationApi | get_integration | GET /apps/{appId}/integrations/{integrationId} | |
SmoochApi::IntegrationApi | get_integration_menu | GET /apps/{appId}/integrations/{integrationId}/menu | |
SmoochApi::IntegrationApi | list_integrations | GET /apps/{appId}/integrations | |
SmoochApi::IntegrationApi | update_integration_menu | PUT /apps/{appId}/integrations/{integrationId}/menu | |
SmoochApi::MenuApi | delete_menu | DELETE /menu | |
SmoochApi::MenuApi | get_menu | GET /menu | |
SmoochApi::MenuApi | update_menu | PUT /menu | |
SmoochApi::WebhookApi | create_webhook | POST /apps/{appId}/webhooks | |
SmoochApi::WebhookApi | delete_webhook | DELETE /apps/{appId}/webhooks/{webhookId} | |
SmoochApi::WebhookApi | get_webhook | GET /apps/{appId}/webhooks/{webhookId} | |
SmoochApi::WebhookApi | list_webhooks | GET /apps/{appId}/webhooks | |
SmoochApi::WebhookApi | update_webhook | PUT /apps/{appId}/webhooks/{webhookId} |
- SmoochApi::Action
- SmoochApi::App
- SmoochApi::AppCreate
- SmoochApi::AppResponse
- SmoochApi::AppSettings
- SmoochApi::AppUpdate
- SmoochApi::AppUser
- SmoochApi::AppUserLink
- SmoochApi::AppUserPreCreate
- SmoochApi::AppUserResponse
- SmoochApi::AppUserUpdate
- SmoochApi::Client
- SmoochApi::ClientInfo
- SmoochApi::Conversation
- SmoochApi::Destination
- SmoochApi::DeviceInit
- SmoochApi::DeviceResponse
- SmoochApi::DeviceUpdate
- SmoochApi::DisplaySettings
- SmoochApi::Event
- SmoochApi::GetMessagesResponse
- SmoochApi::Init
- SmoochApi::InitResponse
- SmoochApi::Integration
- SmoochApi::IntegrationCreate
- SmoochApi::IntegrationResponse
- SmoochApi::JwtResponse
- SmoochApi::ListAppsResponse
- SmoochApi::ListIntegrationsResponse
- SmoochApi::ListSecretKeysResponse
- SmoochApi::ListWebhooksResponse
- SmoochApi::Menu
- SmoochApi::MenuItem
- SmoochApi::MenuResponse
- SmoochApi::Message
- SmoochApi::MessageItem
- SmoochApi::MessagePost
- SmoochApi::MessageResponse
- SmoochApi::PostMessagesResponse
- SmoochApi::SecretKey
- SmoochApi::SecretKeyCreate
- SmoochApi::SecretKeyResponse
- SmoochApi::TrackEventResponse
- SmoochApi::TypingActivityTrigger
- SmoochApi::Webhook
- SmoochApi::WebhookCreate
- SmoochApi::WebhookResponse
- SmoochApi::WebhookUpdate
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header