All URIs are relative to https://api.smooch.io
| Method | HTTP request | Description |
|---|---|---|
| authorize | GET /oauth/authorize | Authorize |
| get_token | POST /oauth/token | Get Token |
| revoke_access | DELETE /oauth/authorization | Revoke Access |
authorize(client_id, response_type, opts)
Authorize
This endpoint begins the OAuth flow. It relies on a browser session for authentication. If the user is not logged in to Sunshine Conversations they will be redirected to the login page. If the user has many apps, they will first be prompted to select the one they wish to integrate with. They will then be presented with an Allow/Deny dialog, describing details of the access your integration is requesting.
# load the gem
require 'sunshine-conversations-client'
api_instance = SunshineConversationsClient::OAuthEndpointsApi.new
client_id = '5e4af71a81966cfff3ef6550' # String | Your integration’s unique identifier
response_type = 'code' # String | For now the only acceptable value is code.
# Be sure to add the required body parameters
opts = {
state: 'Pending', # String | You may pass in any arbitrary string value here which will be returned to you along with the code via browser redirect.
redirect_uri: 'https://example.org' # String | You may pass in a redirect_uri to determine which URI the response is redirected to. This URI must be contained in the list configured by your integration. If this option is not passed, the first URI present in the list will be used.
}
begin
#Authorize
api_instance.authorize(client_id, response_type, opts)
rescue SunshineConversationsClient::ApiError => e
puts "Exception when calling OAuthEndpointsApi->authorize: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| client_id | String | Your integration’s unique identifier | |
| response_type | String | For now the only acceptable value is code. | |
| state | String | You may pass in any arbitrary string value here which will be returned to you along with the code via browser redirect. | [optional] |
| redirect_uri | String | You may pass in a redirect_uri to determine which URI the response is redirected to. This URI must be contained in the list configured by your integration. If this option is not passed, the first URI present in the list will be used. | [optional] |
nil (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: Not defined
Object get_token(inline_object)
Get Token
This endpoint is used to exchange an authorization code for an access token. It should only be used in server-to-server calls.
# load the gem
require 'sunshine-conversations-client'
api_instance = SunshineConversationsClient::OAuthEndpointsApi.new
inline_object = SunshineConversationsClient::InlineObject.new # InlineObject |
# Be sure to add the required body parameters
begin
#Get Token
result = api_instance.get_token(inline_object)
p result
rescue SunshineConversationsClient::ApiError => e
puts "Exception when calling OAuthEndpointsApi->get_token: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| inline_object | InlineObject |
Object
No authorization required
- Content-Type: application/json
- Accept: application/json
Object revoke_access
Revoke Access
This endpoint is used to revoke your integration’s access to the user’s Sunshine Conversations app. Revoking access means your integration will no longer be able to interact with the app, and any webhooks the integration had previously configured will be removed. Calling this endpoint is equivalent to the user removing your integration manually in the Sunshine Conversations web app. Your integration’s removeUrl (if configured) will also be called when an integration is removed in this way.
# load the gem
require 'sunshine-conversations-client'
# setup authorization
SunshineConversationsClient.configure do |config|
# Configure HTTP basic authorization: basicAuth
config.username = 'YOUR_USERNAME'
config.password = 'YOUR_PASSWORD'
# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this line to use JWTs
# config.access_token = 'YOUR_JWT'
end
api_instance = SunshineConversationsClient::OAuthEndpointsApi.new
# Be sure to add the required body parameters
begin
#Revoke Access
result = api_instance.revoke_access
p result
rescue SunshineConversationsClient::ApiError => e
puts "Exception when calling OAuthEndpointsApi->revoke_access: #{e}"
endThis endpoint does not need any parameter.
Object
- Content-Type: Not defined
- Accept: application/json