Giter VIP home page Giter VIP logo

smooch-java's Introduction

smooch-java

The Java package 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.

Smooch API Version

The Smooch API offers multiple versions. Each release of this project targets one and only one Smooch API version. If you depend on an older version of the Smooch API, you may need to use an older release of this library. Use the table below as your guide:

Smooch API version smooch-java version to use
v1.1 Upgrade guide 4.0.0 or newer
v1 3.* or older

Installation

Maven users

Add the following remote repo to your project's POM:

<project ...>
<repositories>
    <repository>
      <id>smooch.io</id>
      <url>https://smoochorg.bintray.com/maven/</url>
    </repository>
 </repositories>
</project>

Add this dependency to your project's POM:

<dependency>
    <groupId>io.smooch</groupId>
    <artifactId>api</artifactId>
    <version>5.27.1</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.smooch:api:5.27.1"

Getting Started

Familiarity with Smooch API authentication is recommended.

Basic Authentication (recommended)

With basic authentication, you can use your API key ID and secret to authenticate API requests. See below for a code sample.

Authentication with JSON Web Tokens (JWTs)

See the JSON Web Tokens (JWTs) guide for more information and guidelines on when to use this method. In general, you'll want to favor using basic authentication.

To generate a JWT, use your API key ID and secret.

Using the jjwt package:

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.impl.crypto.MacProvider;
import io.jsonwebtoken.security.Keys;

import static io.jsonwebtoken.JwsHeader.KEY_ID;

// ...

String jwt = Jwts.builder()
    .claim("scope", "app")
    .setHeaderParam(KEY_ID, "YOUR_KEY_ID")
    .signWith(
        Keys.hmacShaKeyFor("YOUR_SECRET".getBytes()),
        SignatureAlgorithm.HS256
    )
    .compact();

Running the code

import io.smooch.client.ApiClient;
import io.smooch.client.ApiException;
import io.smooch.client.Configuration;
import io.smooch.client.auth.*;
import io.smooch.client.api.AppApi;

import java.io.File;
import java.util.*;

public class AppApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure HTTP basic authorization (recommended): basicAuth
        HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
        basicAuth.setUsername("API_KEY_ID");
        basicAuth.setPassword("API_KEY_SECRET");


        // OR

        // Configure JWT authorization (alternative method): jwt
        ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt");
        jwt.setApiKey("YOUR JWT");
        jwt.setApiKeyPrefix("Bearer");

        AppApi apiInstance = new AppApi();
        AppCreate appCreateBody = new AppCreate(); // AppCreate | Body for a createApp request.
        try {
            AppResponse result = apiInstance.createApp(appCreateBody);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AppApi#createApp");
            e.printStackTrace();
        }
    }
}

Region

Smooch is available in the following regions. The US region will be used by default. To target any other region, specify the region API host in setBasePath(). For example:

defaultClient.setBasePath("https://api.eu-1.smooch.io");

Documentation for API Endpoints

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

