Smooch API Library for Python
Python Shell
Clone or download
Smooch Bot
Latest commit 239057e Jul 12, 2018


The Python 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.


Python 2.7 or 3.4+


pip install smooch

(you may need to run pip with root permission: sudo pip install smooch)

Getting Started

Authentication with JSON Web Tokens (JWTs)

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.

secret key and id

Step 2 Generate the JWT

Using the pyjwt module:

import jwt
token_bytes = jwt.encode({'scope': 'app'},
                         headers={'kid': 'KEY_ID'})
token = token_bytes.decode('utf-8')

Running the code

import smooch
from import ApiException
from pprint import pprint

# Configure API key authorization: jwt
smooch.configuration.api_key['Authorization'] = 'YOUR_JWT'
smooch.configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = smooch.AppApi()
app_create_body = smooch.AppCreate() # AppCreate | Body for a createApp request.

    api_response = api_instance.create_app(app_create_body)
except ApiException as e:
    print("Exception when calling AppApi->create_app: %s\n" % e)


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 For example: = ''

Documentation for API Endpoints

All URIs are relative to

Class Method HTTP request Description
AppApi create_app POST /v1/apps
AppApi create_secret_key POST /v1/apps/{appId}/keys
AppApi delete_app DELETE /v1/apps/{appId}
AppApi delete_secret_key DELETE /v1/apps/{appId}/keys/{keyId}
AppApi get_app GET /v1/apps/{appId}
AppApi get_app_jwt GET /v1/apps/{appId}/keys/{keyId}/jwt
AppApi get_secret_key GET /v1/apps/{appId}/keys/{keyId}
AppApi list_apps GET /v1/apps
AppApi list_secret_keys GET /v1/apps/{appId}/keys
AppApi update_app PUT /v1/apps/{appId}
AppUserApi delete_app_user DELETE /v1/apps/{appId}/appusers/{userId}
AppUserApi delete_app_user_profile DELETE /v1/apps/{appId}/appusers/{userId}/profile
AppUserApi get_app_user GET /v1/apps/{appId}/appusers/{userId}
AppUserApi get_app_user_auth_code GET /v1/apps/{appId}/appusers/{userId}/authcode
AppUserApi get_app_user_business_system_ids GET /v1/apps/{appId}/appusers/{userId}/businesssystems
AppUserApi get_app_user_entity_ids GET /v1/apps/{appId}/appusers/{userId}/channels
AppUserApi get_link_requests GET /v1/apps/{appId}/appusers/{userId}/linkrequest
AppUserApi link_app_user POST /v1/apps/{appId}/appusers/{userId}/channels
AppUserApi post_image_message POST /v1/apps/{appId}/appusers/{userId}/images
AppUserApi pre_create_app_user POST /v1/apps/{appId}/appusers
AppUserApi unlink_app_user DELETE /v1/apps/{appId}/appusers/{userId}/channels/{channel}
AppUserApi update_app_user PUT /v1/apps/{appId}/appusers/{userId}
AttachmentsApi remove_attachment POST /v1/apps/{appId}/attachments/remove
AttachmentsApi upload_attachment POST /v1/apps/{appId}/attachments
ConversationApi delete_message DELETE /v1/apps/{appId}/appusers/{userId}/messages/{messageId}
ConversationApi delete_messages DELETE /v1/apps/{appId}/appusers/{userId}/messages
ConversationApi get_messages GET /v1/apps/{appId}/appusers/{userId}/messages
ConversationApi post_message POST /v1/apps/{appId}/appusers/{userId}/messages
ConversationApi reset_unread_count POST /v1/apps/{appId}/appusers/{userId}/conversation/read
ConversationApi trigger_typing_activity POST /v1/apps/{appId}/appusers/{userId}/conversation/activity
IntegrationApi create_integration POST /v1/apps/{appId}/integrations
IntegrationApi create_integration_menu POST /v1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi delete_integration DELETE /v1/apps/{appId}/integrations/{integrationId}
IntegrationApi delete_integration_menu DELETE /v1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi get_integration GET /v1/apps/{appId}/integrations/{integrationId}
IntegrationApi get_integration_menu GET /v1/apps/{appId}/integrations/{integrationId}/menu
IntegrationApi list_integrations GET /v1/apps/{appId}/integrations
IntegrationApi update_integration PUT /v1/apps/{appId}/integrations/{integrationId}
IntegrationApi update_integration_menu PUT /v1/apps/{appId}/integrations/{integrationId}/menu
MenuApi delete_menu DELETE /v1/apps/{appId}/menu
MenuApi get_menu GET /v1/apps/{appId}/menu
MenuApi update_menu PUT /v1/apps/{appId}/menu
ServiceAccountApi create_secret_key POST /v1/serviceaccounts/{serviceAccountId}/keys
ServiceAccountApi create_service_account POST /v1/serviceaccounts
ServiceAccountApi delete_secret_key DELETE /v1/serviceaccounts/{serviceAccountId}/keys/{keyId}
ServiceAccountApi delete_service_account DELETE /v1/serviceaccounts/{serviceAccountId}
ServiceAccountApi get_jwt GET /v1/serviceaccounts/{serviceAccountId}/keys/{keyId}/jwt
ServiceAccountApi get_secret_key GET /v1/serviceaccounts/{serviceAccountId}/keys/{keyId}
ServiceAccountApi get_service_account GET /v1/serviceaccounts/{serviceAccountId}
ServiceAccountApi list_secret_keys GET /v1/serviceaccounts/{serviceAccountId}/keys
ServiceAccountApi list_service_accounts GET /v1/serviceaccounts
ServiceAccountApi update_service_account PUT /v1/serviceaccounts/{serviceAccountId}
WebhookApi create_webhook POST /v1/apps/{appId}/webhooks
WebhookApi delete_webhook DELETE /v1/apps/{appId}/webhooks/{webhookId}
WebhookApi get_webhook GET /v1/apps/{appId}/webhooks/{webhookId}
WebhookApi list_webhooks GET /v1/apps/{appId}/webhooks
WebhookApi update_webhook PUT /v1/apps/{appId}/webhooks/{webhookId}

Documentation For Models

Documentation For Authorization


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