Skip to content

zendesk/sunshine-conversations-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sunshine-conversations-client

SunshineConversationsClient - JavaScript client for sunshine-conversations-client This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 13.1.0
  • Package version: 13.1.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install sunshine-conversations-client --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install
npm build

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your sunshine-conversations-client from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('sunshine-conversations-client') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Region

Sunshine Conversations is available in the following regions. The US region will be used by default. To target any other region, specify the region's API host in defaultClient.basePath. For example:

var defaultClient = SunshineConversationsClient.ApiClient.instance;
defaultClient.basePath = "https://api.smooch.io";

Getting Started

Please follow the installation instructions and execute the following JS code:

var SunshineConversationsClient = require('sunshine-conversations-client');

var defaultClient = SunshineConversationsClient.ApiClient.instance;
// Configure HTTP basic authorization: basicAuth
var basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR USERNAME'
basicAuth.password = 'YOUR PASSWORD'
// Configure Bearer (JWT) access token for authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

var api = new SunshineConversationsClient.ActivitiesApi()
var appId = 5d8cff3cd55b040010928b5b; // {String} Identifies the app.
var conversationId = 029c31f25a21b47effd7be90; // {String} Identifies the conversation.
var activityPost = {"author":{"type":"user","userId":"5963c0d619a30a2e00de36b8"},"type":"conversation:read"}; // {ActivityPost} 
api.postActivity(appId, conversationId, activityPost).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://api.smooch.io

