copyright: years: 2017, 2021 lastupdated: "2021-04-14"
Configuring tenants in a multi-tenant SMS Gateway JSON configuration
Although similar in concept, using JSON configuration for a multi-tenant SMS Gateway environment differs from single-tenant configuration in that the tenant configuration is separated from the server configuration.
- Single-tenant environment: SMS Gateway is configured through Docker environment variables unless further altered using the API.
- Multi-tenant JSON configuration: Tenant configuration is specified and stored in a separate JSON file, which is then referenced in the SMS Gateway configuration. Configuration that isn't related to a tenant, such as server configuration, is specified through Docker environment variables.
By specifying tenant configuration as JSON objects, distinct configuration settings can be mapped to each individual tenant. For example, you can configure one tenant to allow customers to create SMS sessions, and configure the other tenant to only allow contact center agents to create sessions.
Configuring tenants
-
Create a JSON file that contains the configuration for one or more tenants.
Tip: To quickly get started, copy and paste the contents of the tenantConfig.json sample file into an empty JSON file. Then edit the file and add the configuration for each tenant.
Within a main
tenants
object, specify a list of tenant objects. Each tenant can contain the following keys:tenantPhoneNumber
: The phone number provisioned from the SMS provider. Use the exact number format that the SMS provider requires. Required.description
: A description of the tenant, such as how it's used. Optional, but recommended.
You can also include the following JSON objects:
conversation
: A JSON object of configuration properties for Watson Assistant. Required.smsProvider
: A JSON object of configuration properties for the SMS provider. Required.webHookCredentials
: A JSON object of configuration properties with credentials to enable basic HTTP authentication for the SMS provider webhook. Optional.controlCredentials
: A JSON object of configuration properties with credentials for sending requests from the SMS Gateway REST API. Optional.
In addition, you can define other optional properties to configure each tenant. For a full list of properties, see Advanced JSON configuration properties for SMS Gateway.
For example, the following JSON configures a tenant at the number +1-234-555-6789, plus another tenant at +1-876-555-4321 whose details are not shown.
{ "tenants": [ { "tenantPhoneNumber": "+12345556789", "description": "Car insurance assistance", "allowSessionCreateViaSMS": "false", "timeoutForSession": "3600", "conversationFailedReplyMessage": "We can't respond to your message.", "convReadTimeout": "30000", "convConnectTimeout": "30000", "smsProviderConnectTimeout": "30000", "smsProviderReadTimeout": "30000", "conversation": { "url": "https://api.us-south.assistant.watson.cloud.ibm.com/instances/{instance_id}", "username": "9h7f54cb-d9ed-46b3-8492-e9a9bf555021", "apikey": "{apikey}", "tokenServiceProviderUrl": "https://iam.cloud.ibm.com/identity/token" }, "smsProvider": { "url": "https://api.twilio.com", "username": "A23de67h0236e5e7c7f1ead4499h7f54cb", "password": "9h7f54cb3b1d3736e19ac64aa23de67h" }, }, { "tenantPhoneNumber": "+18765554321", "description": "Homeowners insurance assistance", ... } ] }
-
Add your tenant configuration to the SMS Gateway configuration, and deploy your environment. For more information, see Deploying a multi-tenant environment.
Next steps
See Advanced JSON configuration properties for SMS Gateway for an example JSON configuration file which includes optional JSON objects and properties.