Skip to content

API for Apps

KanaX edited this page Dec 6, 2021 · 1 revision

rc_app_api

Version 1.0

Path Table

Method Path Description
GET /{id}/settings/{setting-id} getSetting
POST /{id}/settings/{setting-id} updateSetting
GET /{id}/settings/{setting-id}/{agent-name} getAgentConfig
POST /{id}/settings/{setting-id}/{agent-name} addAgentConfig
PUT /{id}/settings/{setting-id}/{agent-name} updateAgentConfig
DELETE /{id}/settings/{setting-id}/{agent-name} deleteAgentConfig
GET /'' getApps

Reference Table

Name Path Description
User #/components/schemas/User
API Key - 1 #/components/securitySchemes/API Key - 1
API Key - 2 #/components/securitySchemes/API Key - 2

Path Details


[GET]/{id}/settings/{setting-id}

  • Summary
    getSetting

  • Description
    Returns and Updates the value of Setting with the specified setting-id on the App with the specified id

--- FOR setting-id === 'agents'---

This setting-id returns the setting object handling all agent settings. The property "value" of the object is a JSON file with a list of agents containing agent settings.

Responses

  • 200 OK

application/json

{
  setting: {
  }
  success: boolean
}
  • Examples

    • app setting example
{
  "value": {
    "setting": {
      "id": "log_level",
      "public": true,
      "type": "select",
      "packageValue": "0",
      "value": "2",
      "values": [
        {
          "key": "0",
          "i18nLabel": "0_Errors_Only"
        },
        {
          "key": "1",
          "i18nLabel": "1_Errors_and_Information"
        },
        {
          "key": "2",
          "i18nLabel": "2_Erros_Information_and_Debug"
        }
      ],
      "i18nLabel": "dialogflow_log_level",
      "i18nDescription": "dialogflow_log_level_description",
      "required": false,
      "createdAt": "2021-11-29T17:46:17.363Z",
      "updatedAt": "2021-11-30T14:15:07.345Z"
    },
    "success": true
  }
}
  • agent list setting example
{
  "value": {
    "setting": {
      "id": "agents",
      "public": true,
      "type": "multiCode",
      "packageValue": "[\n\t{\n\t\t\"omnichannel_agent\": {\n\t\t\t\"project_id\": \"\",\n\t\t\t\"client_email\": \"\",\n\t\t\t\"agent_id\": \"\",\n\t\t\t\"agent_region\": \"\",\n\t\t\t\"agent_default_language\": \"EN\",\n\t\t\t\"environment_id\": \"\",\n\t\t\t\"private_key\": \"\",\n\t\t\t\"agent_version\": \"\",\n\t\t\t\"fallback_responses_limit\": 3,\n\t\t\t\"fallback_target_department\": \"Viasat Customer Support\",\n\t\t\t\"handover_message\": \"Connecting you with a live agent\",\n\t\t\t\"no_agents_for_handover_message\": \"\",\n\t\t\t\"service_unavailable_message\": \"There are no agents currently available. Our Customer Care team is available by phone 24/7 at 1-855-463-9333.\",\n\t\t\t\"close_chat_message\": \"Thanks for contacting Viasat Customer Care. We appreciate your business. Please close this window to end your chat session.\",\n\t\t\t\"hide_quickreplies\": true,\n\t\t\t\"enable_chat_closed_by_visitor_event\": true,\n\t\t\t\"chat_closed_by_visitor_event\": \"end_live_chat\",\n\t\t\t\"enable_welcome_message\": true,\n\t\t\t\"welcome_message\": \"Hi there! I am a virtual assistant, designed to answer questions about your service.\",\n\t\t\t\"welcome_intent_on_start\": true,\n\t\t\t\"enable_customer_timeout\": false,\n\t\t\t\"customer_timeout_time\": 240,\n\t\t\t\"customer_timeout_warning_time\": 180,\n\t\t\t\"customer_timeout_warning_message\": \"Are you still there? Please send a message within %t or this chat will time out.\",\n\t\t\t\"session_maintenance_interval\": \"5 minutes\",\n\t\t\t\"session_maintenance_event_name\": \"session_maintenance\"\n\t\t}\n\t}\n]",
      "i18nLabel": "dialogflow_bot_list_config",
      "i18nDescription": "dialogflow_bot_list_config_description",
      "required": true,
      "createdAt": "2021-11-30T14:34:36.178Z",
      "updatedAt": "2021-12-06T13:00:12.629Z",
      "value": "[\n\t{\n\t\t\"omnichannel_agent\": {\n\t\t\t\"project_id\": \"\",\n\t\t\t\"client_email\": \"\",\n\t\t\t\"agent_id\": \"\",\n\t\t\t\"agent_region\": \"\",\n\t\t\t\"agent_default_language\": \"EN\",\n\t\t\t\"environment_id\": \"\",\n\t\t\t\"private_key\": \"\",\n\t\t\t\"agent_version\": \"\",\n\t\t\t\"fallback_responses_limit\": 3,\n\t\t\t\"fallback_target_department\": \"Viasat Customer Support\",\n\t\t\t\"handover_message\": \"Connecting you with a live agent\",\n\t\t\t\"no_agents_for_handover_message\": \"\",\n\t\t\t\"service_unavailable_message\": \"There are no agents currently available. Our Customer Care team is available by phone 24/7 at 1-855-463-9333.\",\n\t\t\t\"close_chat_message\": \"Thanks for contacting Viasat Customer Care. We appreciate your business. Please close this window to end your chat session.\",\n\t\t\t\"hide_quickreplies\": true,\n\t\t\t\"enable_chat_closed_by_visitor_event\": true,\n\t\t\t\"chat_closed_by_visitor_event\": \"end_live_chat\",\n\t\t\t\"enable_welcome_message\": true,\n\t\t\t\"welcome_message\": \"Hi there! I am a virtual assistant, designed to answer questions about your service.\",\n\t\t\t\"welcome_intent_on_start\": true,\n\t\t\t\"enable_customer_timeout\": false,\n\t\t\t\"customer_timeout_time\": 240,\n\t\t\t\"customer_timeout_warning_time\": 180,\n\t\t\t\"customer_timeout_warning_message\": \"Are you still there? Please send a message within %t or this chat will time out.\",\n\t\t\t\"session_maintenance_interval\": \"5 minutes\",\n\t\t\t\"session_maintenance_event_name\": \"session_maintenance\"\n\t\t}\n\t},\n\t{\n\t\t\"test_agent\": {\n\t\t\t\"project_id\": \"2\",\n\t\t\t\"client_email\": \"\",\n\t\t\t\"agent_id\": \"\",\n\t\t\t\"agent_region\": \"\",\n\t\t\t\"agent_default_language\": \"EN\",\n\t\t\t\"environment_id\": \"\",\n\t\t\t\"private_key\": \"\",\n\t\t\t\"agent_version\": \"\",\n\t\t\t\"fallback_responses_limit\": 3,\n\t\t\t\"fallback_target_department\": \"Viasat Customer Support\",\n\t\t\t\"handover_message\": \"Connecting you with a live agent\",\n\t\t\t\"no_agents_for_handover_message\": \"\",\n\t\t\t\"service_unavailable_message\": \"There are no agents currently available. Our Customer Care team is available by phone 24/7 at 1-855-463-9333.\",\n\t\t\t\"close_chat_message\": \"Thanks for contacting Viasat Customer Care. We appreciate your business. Please close this window to end your chat session.\",\n\t\t\t\"hide_quickreplies\": true,\n\t\t\t\"enable_chat_closed_by_visitor_event\": true,\n\t\t\t\"chat_closed_by_visitor_event\": \"end_live_chat\",\n\t\t\t\"enable_welcome_message\": true,\n\t\t\t\"welcome_message\": \"Hi there! I am a virtual assistant, designed to answer questions about your service.\",\n\t\t\t\"welcome_intent_on_start\": true,\n\t\t\t\"enable_customer_timeout\": false,\n\t\t\t\"customer_timeout_time\": 240,\n\t\t\t\"customer_timeout_warning_time\": 180,\n\t\t\t\"customer_timeout_warning_message\": \"Are you still there? Please send a message within %t or this chat will time out.\",\n\t\t\t\"session_maintenance_interval\": \"5 minutes\",\n\t\t\t\"session_maintenance_event_name\": \"session_maintenance\"\n\t\t}\n\t}\n]"
    },
    "success": true
  }
}