Class Method HTTP request Description
SunshineConversationsClient.ActivitiesApi postActivity POST /v2/apps/{appId}/conversations/{conversationId}/activity Post Activity
SunshineConversationsClient.AppKeysApi createAppKey POST /v2/apps/{appId}/keys Create App Key
SunshineConversationsClient.AppKeysApi deleteAppKey DELETE /v2/apps/{appId}/keys/{keyId} Delete App Key
SunshineConversationsClient.AppKeysApi getAppKey GET /v2/apps/{appId}/keys/{keyId} Get App Key
SunshineConversationsClient.AppKeysApi listAppKeys GET /v2/apps/{appId}/keys List App Keys
SunshineConversationsClient.AppsApi createApp POST /v2/apps Create App
SunshineConversationsClient.AppsApi deleteApp DELETE /v2/apps/{appId} Delete App
SunshineConversationsClient.AppsApi getApp GET /v2/apps/{appId} Get App
SunshineConversationsClient.AppsApi listApps GET /v2/apps List Apps
SunshineConversationsClient.AppsApi updateApp PATCH /v2/apps/{appId} Update App
SunshineConversationsClient.AttachmentsApi deleteAttachment POST /v2/apps/{appId}/attachments/remove Delete Attachment
SunshineConversationsClient.AttachmentsApi uploadAttachment POST /v2/apps/{appId}/attachments Upload Attachment
SunshineConversationsClient.ClientsApi createClient POST /v2/apps/{appId}/users/{userIdOrExternalId}/clients Create Client
SunshineConversationsClient.ClientsApi listClients GET /v2/apps/{appId}/users/{userIdOrExternalId}/clients List Clients
SunshineConversationsClient.ClientsApi removeClient DELETE /v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId} Remove Client
SunshineConversationsClient.ConversationsApi createConversation POST /v2/apps/{appId}/conversations Create Conversation
SunshineConversationsClient.ConversationsApi deleteConversation DELETE /v2/apps/{appId}/conversations/{conversationId} Delete Conversation
SunshineConversationsClient.ConversationsApi getConversation GET /v2/apps/{appId}/conversations/{conversationId} Get Conversation
SunshineConversationsClient.ConversationsApi listConversations GET /v2/apps/{appId}/conversations List Conversations
SunshineConversationsClient.ConversationsApi updateConversation PATCH /v2/apps/{appId}/conversations/{conversationId} Update Conversation
SunshineConversationsClient.CustomIntegrationApiKeysApi createCustomIntegrationKey POST /v2/apps/{appId}/integrations/{integrationId}/keys Create Integration Key
SunshineConversationsClient.CustomIntegrationApiKeysApi deleteCustomIntegrationKey DELETE /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} Delete Integration Key
SunshineConversationsClient.CustomIntegrationApiKeysApi getCustomIntegrationKey GET /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} Get Integration Key
SunshineConversationsClient.CustomIntegrationApiKeysApi listCustomIntegrationKeys GET /v2/apps/{appId}/integrations/{integrationId}/keys List Integration Keys
SunshineConversationsClient.DevicesApi getDevice GET /v2/apps/{appId}/users/{userIdOrExternalId}/devices/{deviceId} Get Device
SunshineConversationsClient.DevicesApi listDevices GET /v2/apps/{appId}/users/{userIdOrExternalId}/devices List Devices
SunshineConversationsClient.IntegrationsApi createIntegration POST /v2/apps/{appId}/integrations Create Integration
SunshineConversationsClient.IntegrationsApi deleteIntegration DELETE /v2/apps/{appId}/integrations/{integrationId} Delete Integration
SunshineConversationsClient.IntegrationsApi getIntegration GET /v2/apps/{appId}/integrations/{integrationId} Get Integration
SunshineConversationsClient.IntegrationsApi listIntegrations GET /v2/apps/{appId}/integrations List Integrations
SunshineConversationsClient.IntegrationsApi updateIntegration PATCH /v2/apps/{appId}/integrations/{integrationId} Update Integration
SunshineConversationsClient.MessagesApi deleteAllMessages DELETE /v2/apps/{appId}/conversations/{conversationId}/messages Delete All Messages
SunshineConversationsClient.MessagesApi deleteMessage DELETE /v2/apps/{appId}/conversations/{conversationId}/messages/{messageId} Delete Message
SunshineConversationsClient.MessagesApi listMessages GET /v2/apps/{appId}/conversations/{conversationId}/messages List Messages
SunshineConversationsClient.MessagesApi postMessage POST /v2/apps/{appId}/conversations/{conversationId}/messages Post Message
SunshineConversationsClient.OAuthEndpointsApi authorize GET /oauth/authorize Authorize
SunshineConversationsClient.OAuthEndpointsApi getToken POST /oauth/token Get Token
SunshineConversationsClient.OAuthEndpointsApi revokeAccess DELETE /oauth/authorization Revoke Access
SunshineConversationsClient.ParticipantsApi joinConversation POST /v2/apps/{appId}/conversations/{conversationId}/join Join Conversation
SunshineConversationsClient.ParticipantsApi leaveConversation POST /v2/apps/{appId}/conversations/{conversationId}/leave Leave Conversation
SunshineConversationsClient.ParticipantsApi listParticipants GET /v2/apps/{appId}/conversations/{conversationId}/participants List Participants
SunshineConversationsClient.SwitchboardActionsApi acceptControl POST /v2/apps/{appId}/conversations/{conversationId}/acceptControl Accept Control
SunshineConversationsClient.SwitchboardActionsApi offerControl POST /v2/apps/{appId}/conversations/{conversationId}/offerControl Offer Control
SunshineConversationsClient.SwitchboardActionsApi passControl POST /v2/apps/{appId}/conversations/{conversationId}/passControl Pass Control
SunshineConversationsClient.SwitchboardActionsApi releaseControl POST /v2/apps/{appId}/conversations/{conversationId}/releaseControl Release Control
SunshineConversationsClient.SwitchboardIntegrationsApi createSwitchboardIntegration POST /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations Create Switchboard Integration
SunshineConversationsClient.SwitchboardIntegrationsApi deleteSwitchboardIntegration DELETE /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} Delete Switchboard Integration
SunshineConversationsClient.SwitchboardIntegrationsApi listSwitchboardIntegrations GET /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations List Switchboard Integrations
SunshineConversationsClient.SwitchboardIntegrationsApi updateSwitchboardIntegration PATCH /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} Update Switchboard Integration
SunshineConversationsClient.SwitchboardsApi createSwitchboard POST /v2/apps/{appId}/switchboards Create Switchboard
SunshineConversationsClient.SwitchboardsApi deleteSwitchboard DELETE /v2/apps/{appId}/switchboards/{switchboardId} Delete Switchboard
SunshineConversationsClient.SwitchboardsApi listSwitchboards GET /v2/apps/{appId}/switchboards List Switchboards
SunshineConversationsClient.SwitchboardsApi updateSwitchboard PATCH /v2/apps/{appId}/switchboards/{switchboardId} Update Switchboard
SunshineConversationsClient.UsersApi createUser POST /v2/apps/{appId}/users Create User
SunshineConversationsClient.UsersApi deleteUser DELETE /v2/apps/{appId}/users/{userIdOrExternalId} Delete User
SunshineConversationsClient.UsersApi deleteUserPersonalInformation DELETE /v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation Delete User Personal Information
SunshineConversationsClient.UsersApi getUser GET /v2/apps/{appId}/users/{userIdOrExternalId} Get User
SunshineConversationsClient.UsersApi updateUser PATCH /v2/apps/{appId}/users/{userIdOrExternalId} Update User
SunshineConversationsClient.WebhooksApi createWebhook POST /v2/apps/{appId}/integrations/{integrationId}/webhooks Create Webhook
SunshineConversationsClient.WebhooksApi deleteWebhook DELETE /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} Delete Webhook
SunshineConversationsClient.WebhooksApi getWebhook GET /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} Get Webhook
SunshineConversationsClient.WebhooksApi listWebhooks GET /v2/apps/{appId}/integrations/{integrationId}/webhooks List Webhooks
SunshineConversationsClient.WebhooksApi updateWebhook PATCH /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} Update Webhook

Documentation for Models

Documentation for Authorization

basicAuth

  • Type: HTTP basic authentication

bearerAuth

  • Type: Bearer authentication (JWT)