Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,76 @@
"implements": [
"IPostMessageSent",
"IUIKitLivechatInteractionHandler"
],
"permissions": [
{
"name": "livechat-department.multiple"
},
{
"name": "networking"
},
{
"name": "persistence"
},
{
"name": "api"
},
{
"name": "livechat-department.read"
},
{
"name": "livechat-room.write"
},
{
"name": "livechat-room.read"
},
{
"name": "livechat-message.write"
},
{
"name": "livechat-message.read"
},
{
"name": "livechat-visitor.write"
},
{
"name": "livechat-visitor.read"
},
{
"name": "livechat-status.read"
},
{
"name": "livechat-custom-fields.write"
},
{
"name": "message.write"
},
{
"name": "message.read"
},
{
"name": "room.write"
},
{
"name": "ui.interact"
},
{
"name": "room.read"
},
{
"name": "server-setting.read"
},
{
"name": "upload.write"
},
{
"name": "upload.read"
},
{
"name": "user.read"
},
{
"name": "user.write"
}
]
}
}
76 changes: 38 additions & 38 deletions config/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum AppSetting {
DialogflowHandoverFailedMessage = 'dialogflow_no_agents_online_for_handover',
DialogflowCloseChatMessage = 'dialogflow_close_chat_message',
DialogflowHideQuickReplies = 'dialogflow_hide_quick_replies',
DialogflowDefaultLanguage = 'dialogflow_default_language',
DialogflowDefaultLanguage = 'dialogflow_default_language',
}

export enum ServerSetting {
Expand All @@ -32,33 +32,33 @@ export enum DefaultMessage {
}

export const LanguageCode: Array<ISettingSelectValue> = [
{ key: 'zh-CN', i18nLabel: 'Chinese - Simplified' },
{ key: 'da', i18nLabel: 'Danish' },
{ key: 'nl', i18nLabel: 'Dutch' },
{ key: 'en', i18nLabel: 'English' },
{ key: 'en-AU', i18nLabel: 'English - Australia' },
{ key: 'en-CA', i18nLabel: 'English - Canada' },
{ key: 'en-GB', i18nLabel: 'English - Great Britain' },
{ key: 'en-IN', i18nLabel: 'English - India' },
{ key: 'en-US', i18nLabel: 'English - US' },
{ key: 'fr-CA', i18nLabel: 'French - Canada' },
{ key: 'fr-FR', i18nLabel: 'French - France' },
{ key: 'de', i18nLabel: 'German' },
{ key: 'hi', i18nLabel: 'Hindi' },
{ key: 'id', i18nLabel: 'Indonesian' },
{ key: 'it', i18nLabel: 'Italian' },
{ key: 'ja', i18nLabel: 'Japanese' },
{ key: 'ko', i18nLabel: 'Korean' },
{ key: 'no', i18nLabel: 'Norwegian' },
{ key: 'pl', i18nLabel: 'Polish' },
{ key: 'pt-BR', i18nLabel: 'Portuguese - Brazil' },
{ key: 'pt', i18nLabel: 'Portuguese - Portugal' },
{ key: 'ru', i18nLabel: 'Russian' },
{ key: 'es', i18nLabel: 'Spanish' },
{ key: 'es-ES', i18nLabel: 'Spanish - Spain' },
{ key: 'sv', i18nLabel: 'Swedish' },
{ key: 'tr', i18nLabel: 'Turkish' },
{ key: 'uk', i18nLabel: 'Ukrainian' },
{ key: 'zh-CN', i18nLabel: 'Chinese - Simplified' },
{ key: 'da', i18nLabel: 'Danish' },
{ key: 'nl', i18nLabel: 'Dutch' },
{ key: 'en', i18nLabel: 'English' },
{ key: 'en-AU', i18nLabel: 'English - Australia' },
{ key: 'en-CA', i18nLabel: 'English - Canada' },
{ key: 'en-GB', i18nLabel: 'English - Great Britain' },
{ key: 'en-IN', i18nLabel: 'English - India' },
{ key: 'en-US', i18nLabel: 'English - US' },
{ key: 'fr-CA', i18nLabel: 'French - Canada' },
{ key: 'fr-FR', i18nLabel: 'French - France' },
{ key: 'de', i18nLabel: 'German' },
{ key: 'hi', i18nLabel: 'Hindi' },
{ key: 'id', i18nLabel: 'Indonesian' },
{ key: 'it', i18nLabel: 'Italian' },
{ key: 'ja', i18nLabel: 'Japanese' },
{ key: 'ko', i18nLabel: 'Korean' },
{ key: 'no', i18nLabel: 'Norwegian' },
{ key: 'pl', i18nLabel: 'Polish' },
{ key: 'pt-BR', i18nLabel: 'Portuguese - Brazil' },
{ key: 'pt', i18nLabel: 'Portuguese - Portugal' },
{ key: 'ru', i18nLabel: 'Russian' },
{ key: 'es', i18nLabel: 'Spanish' },
{ key: 'es-ES', i18nLabel: 'Spanish - Spain' },
{ key: 'sv', i18nLabel: 'Swedish' },
{ key: 'tr', i18nLabel: 'Turkish' },
{ key: 'uk', i18nLabel: 'Ukrainian' },
];

export const settings: Array<ISetting> = [
Expand Down Expand Up @@ -103,17 +103,17 @@ export const settings: Array<ISetting> = [
i18nLabel: 'dialogflow_private_key',
required: true,
},
{
id: AppSetting.DialogflowDefaultLanguage,
public: true,
type: SettingType.SELECT,
values: LanguageCode,
packageValue: 'en',
value: 'en',
i18nLabel: 'dialogflow_default_language',
{
id: AppSetting.DialogflowDefaultLanguage,
public: true,
type: SettingType.SELECT,
values: LanguageCode,
packageValue: 'en',
value: 'en',
i18nLabel: 'dialogflow_default_language',
i18nDescription: 'dialogflow_default_language_description',
required: false,
},
},
{
id: AppSetting.DialogflowFallbackResponsesLimit,
public: true,
Expand All @@ -131,7 +131,7 @@ export const settings: Array<ISetting> = [
packageValue: '',
i18nLabel: 'target_department_for_handover',
i18nDescription: 'target_department_for_handover_description',
required: false,
required: true,
},
{
id: AppSetting.DialogflowHandoverMessage,
Expand Down
8 changes: 8 additions & 0 deletions lib/SynchronousHandover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ export const incFallbackIntent = async (
const targetDepartmentName: string | undefined =
await getAppSettingValue(read, AppSetting.FallbackTargetDepartment);

// This setting was not required. However, the handover doesn't work without it (as the target department is not specified and the transfer requires a target agent/department)
// Since this app doesnt allow direct transfer to an agent, department becomes mandatory or the process fails.
if (!targetDepartmentName) {
throw new Error(
'No department specified for handover, cannot continue',
);
}

// Session Id from Dialogflow will be the same as Room id
await performHandover(
app,
Expand Down
Loading