Cognigy

Cognigy.AI Docs

COGNIGY.AI is the Conversational AI Platform focused on the needs of large enterprises to develop, deploy and run Conversational AI’s on any conversational channel.

Given the arising need of voice interfaces as the most natural way of communicating with brands, Cognigy was founded in 2016 by Sascha Poggemann and Phil Heltewig. Our mission: to enable all devices and applications to intelligently communicate with their users via naturally spoken or written dialogue.

Get Started

Channel Output

Description

Within a code node you have the ability to output a text message along with a data object by using the following actions functions:

actions.output("<YOUR_TEXT>", {"key": "value" });
// OR
actions.say("<YOUR_TEXT>", {"key": "value" });

The data parameter should take the JSON payload that defines the custom channel message:

const jsonPayload = {
 "_cognigy":{
  // Channel Specific Payload 
 }
}

actions.say("<YOUR_TEXT", jsonPayload);

See the next sections for the required format.

AI Default Channel

Cognigy's AI Default Channel has a specific channel format which you can find more about at AI Default Channel Format.

Alexa

:link: Alexa Response Json Reference

Example


We'll output a simple card to our contact by using the following snippet:

{
    "_cognigy": {
        "_alexa": {
            "response": {
        "shouldEndSession": false,
                "card":  {
                    "type": "Standard",
                    "title": "Title of the card",
                    "content": "Content of a simple card",
                    "text": "Text content for a standard card",
                    "image": {
                        "smallImageUrl": "https://url-to-small-card-image",
                        "largeImageUrl": "https://url-to-large-card-image"
                    }
                }
            }
        }
    }
}

Messenger

:link: Messenger Messaging Reference

For the messenger you can send send multiple templates by building a json object or by using the facebook-bot-messenger module. For further information got to their GitHub Page.

Example


The following snippet will send a simple text message and a quick reply to the contact:

{
    "_cognigy": {
        "_facebook": {      
          "message": {
            "text": "Hello World",
            "quick_replies": [
              {
                "content_type": "text",
                "condition": "",
                "title": "Hi",
                "image_url": "",
                "payload": "Hi"
              }
            ]
          }
        }
    }
}

Or you can use the facebook-bot-messenger module for building custom json. Here we'll send quck replies to the contact:

// use facebook-bot-messenger to compile reply
const builder = new MessengerPlatform.QuickRepliesMessageBuilder('Pick a color:');
builder.addImageOption('Red', 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_RED', 'http://petersfantastichats.com/img/red.png')
       .addImageOption('Green', 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_GREEN', 'http://petersfantastichats.com/img/green.png');

// output the reply
actions.output("test", { "_cognigy": { "_facebook": {"message": builder.buildMessage() }}});

Google Actions

:link: Google Actions Responses Reference

Example


Here we'll output some suggestion chips to the contact:

{
"_cognigy":{
"_google": {
    "conversationToken": "",
    "expectUserResponse": true,
    "expectedInputs": [
        {
            "inputPrompt": {
                "richInitialPrompt": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Howdy! I can tell you fun facts about almost any number like 0, 42, or 100. What number do you have in mind?",
                                "displayText": "Howdy! I can tell you fun facts about almost any number. What number do you have in mind?"
                            }
                        }
                    ],
                    "suggestions": [
                        {
                            "title": "0"
                        },
                        {
                            "title": "42"
                        },
                        {
                            "title": "100"
                        },
                        {
                            "title": "Never mind"
                        }
                    ]
                }
            },
            "possibleIntents": [
                {
                    "intent": "actions.intent.TEXT"
                }
            ]
        }
    ]
}
}
}

Webchat

The Webchat uses the same format as the Messenger but instead of adding the _facebook property you have to add _webchat.

Example


The following example sends a text message and a quick reply to the contact:

{
    "_cognigy": {
        "_webchat": {      
          "message": {
            "text": "Hello World",
            "quick_replies": [
              {
                "content_type": "text",
                "condition": "",
                "title": "Hi",
                "image_url": "",
                "payload": "Hi"
              }
            ]
          }
        }
    }
}

AI

The default AI Channel, which is always selected from the default, uses the almost same format as the webchat above. The only difference is that you type _default instead of _webchat.

Example


The following example sends a text message and a quick reply to the contact:

{
    "_cognigy": {
        "_default": {      
          "message": {
            "text": "Hello World",
            "quick_replies": [
              {
                "content_type": "text",
                "condition": "",
                "title": "Hi",
                "image_url": "",
                "payload": "Hi"
              }
            ]
          }
        }
    }
}

LINE

:link: LINE Messaging API

Example


The following outputs a simple confirm prompt to the contact:

{
    "_cognigy": {
        "_line": {
                "type": "template",
                "altText": "this is a confirm template",
                "template": {
                    "type": "confirm",
                    "text": "Are you sure?",
                    "actions": [
                        {
                            "type": "message",
                            "label": "Yes",
                            "text": "yes"
                        },
                        {
                            "type": "message",
                            "label": "No",
                            "text": "no"
                        }
                    ]
                }
        }
    }
}

Smooch

:link: Smooch messaging API

Example


The following outputs a simple image to the end user:

{
    "role": "appMaker",
    "type": "image",
    "text": "Hello!",
    "mediaUrl": "http://example.org/image.jpg",
    "actions": [{
        "text": "More info",
        "type": "link",
        "uri": "http://example.org"
    }]
}

RingCentral Engage

Example


The following outputs a gallery with images to the end user. This example is quite interesting since one needs to create an attachment for each image using the RingCentral Engage API. The returned attachmentIds are inserted in the Custom JSON below:

{
  "command": "structured-content",
  "body": "",
  "structuredContent": {
    "type": "carousel",
    "items": [
      {
        "attachment_id": "5f73470a0e69dc",
        "title": "This is the title",
        "url": "https://url-to-image.com",
        "subtitle": "This is the first subtitle",
        "items": [
          {
            "type": "url",
            "url": "https://www.cognigy.com/",
            "title": "Visit Website"
          },
          {
            "type": "reply",
            "payload": "I want to select this one",
            "title": "Select"
          }
        ]
      },
      "...": "..."
    ]
  }
}

Updated 5 months ago


What's Next

Analytics data

Channel Output


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.