application/xml

{
}
  • 404 Not Found

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No Setting found
{
  "value": {
    "success": false,
    "error": "No Setting found on the App by the id of: {id}"
  }
}
  • No App found
{
  "value": {
    "success": false,
    "error": "No App found by the id of: {id}"
  }
}

[POST]/{id}/settings/{setting-id}

  • Summary
    updateSetting

  • Description
    --- FOR setting-id === 'agents'---

This setting-id updates the value of the setting object handling all agent settings.

Any update from this endpoint will reset the entire JSON list. It is not recommended in the case only a single agent needs to be updated

RequestBody

  • application/json
{
  value: boolean | integer | array | string
}

Responses

  • 200 OK

application/json

{
  sucess: boolean
}
  • Examples

    • post app setting loglevel
{
  "value": {
    "success": true
  }
}
  • 400 Bad Request

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No value in request body
{
  "value": {
    "success": false,
    "error": "No value in request body"
  }
}
  • 404 Not Found

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No Setting found
{
  "value": {
    "success": false,
    "error": "No Setting found on the App by the id of: {id}"
  }
}
  • No App found
{
  "value": {
    "success": false,
    "error": "No App by the id of: {id}"
  }
}

[GET]/{id}/settings/{setting-id}/{agent-name}

  • Summary
    getAgentConfig

  • Description
    Returns, adds, updates and deletes agents using an agent-name in the setting with the specified setting-id in App with the specified id.