Class Method HTTP request Description
AppApi createApp POST /v1.1/apps
AppApi createSecretKey POST /v1.1/apps/{appId}/keys
AppApi deleteApp DELETE /v1.1/apps/{appId}
AppApi deleteSecretKey DELETE /v1.1/apps/{appId}/keys/{keyId}
AppApi getApp GET /v1.1/apps/{appId}
AppApi getAppJwt GET /v1.1/apps/{appId}/keys/{keyId}/jwt
AppApi getSdkIds GET /v1.1/apps/{appId}/sdks
AppApi getSecretKey GET /v1.1/apps/{appId}/keys/{keyId}
AppApi listApps GET /v1.1/apps
AppApi listSecretKeys GET /v1.1/apps/{appId}/keys
AppApi updateApp PUT /v1.1/apps/{appId}
AppUserApi deleteAppUser DELETE /v1.1/apps/{appId}/appusers/{userId}
AppUserApi deleteAppUserProfile DELETE /v1.1/apps/{appId}/appusers/{userId}/profile
AppUserApi getAppUser GET /v1.1/apps/{appId}/appusers/{userId}
AppUserApi getAppUserAuthCode GET /v1.1/apps/{appId}/appusers/{userId}/authcode
AppUserApi getAppUserBusinessSystemIds GET /v1.1/apps/{appId}/appusers/{userId}/businesssystems
AppUserApi getAppUserEntityIds GET /v1.1/apps/{appId}/appusers/{userId}/channels
AppUserApi getLinkRequests GET /v1.1/apps/{appId}/appusers/{userId}/linkrequest
AppUserApi linkAppUser POST /v1.1/apps/{appId}/appusers/{userId}/channels
AppUserApi mergeUsers POST /v1.1/apps/{appId}/appusers/merge
AppUserApi postImageMessage POST /v1.1/apps/{appId}/appusers/{userId}/images
AppUserApi preCreateAppUser POST /v1.1/apps/{appId}/appusers
AppUserApi unlinkAppUser DELETE /v1.1/apps/{appId}/appusers/{userId}/channels/{channel}
AppUserApi updateAppUser PUT /v1.1/apps/{appId}/appusers/{userId}
AttachmentsApi removeAttachment POST /v1.1/apps/{appId}/attachments/remove
AttachmentsApi uploadAttachment POST /v1.1/apps/{appId}/attachments
ConversationApi conversationActivity POST /v1.1/apps/{appId}/appusers/{userId}/conversation/activity
ConversationApi deleteMessage DELETE /v1.1/apps/{appId}/appusers/{userId}/messages/{messageId}
ConversationApi deleteMessages DELETE /v1.1/apps/{appId}/appusers/{userId}/messages
ConversationApi getMessages GET /v1.1/apps/{appId}/appusers/{userId}/messages
ConversationApi postMessage POST /v1.1/apps/{appId}/appusers/{userId}/messages
ConversationApi resetUnreadCount POST /v1.1/apps/{appId}/appusers/{userId}/conversation/read
DeploymentApi activatePhoneNumber POST /v1.1/whatsapp/deployments/{deploymentId}/activate
DeploymentApi confirmCode POST /v1.1/whatsapp/deployments/{deploymentId}/code/confirm
DeploymentApi createDeployment POST /v1.1/whatsapp/deployments
DeploymentApi deleteDeployment DELETE /v1.1/whatsapp/deployments/{deploymentId}
DeploymentApi getDeployment GET /v1.1/whatsapp/deployments/{deploymentId}
DeploymentApi listDeployments GET /v1.1/whatsapp/deployments
IntegrationApi createIntegration POST /v1.1/apps/{appId}/integrations
IntegrationApi createIntegrationMenu POST /v1.1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi deleteIntegration DELETE /v1.1/apps/{appId}/integrations/{integrationId}
IntegrationApi deleteIntegrationMenu DELETE /v1.1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi getIntegration GET /v1.1/apps/{appId}/integrations/{integrationId}
IntegrationApi getIntegrationMenu GET /v1.1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi getIntegrationProfile GET /v1.1/apps/{appId}/integrations/{integrationId}/profile
IntegrationApi listIntegrations GET /v1.1/apps/{appId}/integrations
IntegrationApi updateIntegration PUT /v1.1/apps/{appId}/integrations/{integrationId}
IntegrationApi updateIntegrationMenu PUT /v1.1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi updateIntegrationProfile PUT /v1.1/apps/{appId}/integrations/{integrationId}/profile
IntegrationApi uploadIntegrationProfilePhoto PUT /v1.1/apps/{appId}/integrations/{integrationId}/profile/photo
MenuApi deleteMenu DELETE /v1.1/apps/{appId}/menu
MenuApi getMenu GET /v1.1/apps/{appId}/menu
MenuApi updateMenu PUT /v1.1/apps/{appId}/menu
NotificationApi postNotification POST /v1/apps/{appId}/notifications
ServiceAccountApi createSecretKey POST /v1.1/serviceaccounts/{serviceAccountId}/keys
ServiceAccountApi createServiceAccount POST /v1.1/serviceaccounts
ServiceAccountApi deleteSecretKey DELETE /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}
ServiceAccountApi deleteServiceAccount DELETE /v1.1/serviceaccounts/{serviceAccountId}
ServiceAccountApi getJwt GET /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}/jwt
ServiceAccountApi getSecretKey GET /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}
ServiceAccountApi getServiceAccount GET /v1.1/serviceaccounts/{serviceAccountId}
ServiceAccountApi listSecretKeys GET /v1.1/serviceaccounts/{serviceAccountId}/keys
ServiceAccountApi listServiceAccounts GET /v1.1/serviceaccounts
ServiceAccountApi updateServiceAccount PUT /v1.1/serviceaccounts/{serviceAccountId}
TemplateApi createTemplate POST /v1.1/apps/{appId}/templates
TemplateApi deleteTemplate DELETE /v1.1/apps/{appId}/templates/{templateId}
TemplateApi getTemplate GET /v1.1/apps/{appId}/templates/{templateId}
TemplateApi listTemplates GET /v1.1/apps/{appId}/templates
TemplateApi updateTemplate PUT /v1.1/apps/{appId}/templates/{templateId}
WebhookApi createWebhook POST /v1.1/apps/{appId}/webhooks
WebhookApi deleteWebhook DELETE /v1.1/apps/{appId}/webhooks/{webhookId}
WebhookApi getWebhook GET /v1.1/apps/{appId}/webhooks/{webhookId}
WebhookApi listWebhooks GET /v1.1/apps/{appId}/webhooks
WebhookApi updateWebhook PUT /v1.1/apps/{appId}/webhooks/{webhookId}

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

jwt

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Copyright and license

Copyright 2018 Zendesk, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

smooch-java's People

Contributors

alavers avatar jugarrit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.