Alli Conversational AI

Alli AnswerBot allows you to build personalized user interaction, give your users full access to your knowledge base, and transform your team's operation efficiency across web and mobile.

Additional documentation can be found at: https://doc.alli.ai/

Start Conversation

POST https://backend.alli.ai/webapi/start_conversation

Start a conversation using a Skill. Note: this endpoint is currently only compatible with Message Node, Q&A Node, and Documents Node.

Headers

Request Body

{
    "result": {
        "conversation": {
            "id": "CONVERSATION_ID",
            "project": {
                "nluLanguage": "LANGUAGE"
            },
            "chats": {
                "edges": [
                    {
                        "node": {
                            "id": "CHAT_ID",
                            "message": "MESSAGE",
                            "createdAt": NUMBER,
                            "chatOptionInfos": [
                                {
                                    "shortenOption": "BUTTON_TEXT",
                                    "longOption": "BUTTON_TEXT",
                                    "style": {
                                        "bgColor": "COLOR_HEX",
                                        "bold": BOOLEAN,
                                        "fontColor": "COLOR_HEX",
                                        "italic": BOOLEAN,
                                        "lineColor": "COLOR_HEX",
                                        "underline": BOOLEAN
                                    },
                                    "meta": ""
                                },
                                {
                                    "shortenOption": "BUTTON_TEXT",
                                    "longOption": "BUTTON_TEXT",
                                    "style": {
                                        "bgColor": "COLOR_HEX",
                                        "bold": BOOLEAN,
                                        "fontColor": "COLOR_HEX",
                                        "italic": BOOLEAN,
                                        "lineColor": "COLOR_HEX",
                                        "underline": BOOLEAN
                                    },
                                    "meta": ""
                                }
                            ],
                            "isDeleted": BOOLEAN
                        }
                    }
                ]
            }
        }
    },
    "errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -L -X POST 'https://backend.alli.ai/webapi/start_conversation' \
-H 'API-KEY: YOUR_API_KEY' \
-H 'OWN-USER-ID: test_userid' \
-H 'Content-Type: application/json' \
--data-raw '{"placement": "skill_A"}'

Response Example

{
    "result": {
        "conversation": {
            "id": "Q29udmVyc2F0aW9uOjYwMDZiNTM3MmRhPHAwMjZlOTFjMjllZQ==",
            "project": {
                "nluLanguage": "EN"
            },
            "chats": {
                "edges": [
                    {
                        "node": {
                            "id": "Q2hhdDo2MDQ2YjUzNzJkYWQwMDI2ZTkxYzI5ZDE=",
                            "message": "{\"blocks\": [{\"key\": \"egkjj\", \"text\": \"Please select an option\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}], \"entityMap\": {}}",
                            "createdAt": 1615246647609.666,
                            "chatOptionInfos": [
                                {
                                    "shortenOption": "FAQ",
                                    "longOption": "FAQ",
                                    "style": {
                                        "bgColor": "#FFFFFF",
                                        "bold": false,
                                        "fontColor": "#2074ff",
                                        "italic": false,
                                        "lineColor": "#2074ff",
                                        "underline": false
                                    },
                                    "meta": ""
                                },
                                {
                                    "shortenOption": "Document",
                                    "longOption": "Document",
                                    "style": {
                                        "bgColor": "#FFFFFF",
                                        "bold": false,
                                        "fontColor": "#2074ff",
                                        "italic": false,
                                        "lineColor": "#2074ff",
                                        "underline": false
                                    },
                                    "meta": ""
                                }
                            ],
                            "isDeleted": false
                        }
                    }
                ]
            }
        }
    },
    "errors": null
}

Send Chat

POST https://backend.alli.ai/webapi/send_chat

Send a message as the user for an existing conversation. Note: this endpoint is currently only compatible with Message Node, Q&A Node, and Documents Node.

Headers

Request Body

{
    "result": {
        "responses": [
            {
                "id": "CHAT_ID",
                "message": "MESSAGE",
                "createdAt": NUMBER,
                "isDeleted": BOOLEAN
            },
            {
                "id": "CHAT_ID",
                "message": "MESSAGE",
                "createdAt": NUMBER,
                "chatOptionInfos": [
                    {
                        "shortenOption": "BUTTON_TEXT",
                        "longOption": "BUTTON_TEXT",
                        "style": {
                            "bgColor": "COLOR_HEX",
                            "bold": BOOLEAN,
                            "fontColor": "COLOR_HEX",
                            "italic": BOOLEAN,
                            "lineColor": "COLOR_HEX",
                            "underline": BOOLEAN
                        },
                        "meta": ""
                    }
                ],
                "isDeleted": BOOLEAN
            }
        ],
        "state": "WAIT_USER_ANSWER_2"
    },
    "errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -L -X POST 'https://backend.alli.ai/webapi/send_chat' \
-H 'api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"conversationId": "Q29udmVyc2F0aW9uOjYwNDZiNWNkZTZkZGQ5MGE3ZWJlMGYxZQ==", "message": "I need help!"}'

Response Example

{
    "result": {
        "responses": [
            {
                "id": "Q2hhdDo2MDQ2YjVlY2U2ZGRkOTBhN2ViZTBmNTU=",
                "message": "I need help!",
                "createdAt": 1615246828077.0,
                "isDeleted": false
            },
            {
                "id": "Q2hhdDo2MDQ2YjVlY2U2ZGRkOTBhN2ViZTBmNTc=",
                "message": "{\"blocks\": [{\"key\": \"6so0p\", \"text\": \"Please input your question\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}], \"entityMap\": {}}",
                "createdAt": 1615246828110.0,
                "chatOptionInfos": [],
                "isDeleted": false
            }
        ],
        "state": "WAIT_USER_ANSWER_2"
    },
    "errors": null
}

Summary Analytics

GET https://backend.alli.ai/webapi/summary_analytics

Provides various summarized analytics information for your project.

Headers

Request Body

{
    "result": {
        "conversations": CONVERSATIONS,
        "conversationsUpDown": CONVERSTAIONS_UPDOWN,
        "participants": PARTICIPANTS,
        "participantsUpDown": PARTICIPANTS_UPDOWN,
        "uniqueParticipants": UNIQUE_PARTICIPANTS,
        "uniqueParticipantsUpDown": UNIQUE_PARTICIPANTS_UPDOWN,
        "queries": QUERIES,
        "queriesUpDown": QUERIES_UPDOWN,
        "queriedUsers": QUERIED_USERS,
        "queriedUsersUpDown": QUERIED_USERS_UPDOWN,
        "uniqueQueriedUsers": UNIQUE_QUERIED_USERS,
        "uniqueQueriedUsersUpDown": UNIQUE_QUERIED_USERS_UPDOWN,
        "instantResolution": INSTANT_RESOLUTION,
        "instantResolutionUpDown": INSTANT_RESOLUTION_UPDOWN,
        "aiResponseRate": AI_RESPONSE_RATE,
        "aiResponseRateUpDown": AI_RESPONSE_RATE_UPDOWN,
        "uniqueVisitors": UNIQUE_VISITORS,
        "uniqueVisitorsUpDown": UNIQUE_VISITORS_UPDOWN,
        "totalFaqs": TOTAL_FAQS,
        "totalFaqsUpDown": TOTAL_FAQS_UPDOWN,
        "totalDocuments": TOTAL_DOCUMENTS,
        "totalDocumentsUpDown": TOTAL_DOCUMENTS_UPDOWN,
        "feedbacksUpDown": FEEDBACKS_UPDOWN
    },
    "errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -X GET -d '{ "startDate": "2020-11-14",
"endDate": "2020-12-14"}' \
-H 'API-KEY: YOUR_API_KEY' \
https://backend.alli.ai/webapi/summary_analytics

Response Example

{
    "result": {
        "conversations": 45,
        "conversationsUpDown": -45.78,
        "participants": 44,
        "participantsUpDown": -32.31,
        "uniqueParticipants": 43,
        "uniqueParticipantsUpDown": -31.75,
        "queries": 39,
        "queriesUpDown": -56.18,
        "queriedUsers": 35,
        "queriedUsersUpDown": -46.97,
        "uniqueQueriedUsers": 35,
        "uniqueQueriedUsersUpDown": -44.44,
        "instantResolution": 1,
        "instantResolutionUpDown": 0.0,
        "aiResponseRate": 100.0,
        "aiResponseRateUpDown": 0.0,
        "uniqueVisitors": 2077,
        "uniqueVisitorsUpDown": -1.05,
        "totalFaqs": 0,
        "totalFaqsUpDown": 0.0,
        "totalDocuments": 0,
        "totalDocumentsUpDown": 0.0,
        "feedbacksUpDown": 0.0
    },
    "errors": null
}

Daily Conversation Count

GET https://backend.alli.ai/webapi/conversation_daily_count

The total number of conversations per day for a given range.

Headers

Request Body

{
    "result": {
        "dailyTotalCount": [
            {
                "date": "DATE",
                "activeCount": ACTIVE_COUNT
            }
        ],
        "state": "NORMAL",
        "campaignCount": 1
    },
    "errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -X GET -d '{ "startDate": "2020-11-19",
"endDate": "2020-11-24"}' \
-H 'API-KEY: YOUR_API_KEY' \
https://backend.alli.ai/webapi/conversation_daily_count

Response Example

{
    "result": {
        "dailyTotalCount": [
            {
                "date": "2020-11-19",
                "activeCount": 30
            },
            {
                "date": "2020-11-20",
                "activeCount": 49
            },
            {
                "date": "2020-11-21",
                "activeCount": 32
            },
            {
                "date": "2020-11-22",
                "activeCount": 2
            },
            {
                "date": "2020-11-23",
                "activeCount": 31
            },
            {
                "date": "2020-11-24",
                "activeCount": 16
            }
        ],
        "state": "NORMAL",
        "campaignCount": 1
    },
    "errors": null
}

Daily FAQ Count

GET https://backend.alli.ai/webapi/faq_daily_count

Daily trend of Q&A from FAQ in given date range.

Headers

Request Body

{
    "result": {
        "dailyTotalCount": [
            {
                "date": "DATE",
                "activeCount": ACTIVE_COUNT
            }
        ],
        "state": "NORMAL",
        "campaignCount": 1
    },
    "errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -X GET -d '{ "startDate": "2020-11-19",
"endDate": "2020-11-24"}' \
-H 'API-KEY: YOUR_API_KEY' \
https://backend.alli.ai/webapi/faq_daily_count

Response Example

{
    "result": {
        "dailyTotalCount": [
            {
                "date": "2020-11-19",
                "count": 24
            },
            {
                "date": "2020-11-20",
                "count": 70
            },
            {
                "date": "2020-11-21",
                "count": 23
            },
            {
                "date": "2020-11-22",
                "count": 45
            },
            {
                "date": "2020-11-23",
                "count": 34
            },
            {
                "date": "2020-11-24",
                "count": 30
            }
        ]
    },
    "errors": null
}

Daily FAQ Analytics

GET https://backend.alli.ai/webapi/faq_daily_analytics

Analytics information for the most frequently asked Q&As.

Headers

Request Body

{
    "result": {
        "faqDailyAnalytics": [
            {
                "totalCount": NUMBER,
                "totalShownCount": NUMBER,
                "selectedRatio": NUMBER,
                "faq": {
                    "id": "ID_1",
                    "question": "QUESTION_1"
                },
                "stats": [
                    {
                        "date": "DATE",
                        "selectedCount": NUMBER
                    }
                ]
            }
        ]
    },
    "errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -X GET -d '{ "startDate": "2020-12-02",
"endDate": "2020-12-05", "topN": 5}' \
-H 'API-KEY: YOUR_API_KEY' \
https://backend.alli.ai/webapi/faq_daily_analytics

Response Example

{
    "result": {
        "faqDailyAnalytics": [
            {
                "totalCount": 1,
                "totalShownCount": 1,
                "selectedRatio": 100.0,
                "faq": {
                    "id": "RkFROjVkZDQ4ZWFhN2E4ZGM2M2Y4OGNhZmUzOQ==",
                    "question": "What is Alli?"
                },
                "stats": [
                    {
                        "date": "2020-12-02",
                        "selectedCount": 0
                    },
                    {
                        "date": "2020-12-03",
                        "selectedCount": 0
                    },
                    {
                        "date": "2020-12-04",
                        "selectedCount": 1
                    },
                    {
                        "date": "2020-12-05",
                        "selectedCount": 0
                    }
                ]
            }
        ]
    },
    "errors": null
}

Executing a Skill

POST https://backend.alli.ai/webapi/skill

This API executes a skill and returns the final text answer as json format. Please follow the link under the 'Learn More about Variables' below for more information about the variables parameter. This API can be used for the entity extraction if the skill is designed for the entity extraction.

Headers

Request Body

{"result": "TEXT RESULT FROM SKILL", "errors": []}

Learn More about Variables

To learn more about the variables in Alli, please see this user guide.

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.

curl -d '{"id": "YOUR SKILL ID",
        "text": "issue date",
        "variables": {"YOUR_VARIABLE": "YOUR_VARIABLE_VALUE"}}' \
        -H 'API-KEY: YOUR_API_KEY' \
        -H 'Content-Type: application/json' https://backend.alli.ai/webapi/skill

Response Example

{"result": "TEXT RESULT FROM SKILL", "errors": []}

Last updated