Responses

  • 200 OK

application/json

{
  agentConfig: {
    project_id: string
    client_email: string
    agent_id: string
    agent_region: string
    agent_default_language: string
    environment_id: string
    private_key: string
    agent_version: string
    fallback_responses_limit: number
    fallback_target_department: string
    handover_message: string
    no_agents_for_handover_message: string
    service_unavailable_message: string
    close_chat_message: string
    hide_quickreplies: boolean
    enable_chat_closed_by_visitor_event: boolean
    chat_closed_by_visitor_event: string
    enable_welcome_message: boolean
    welcome_message: string
    welcome_intent_on_start: boolean
    enable_customer_timeout: boolean
    customer_timeout_time: number
    customer_timeout_warning_time: number
    customer_timeout_warning_message: string
    session_maintenance_interval: string
    session_maintenance_event_name: string
  }
  success: boolean
}
  • Examples

    • agent_example
{
  "value": {
    "agentConfig": {
      "project_id": "2",
      "client_email": "",
      "agent_id": "",
      "agent_region": "",
      "agent_default_language": "EN",
      "environment_id": "",
      "private_key": "",
      "agent_version": "",
      "fallback_responses_limit": 3,
      "fallback_target_department": "Viasat Customer Support",
      "handover_message": "Connecting you with a live agent",
      "no_agents_for_handover_message": "",
      "service_unavailable_message": "There are no agents currently available. Our Customer Care team is available by phone 24/7 at 1-855-463-9333.",
      "close_chat_message": "Thanks for contacting Viasat Customer Care. We appreciate your business. Please close this window to end your chat session.",
      "hide_quickreplies": true,
      "enable_chat_closed_by_visitor_event": true,
      "chat_closed_by_visitor_event": "end_live_chat",
      "enable_welcome_message": true,
      "welcome_message": "Hi there! I am a virtual assistant, designed to answer questions about your service.",
      "welcome_intent_on_start": true,
      "enable_customer_timeout": false,
      "customer_timeout_time": 240,
      "customer_timeout_warning_time": 180,
      "customer_timeout_warning_message": "Are you still there? Please send a message within %t or this chat will time out.",
      "session_maintenance_interval": "5 minutes",
      "session_maintenance_event_name": "session_maintenance"
    },
    "success": true
  }
}
  • 404 Not Found

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No App Found
{
  "value": {
    "success": false,
    "error": "No App found by the id of: {appId}"
  }
}
  • No Setting Sound
{
  "value": {
    "success": false,
    "error": "No Setting found on the App by the id of: {settingId}"
  }
}
  • No Agent Found
{
  "value": {
    "success": false,
    "error": "Error: No agent found with name {agent}"
  }
}

