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.
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 |
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>4.0</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
compile "io.smooch:api:4.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 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();
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 API key authorization: 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();
}
}
}
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");
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 | 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 | 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 | 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 | |
ConversationApi | triggerTypingActivity | POST /v1.1/apps/{appId}/appusers/{userId}/conversation/activity | |
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 | 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 | |
MenuApi | deleteMenu | DELETE /v1.1/apps/{appId}/menu | |
MenuApi | getMenu | GET /v1.1/apps/{appId}/menu | |
MenuApi | updateMenu | PUT /v1.1/apps/{appId}/menu | |
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} |
- Action
- App
- AppCreate
- AppResponse
- AppSettings
- AppUpdate
- AppUser
- AppUserBusinessSystemsResponse
- AppUserChannelsResponse
- AppUserLink
- AppUserPreCreate
- AppUserResponse
- AppUserUpdate
- AttachmentRemove
- AttachmentResponse
- AuthCodeResponse
- BusinessSystemItem
- ChannelEntityItem
- Client
- ClientInfo
- Confirmation
- Conversation
- Destination
- DisplaySettings
- GetMessagesResponse
- Integration
- IntegrationCreate
- IntegrationProfileUpdate
- IntegrationResponse
- IntegrationUpdate
- JwtResponse
- LinkRequestResponse
- LinkRequestResponseLinkRequests
- ListAppsResponse
- ListIntegrationsResponse
- ListSecretKeysResponse
- ListServiceAccountsResponse
- ListTemplatesResponse
- ListWebhooksResponse
- Menu
- MenuItem
- MenuResponse
- Message
- MessageItem
- MessagePost
- MessageResponse
- SecretKey
- SecretKeyCreate
- SecretKeyResponse
- ServiceAccount
- ServiceAccountCreate
- ServiceAccountResponse
- ServiceAccountUpdate
- Source
- SubMenuItem
- Template
- TemplateCreate
- TemplateResponse
- TemplateUpdate
- TypingActivityTrigger
- Webhook
- WebhookCreate
- WebhookResponse
- WebhookUpdate
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.