[POST]/{id}/settings/{setting-id}/{agent-name}

  • Summary
    addAgentConfig

RequestBody

  • application/json
{
  value: {
    project_id: string
    client_email: string
    agent_id: string
    agent_region: string
    agent_default_language: string
    environment_id: string
    private_key: string
    agent_version: string
    fallback_responses_limit: number
    fallback_target_department: string
    handover_message: string
    no_agents_for_handover_message: string
    service_unavailable_message: string
    close_chat_message: string
    hide_quickreplies: boolean
    enable_chat_closed_by_visitor_event: boolean
    chat_closed_by_visitor_event: string
    enable_welcome_message: boolean
    welcome_message: string
    welcome_intent_on_start: boolean
    enable_customer_timeout: boolean
    customer_timeout_time: number
    customer_timeout_warning_time: number
    customer_timeout_warning_message: string
    session_maintenance_interval: string
    session_maintenance_event_name: string
  }
}

Responses

  • 200 OK

application/json

{
  success: boolean
}
  • Examples

    • Post Agent Success
{
  "value": {
    "success": true
  }
}
  • 400 Bad Request

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No value
{
  "value": {
    "success": true,
    "error": "No value in request body"
  }
}
  • 404 Not Found

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No App Found
{
  "value": {
    "success": false,
    "error": "No App found by the id of: {appId}"
  }
}
  • No Setting Found
{
  "value": {
    "success": false,
    "error": "No Setting found on the App by the id of: {settingId}"
  }
}
  • No Agent Found
{
  "value": {
    "success": false,
    "error": "No Agent found with the name: {agent}"
  }
}

application/xml

{
}

multipart/form-data

{
}

[PUT]/{id}/settings/{setting-id}/{agent-name}

  • Summary
    updateAgentConfig

RequestBody

  • application/json
{
  value: {
    project_id: string
    client_email: string
    agent_id: string
    agent_region: string
    agent_default_language: string
    environment_id: string
    private_key: string
    agent_version: string
    fallback_responses_limit: number
    fallback_target_department: string
    handover_message: string
    no_agents_for_handover_message: string
    service_unavailable_message: string
    close_chat_message: string
    hide_quickreplies: boolean
    enable_chat_closed_by_visitor_event: boolean
    chat_closed_by_visitor_event: string
    enable_welcome_message: boolean
    welcome_message: string
    welcome_intent_on_start: boolean
    enable_customer_timeout: boolean
    customer_timeout_time: number
    customer_timeout_warning_time: number
    customer_timeout_warning_message: string
    session_maintenance_interval: string
    session_maintenance_event_name: string
  }
}

Responses

  • 200 OK

application/json

{
  sucess: boolean
}
  • Examples

    • Agent Update Success
{
  "value": {
    "sucess": true
  }
}
  • 400 Bad Request

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No value
{
  "value": {
    "success": false,
    "error": "No value in request body"
  }
}
  • 404 Not Found

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No App Found
{
  "value": {
    "success": false,
    "error": "No App found by the id of: {appId}"
  }
}
  • No Setting Found
{
  "value": {
    "success": false,
    "error": "No Setting found on the App by the id of: {settingId}"
  }
}
  • No Agent Found
{
  "value": {
    "success": false,
    "error": "No Agent found with the name: {agent}"
  }
}

[DELETE]/{id}/settings/{setting-id}/{agent-name}

  • Summary
    deleteAgentConfig

Responses

  • 200 OK

application/json

{
  success: boolean
}
  • Examples

    • Agent Delete Success
{
  "value": {
    "success": true
  }
}
  • 404 Not Found

application/json

{
  success: boolean
  error: string
}
  • Examples

    • No App Found
{
  "value": {
    "success": false,
    "error": "No App found by the id of: {appId}"
  }
}
  • No Setting Found
{
  "value": {
    "success": false,
    "error": "No Setting found on the App by the id of: {settingId}"
  }
}
  • No Agent Found
{
  "value": {
    "success": false,
    "error": "No Agent found with the name: {agent}"
  }
}

[GET]/''

  • Summary
    getApps

  • Description
    This endpoint returns apps, either installed in this instance of RC, or marketplace apps.

Parameters(Query)

marketplace?: string
categories?: string
appName?: string

Responses

  • 200 OK

application/json

{
[]
  success: boolean
}
  • Examples

    • Get with no Query Params
{
  "value": {
    "apps": [
      {
        "id": "0d3ac5b3-dd0b-43d3-924a-5a7433902589",
        "version": "1.0.0",
        "requiredApiVersion": "^1.17.0",
        "iconFile": "icon.png",
        "author": {
          "name": "Rocket.Chat",
          "homepage": "https://github.com/RocketChat/Apps.Salesforce.LiveAgent",
          "support": "https://github.com/RocketChat/Apps.Salesforce.LiveAgent/issues"
        },
        "name": "Saleforce Live Agent Integration",
        "nameSlug": "salesforce-live-agent-integration",
        "classFile": "SalesforceLiveAgentApp.js",
        "description": "Integration between Rocket.Chat and the Salesforce Live Agent (Chat). Please refer our Github repository for setup instructions.",
        "implements": [
          "IPostMessageSent",
          "IPostLivechatAgentAssigned",
          "IPostLivechatAgentUnassigned",
          "IPostLivechatRoomClosed",
          "IRoomUserTyping",
          "IUIKitLivechatInteractionHandler"
        ],
        "commitHash": "947b904c7e5fe7512fb0d7df174a2ffc0ee02397",
        "iconFileContent": "",
        "updatedAt": "2021-11-04T15:00:22.622Z",
        "status": "auto_enabled",
        "languages": {}
      },
      {
        "id": "21b7d3ba-031b-41d9-8ff2-fbbfa081ae90",
        "version": "1.2.3",
        "requiredApiVersion": "^1.17.0",
        "iconFile": "icon.png",
        "author": {
          "name": "Rocket.Chat",
          "homepage": "https://rocket.chat/",
          "support": "support@rocket.chat"
        },
        "name": "Dialogflow",
        "nameSlug": "dialogflow",
        "classFile": "DialogflowApp.js",
        "description": "Integration between Rocket.Chat and the Dialogflow Chatbot platform",
        "implements": [
          "IPostMessageSent",
          "IPostLivechatAgentAssigned",
          "IPostLivechatAgentUnassigned",
          "IPostLivechatRoomClosed",
          "IUIKitLivechatInteractionHandler"
        ],
        "commitHash": "10677db664589b7bc9bc244f9aa186c5923cb2ae",
        "iconFileContent": "",
        "status": "auto_enabled",
        "languages": {
          "en": {
            "dialogflow_bot_list_config": "Dialogflow Agent Configuration List",
            "dialogflow_bot_list_config_description": "An object containing the Omnichannel bots and the configurations necessary to reach the corresponsind DF agent endpont",
            "dialogflow_log_level_description": "Redeploying app or restarting server is required to apply changes"
          }
        }
      }
    ],
    "success": true
  }
}
  • Get with appName === "" Query Param
{
  "value": {
    "Saleforce Live Agent Integration": "0d3ac5b3-dd0b-43d3-924a-5a7433902589",
    "Dialogflow": "21b7d3ba-031b-41d9-8ff2-fbbfa081ae90",
    "success": true
  }
}
  • Get with appName === "Dialogflow" Query Param
{
  "value": {
    "Dialogflow": "21b7d3ba-031b-41d9-8ff2-fbbfa081ae90",
    "success": true
  }
}

References

#/components/schemas/User

{
  // Unique identifier for the given user.
  id: integer
  firstName: string
  lastName: string
  email: string
  dateOfBirth?: string
  // Set to true if the user's email has been verified.
  emailVerified: boolean
  // The date that the user was created.
  createDate?: string
}

#/components/securitySchemes/API Key - 1

#/components/securitySchemes/API Key - 2