NAV Navbar
C# JavaScript HTTP
  • Introduction
  • Concepts
  • Authentication
  • Getting Started
  • Content Types
  • Documents
  • Extensions
  • Integrations
  • Introduction

    Welcome to BLiP Docs😊!

    The main goal of BLiP Docs is to provide technical development knowledge on the BLiP platform and present various code samples. These are the minimum necessary concepts for who wants to explore all power of BLiP.

    Here, you will find code samples on the right side for each subject. The samples are presented in C#, JavaScript and as a generic HTTP request that you can use in your favorite programming language. In the left side menu, you will find a step-by-step guide for each big subject on BLiP.

    Essential information:

    This documentation is organized in sections. Each section go deep in a specific topic about BLiP.

    Helpfull links:

    If you need more information about BLiP take a look in one of the following links:

    Concepts

    BLiP allows conversational applications (here also called chatbots, intelligent contacts, smart contacts, or just bots) to be built only once and be made available through different messaging channels, such as Messenger, WhatsApp, SMS, Email, Skype, Workplace, BLiP Chat (BLiP's channel for web, Android and iOS), and others (click here to see all available channels).

    There are basically 3 differents ways to create a chatbot using BLiP.

    Integrations are external APIs connected to BLiP in order to reduce your work to use these applications. Some of BLiP's integrations include: Chatbase, RD Station and PagSeguro(click here to see all available integrations).

    Extensions are internal APIs that encapsulate common functionalities used in message applications. Some of BLiP's extensions include: broadcasting, scheduling, simple databases, chat history and many others (click here to see all available extensions).

    Every content sent or received by BLiP's APIs and any communication between chatbots and their clients use LIME protocol definitions. LIME Protocol (acronym for Lightweight Messaging Protocol) is an open source JSON based protocol for messaging, maintained by BLiP's team and inspired by the XMPP protocol. It aims to be simple but extensible, with little verbosity yet providing good readability. The envelopes are information containers defined by the protocol and can be messages, notifications or commands, sent in JSON format.

    Addressing

    All the envelopes (messages, notifications and commands) exchanged between bots and their customers in BLiP have from and to addresses.

    The address (also called as Node) is presented in the format name@domain/instance, where:

    See below samples of different addresses (or Node):

      //WhatsApp Node - where '551199991111' is the user identifier
      "551199991111@wa.gw.msging.net"
    
      //BLiP Chat Node - where '0mn.io' is the BLiP Chat domain identifier
      "df83582a-87b9-45b4-9e76-d4a4a743e2a6@0mn.io"
    
      //Messenger Node
      "213681763812763812@messenger.gw.msging.net"
    

    Usually, the interaction between a chatbot and a customer starts after the message, which has a from address, is received. In this case, it is only necessary to answer to this address - in an unchanged way, in order to guarantee the message's delivery.

    The addresses may have different life cycles depending on the channels, they can be scoped – valid in some conditions (as in Messenger, where the address is only valid for a specific originator) or persistent, always valid (in SMS and WhatsApp). The chatbots must take these characteristics in consideration to build the interactions. For more details, check the LIME protocol specification.

    Channels

    Channels are message nets connected to BLiP in which the chatbots are able to send and receive messages to these nets' customers. Each channel has an identifier used for addressing which is normally a FQDN. This identifier appears after the @ in the nodes address.

    Each channel (or messaging application) has a unique set of features. Besides unify all of these channels into a single API, BLiP also adapt automatically any content to these unique feature sets.

    This means that you can respond to a user with message like a menu without consideration for the features of that channel. If the user is on Facebook or any other channel that supports this content type, the message will appear to the user as a menu, but on a channel like Whatsapp the menu will fall back to a text messages. It's also possible to customize this behaviour as you desire.

    In order to send or receive messages to a channel, the chatbot must be published on it. The publishing is done through the portal, which may request specific information that helps to identify the chatbot in this channel, such as API tokens for example. Usually, previous registration is necessary in each channel, through a specific tool, before publishing.

    The following channels are available in BLiP platform:

    Name FQDN
    BLiP Chat 0mn.io
    Tangram (SMS) tangram.com.br (deprecated)
    Take.IO (SMS) take.io
    Facebook Messenger messenger.gw.msging.net
    WhatsApp wa.gw.msging.net
    Google Business Messages businessmessages.gw.msging.net
    Skype skype.gw.msging.net
    Telegram telegram.gw.msging.net
    Workplace workplace.gw.msging.net
    Email mailgun.gw.msging.net
    PagSeguro pagseguro.gw.msging.net

    For more information about any channel, check the Integrations section.

    Messages

    See below the representation of a message:

      var message = new Message
      {
          Id = "65603604-fe19-479c-c885-3195b196fe8e",
          From = "551199991111@0mn.io/182310923192",
          To = "mycontact@msging.net",
          Content = new PlainText
          {
              Text = "Hello World"
          }
      };
    
    var message = {
      id: "65603604-fe19-479c-c885-3195b196fe8e",
      from: "551199991111@0mn.io/182310923192",
      to: "mycontact@msging.net",
      type: "text/plain",
      content: "Hello World"
    }
    
    {
      "id": "65603604-fe19-479c-c885-3195b196fe8e",
      "from": "551199991111@0mn.io/182310923192",
      "to": "mycontact@msging.net",
      "type": "text/plain",
      "content": "Hello World"
    }
    

    A message allows content exchange between clients and chatbots.

    Each message has:

    For more information, check the LIME protocol specification.

    Sending messages

    In order to send messages and notifications use an instance of `ISender` (on C#), which is automatically injected on constructors of registered `receivers` defined on project and on the `Startup` class.

    //reply a received message sample
    public class PlainTextMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public PlainTextMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            // Write the received message to the console
            Console.WriteLine(message.Content.ToString());
            // Responds to the received message
            _sender.SendMessageAsync("Hi. I just received your message!", message.From, cancellationToken);
        }
    
    }
    

    It's possible send notifications and messages only after sessions has been stablished.

    //send a message after connection has been stablished sample
    client.connect()
        .then(function(session) {
            // After connection is possible send messages
            var msg = { type: 'text/plain', content: 'Hello, world', to: '553199990000@0mn.io' };
            client.sendMessage(msg);
        });
    

    For this sample bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ is a valid Key. You must to change this key

    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Length: 131
    
    {
        "id": "123e4567-e89b-12d3-a456-426655440000",
        "to": "551100001111@0mn.io",
        "type": "text/plain",
        "content": "Hello, how can I help you?"
    }
    

    The process of sending message is asynchronous and the status of sent messages is delivered to application by notifications.

    For more information about messages, check the messages section or the supported content types specification.

    Name Description
    id Unique identifier of the message
    from Originator’s address
    to Recipient’s address
    type Statement with content type, in the MIME format
    content Message content

    Receiving messages

    The receipt of messages is done using the interface IMessageReceiver.

    //A `IMessageReceiver` can be defined as follows
    public class PlainTextMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public PlainTextMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            // Write the received message to the console
            Console.WriteLine(message.Content.ToString());
        }
    
    }
    

    All messages sent to the chatbot are redirected to registered receivers of messages. You also can define filters to each receiver.

    //add simple message receiver example
    client.addMessageReceiver(true, (message) => {
      // Process received message
    
    });
    
    //Example of message receiver with filter of originator
    client.addMessageReceiver((message) => { message.from === "553199990000@0mn.io" },
    (message) => {
      // Process received message
    });
    
    //Each registration of receivers return a `handler` that can be used to cancell the registration:
    var removeJsonReceiver = client.addMessageReceiver("application/json", handleJson);
    // ...
    removeJsonReceiver();
    

    All messages will be delivered as a HTTP POST request on configured chatbot messages URL. A sample of received message is presented below.

    POST https://your.endpoint/messages HTTP/1.1
    Content-Type: application/json
    
    {
      "id": "99cf454e-f25d-4ebd-831f-e48a1c612cd4",
      "from": "551100001111@0mn.io/4ac58r6e3",
      "to": "blipmessaginghubapp@msging.net",
      "type": "text/plain",
      "content": "Help"
    }
    

    The process of receiving messages is asynchronous. The received messages will be on the format defined on LIME Protocol.

    Notifications

    See below the representation of a received notification from the destination:

    var notification = new Notification
    {
        Id = "65603604-fe19-479c-c885-3195b196fe8e",
        From = "551199991111@0mn.io/182310923192",
        To = "mycontact@msging.net",
        Event = Event.Received
    };
    
    var notification = {
      id: "65603604-fe19-479c-c885-3195b196fe8e",
      from: "551199991111@0mn.io/182310923192",
      to: "mycontact@msging.net",
      event: "received"
    }
    
    POST https://your.endpoint/notifications HTTP/1.1
    Content-Type: application/json
    
    {
      "id": "65603604-fe19-479c-c885-3195b196fe8e",
      "from": "551199991111@0mn.io/182310923192",
      "to": "mycontact@msging.net",
      "event": "received"
    }
    

    And a notification of a server failure:

    var notification = new Notification
    {
        Id = "65603604-fe19-479c-c885-3195b196fe8e",
        From = "551199991111@0mn.io/182310923192",
        To = "mycontact@msging.net",
        Event = Event.Failed,
        Reason = new Reason
        {
            Code = 42,
            Description = "Destination not found"
        }
    };
    
    var notification = {
      id: "65603604-fe19-479c-c885-3195b196fe8e",
      from: "postmaster@msging.net/server1",
      to: "mycontact@msging.net",
      event: "failed",
      reason: {
        code: 42,
        description: "Destination not found"
      }
    }
    
    POST https://your.endpoint/notifications HTTP/1.1
    Content-Type: application/json
    
    {
      "id": "65603604-fe19-479c-c885-3195b196fe8e",
      "from": "postmaster@msging.net/server1",
      "to": "mycontact@msging.net",
      "event": "failed",
      "reason": {
        "code": 42,
        "description": "Destination not found"
      }
    }
    
    
    

    A notification provides information about a sent message.

    Each notification has:

    For more details, check the LIME protocol specification.

    Sending notifications

    We send a notification using a client object with method sendNotification

    client.connect()
        .then((session) => {
            // Sending "received" notification
            var notification = {
                id: 'ef16284d-09b2-4d91-8220-74008f3a5788',
                to: '553199990000@0mn.io',
                event: Lime.NotificationEvent.RECEIVED
            };
            client.sendNotification(notification);
        });
    
    // Using await keyword
    let session = await client.connect();
    let notification = {
        id: 'ef16284d-09b2-4d91-8220-74008f3a5788',
        to: '553199990000@0mn.io',
        event: Lime.NotificationEvent.RECEIVED
    };
    
    client.sendNotification(notification);
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public PlainTextMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
             var notification = new Notification
                {
                    Id = message.Id,
                    To = message.From,
                    Event = Event.Consumed
                };
    
            await _sender.SendNotificationAsync(notification, cancellationToken);
        }
    }
    

    For instance, imagine that the received a message from example above (whit id 99cf454e-f25d-4ebd-831f-e48a1c612cd4

    POST https://http.msging.net/notifications HTTP/1.1
    Content-Type: application/json
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Length: 131
    
    {
        "id": "99cf454e-f25d-4ebd-831f-e48a1c612cd4",
        "from": "551100001111@0mn.io/4ac58r6e3",
        "event": "consumed"
    }
    

    In order to correctly show the message history, it is important that the chatbots send notifications of messages processed to originator clients.

    For each message processed, a notification must be sent with the consumed event. In case of problems, the chatbot must send a notification with the failed event.

    REQUEST

    Name Description
    id Identifier of the related message
    from Notification originator’s address
    to Notification recipient’s address
    event Event related to the message
    reason In case of failed events, represents the reason of the message failure

    Receiving notifications

    The next sample shows how to add a notification receiver with filter to the `received` event type:

    client.addNotificationReceiver("received", function(notification) {
      // Process received notifications
    });
    
    // Using expression lambda
    client.addNotificationReceiver(() => true, function(message) {
      // Process received notifications
    });
    

    The receipt of notifications is done using the interface INotificationReceiver.

    public class ConsumedNotificationReceiver : INotificationReceiver
    {
        public async Task ReceiveAsync(Notification notification, CancellationToken cancellationToken)
        {
            // Write the received notification to the console
            Console.WriteLine(notification.ToString());
        }
    }
    

    All notifications will be delivered as a HTTP POST request on the configured URL for chatbot notifications.

    POST https://your.endpoint/notifications HTTP/1.1
    Content-Type: application/json
    
    {
      "id": "123e4567-e89b-12d3-a456-426655440000",
      "from": "551100001111@0mn.io/4ac58r6e3",
      "to": "blipmessaginghubapp@msging.net/7a8fr233x",
      "event": "received"
    }
    

    Each notification contains the status of messages. Observe that the notifications are sent by the clients, informing if they received some message or not.

    Commands

    See below the representation of a command for the distribution list creation.

    var command = new Command()
    {
        Id = EnvelopeId.NewId(),
        To = "postmaster@broadcast.msging.net",
        Method = CommandMethod.Set,
        Uri = new LimeUri("/lists"),
        Resource = new JsonDocument(DistributionList.MediaType)
        {
            {"identity", "list@broadcast.msging.net"}
        }
    };
    
    var command = {
      id:  "1",
      to: "postmaster@broadcast.msging.net",
      method: "set",
      uri: "/lists",
      type: "application/vnd.iris.distribution-list+json",
      resource: {
        identity:  "list@broadcast.msging.net"
      }
    } 
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Length: 131
    
    {
      "id":  "1",
      "to": "postmaster@broadcast.msging.net",
      "method": "set",
      "uri": "/lists",
      "type": "application/vnd.iris.distribution-list+json",
      "resource": {
        "identity":  "list@broadcast.msging.net"
      }
    } 
    

    Reponse in the case of a successful answer:

    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "id": "1",
      "from": "postmaster@broadcast.msging.net/#hmgirismsging2",
      "to": "my-contact@msging.net/default",
      "method": "set",
      "status": "success"
    } 
    

    In the case of a failure:

    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "id": "1",
      "from": "postmaster@broadcast.msging.net/#hmgirismsging2",
      "to": "my-contact@msging.net/default",
      "method": "set",
      "status": "failure",
      "reason": {
       "code": 60,
       "description": "Invalid list identifier"
      }
    } 
    

    A command allows querying and manipulation of server resources and the consumption of BLiP extensions. It provides a request-response interface similar to HTTP, with verbs and URIs.

    Each command has:

    Note: Some extensions cannot accept all of the available methods.

    Besides the properties previously mentioned, a response command may have:

    For more details, check the LIME protocol specification.

    Sending commands

    ISender interface also enables send commands to the server, as the following sample:

    // For this case, the command response is received on a synchronous way.
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public PlainTextMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            var command = new Command {
                Id = 1,
                Method = CommandMethod.Get,
                Uri = new LimeUri("/account")
            };
    
            var response = await _sender.ProcessCommandAsync(command, cancellationToken);
        }
    }
    
    var pingCommand = {
        id: Lime.Guid(),
        uri: '/ping',
        method: 'get'
    };
    
    messagingHubClient
        .sendCommand(pingCommand)
        .then(function (commandResponse) {
            utils.logLimeCommand(pingCommand, 'Ping sent');
            utils.logLimeCommand(commandResponse, 'Ping response');
        })
        .catch(function (err) {
            utils.logMessage('An error occurred: ' + err);
        });
    
    
    
    POST https://http.msging.net/commands HTTP/1.1
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Type: application/json
    Content-Length: 393
    
    {  
        "id":"2",
        "to":"postmaster@scheduler.msging.net",
        "method":"set",
        "uri":"/schedules",
        "type":"application/vnd.iris.schedule+json",
        "resource":{  
        "message":{  
            "id":"ad19adf8-f5ec-4fff-8aeb-2e7ebe9f7a67",
            "to":"553100001111@0mn.io",
            "type":"text/plain",
            "content":"Scheduled Message"
        },
        "when":"2016-07-25T17:50:00.000Z"
        }
    }
    

    In order to use the BLiP's extensions (like schedule and directory), it is necessary to send commands.

    REQUEST

    Name Description
    id Unique command identifier
    from Command originator address
    to Command recipient address
    uri The path at the recipient the command refers to
    method Method for resource manipulation defined at the uri. This value is mandatory
    type Declaration of the resource value type, in the MIME format
    resource JSON resource representation
    status Indicates the command processing result, it is mandatory in the answers
    reason Indicates the command processing failure reason

    Obs: The uri value is mandatory in the requests and can be omitted in the responses. A response command may have status and reason properties.

    Result codes for requests

    Code Description
    202 (Accepted) Envelope was accepted by the server
    400 (Bad Request) Alert to some problem with the format or fields of sent envelope.
    401 (Unauthorized) Alert to some problem or Authorization header missing

    Throughputs

    There are a maximum number of messages, notifications and commands you can send asynchronously, according to your plan.

    Description Free Business Enterprise
    Message throughput (per second) 3 250 500
    Notification throughput (per second) 6 500 1000
    Command throughput (per second) 48 1000 2000

    Authentication

    If you need to build your chatbot using one of the SDKs or using HTTP or if you need to access any BLiP internal API (for extensions and integrations) you must to be authenticated. This section explain how to authenticate your chatbot in order to use BLiP.

    SDKs

    On both C# and Javascript, you will need an identifier and an access key to be able to connect to the BLiP. To get them:

    imagem

    HTTP

    On HTTP, whatever request made (messages/notifications/commands) must contain an authorization header (Authorization) with a Key type, as showed on BLiP Portal chatbot configurations.

    imagem

    Auth Samples

    Imagine a chatbot with an Authorization 'Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ='. To send a message from this bot to a BLiP user, use:

    Note: For this sample, bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ is a valid Key.
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Length: 131
    
    {
        "id": "123e4567-e89b-12d3-a456-426655440000",
        "to": "551100001111@0mn.io",
        "type": "text/plain",
        "content": "Hello, how can I help you?"
    }
    

    With C#, the authentication of your chatbot is made on application.json file. Basically, this file defines all receivers and other control properties.

    //Check an example of how to set your application.json file:
    {
      "identifier": "xpto",
      "accessKey": "cXkzT1Rp",
      "messageReceivers": [
        {
          "type": "PlainTextMessageReceiver",
          "mediaType": "text/plain"
        }
      ]
    }
    

    In order to instantiate the client, use ClientBuilder class informing the identifier and access key:

    
    // Create a client instance passing the identifier and accessKey of your chatbot 
    var client = new ClientBuilder()
        .withIdentifier(identifier)
        .withAccessKey(accessKey)
        .withTransportFactory(() => new WebSocketTransport())
        .build();
    
    // Register a receiver for messages of 'text/plain' type
    client.addMessageReceiver('text/plain', function(message) {
      // TODO: Proccess the received message
    });
    
    // Register a receiver to any notification
    client.addNotificationReceiver(true, function(notification) {
      // TODO: Proccess the received notification
    });
    
    // Connect with server asynchronously
    // Connection will occurr via websocket on 8081 port.
    client.connect() // This method return a 'promise'.
        .then(function(session) { 
            // Connection success. Now is possible send and receive envelopes from server. */ 
            })  
        .catch(function(err) { /* Connection failed. */ }); 
    
    

    Getting Started

    Even if you are completely new to BLiP Platform, getting started section is quick and easy! Start building your first bot just following these steps. If you have any problem or don't understand any step please use Forum to report.

    Before start your bot you must choice wich chatbot type do you need. There are 4 different type:

    Using Builder

    Builder is one of the BLiP portal components. It was designed to make the create chatbot process more quick, simple, visual and without code. Through Builder is possible define all conversational flow and contents integrated with any other platform resource.

    Even though be a visual component you can use Builder to create any type of bots, from really simple until very complex cases.

    imagem

    For more informations about how to create a bot using Builder component click here.

    Using SDK CSharp

    Besides Builder is possible to create a bot using only code. BLiP C# SDK is a set of Nuget packages based on .NET Core, which allows the creation of multiplatform chatbots. You can check the SDK source code in Github and the documentation on our Wiki

    Requirements

    Before start

    The easiest way to get started is using one of our dotnet templates.

    To install the templates, run the execute command in the shell:

    dotnet new -i "Take.Blip.Client.Templates::*"
    

    After installing the templates, just create a directory for your chatbot and create a new project using a template:

    mkdir MyBot
    cd MyBot
    dotnet new blip-console
    

    There are available the following templates:

    1. Starting your bot

    After installed and created the project template, open the MyBot.csproj file and build the project. Note that all the necessary files for your bot are already created.

    You will need an identifier and an access key to be able to connect to the BLiP. To get them:

    imagem

    Your application.json file must looks like:

    {
      "identifier": "your-identifier",
      "accessKey": "your-access-key",
    
      // other stuffs
    }
    

    Starting application...
    Application started. Press any key to stop.

    2. Receiving a message

    The configuration of your chatbot is made on application.json file. Basically this file define all receivers and others control properties.

    Check an example of how to minimally set your application.json file:

    {
      "identifier": "xpto",
      "accessKey": "cXkzT1Rp",
      "messageReceivers": [
        {
          "type": "PlainTextMessageReceiver",
          "mediaType": "text/plain"
        }
      ]
    }
    

    Through of application.json file the developer can realize a tranparent run of the application. All the other tasks are managed by the .NET Core template package installed before.

    Looking for the right side sample the client was configured to use a chatbot with xpto identifier with cXkzT1Rp accessKey. Besides that was registered a MessageReceiver with name PlainTextMessageReceiver and a filter for messages with text/plain media type. It means that the PlainTextMessageReceiver class you be called when a text/plain message is received by your bot. If you want to be able to receive other messages content types you must add more receivers in application.json file. To see any other advanced settings about application.json click here.

    The receipt of messages is done using the interaces IMessageReceiver.

    A IMessageReceiver can be defined as follow:

    public class PlainTextMessageReceiver : IMessageReceiver
    {
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            // Write the received message to the console
            Console.WriteLine(message.Content.ToString());
        }
    }
    

    Optional

    Optionally is also possible handle Notifications. The proccess is very similar to receiving message. The notifcations are fire-and-forget and if occur some exception on ReceiveAsync, this fail will be ignored.

    Create a class that implements INotificationReceiver and remember to add its name into application.json file. For more informations click here.

    An INotificationReceiver can be defined as follow:

    public class ConsumedNotificationReceiver : INotificationReceiver
    {
        public async Task ReceiveAsync(Notification notification, CancellationToken cancellationToken)
        {
            // Write the received notification to the console
            Console.WriteLine(notification.ToString());
        }
    }
    

    An application.json file sample using a NotificationReceiver

    {
      "identifier": "xpto",
      "accessKey": "cXkzT1Rp",
      "messageReceivers": [
        {
          "type": "PlainTextMessageReceiver",
          "mediaType": "text/plain"
        }
      ],
      "notificationReceivers": [
        {
          "type": "ConsumedNotificationReceiver",
        }
      ]
    }
    

    3. Sending a message

    In order to send messages and notifications use an instance of ISender, wich is automaticaly injected on constructors of registered receivers defined on project and on Startup class.

    The sample below show how to reply a received message with a text:

    public class PlainTextMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
    
        public PlainTextMessageReceiver(IMessagingHubSender sender)
        {
            _sender = sender;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            // Write the received message to the console
            Console.WriteLine(message.Content.ToString());
            // Responds to the received message
            _sender.SendMessageAsync("Hi. I just received your message!", message.From, cancellationToken);
        }
    }
    

    The process of send message is asynchronous and the status of sent messages is delivered to application by notifications. If you need to send any other message content type click here

    4. Sending a command

    A command allows querying and manipulation of server resources and the consumption of BLiP extensions and integrations. To see more details about what are the commands click here.

    There are two possibilities to send commands. Using the method SendCommand of ISender interface or using one of the available IExtension extensions.

    One of the most common extension is Event Analysis that allows to register chatbot's events to create analytics reports in portal.

    Let see some samples of how to send commands:

    Using IExtension interface

    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Receivers;
    using Take.Blip.Client.Extensions.EventTracker;
    
    namespace Extensions
    {
        public class PlainTextMessageReceiver : IMessageReceiver
        {
            private readonly IEventTrackExtension _eventTrackExtension;
    
            public PlainTextMessageReceiver(IEventTrackExtension eventTrackExtension)
            {
                _eventTrackExtension = eventTrackExtension;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                await _eventTrackExtension.AddAsync("payments", "success-order");
            }
        }
    }
    

    Using ISender interface

    // For this case, the command response is received on a synchronous way.
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public PlainTextMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            var command = new Command {
                Id = 1,
                Method = CommandMethod.Set,
                Uri = new LimeUri("/event-track"),
                Resource = new EventTrack
                {
                    Category = "payments",
                    Action = "success-order",
                }
            };
    
            var response = await _sender.ProcessCommandAsync(command, cancellationToken);
        }
    }
    

    Go to Extensions or Integrations sections to see all commands available to be used.

    5. Samples using CSharp

    Click here to see same bots sample created using SDK C#.

    Using SDK Javascript

    If you are a Javascript developer and want to create a chatbot with BLiP, you must use the BLiP Javascript SDK. It was developed to help sending and receiving of BLiP messages using Javascript for browsers or node.js through persistent WebSocket connections.

    Go to Github to see the source code and the full documentation.

    Requirements

    Before start

    Create a empty Node.js project

    mkdir MyBot
    cd MyBot
    npm init
    

    Install blip-sdk package (via npm) as a dependecy of your project in order to access the BLiP server.

    npm install --save blip-sdk lime-transport-websocket
    

    1. Starting the bot (js)

    You will need an identifier and an access key to be able to connect to the BLiP. To get them:

    imagem

    Create a index.js file add the code below and replace the variables IDENTIFIER and ACCESS_KEY with informations of your bot.

    import * as BlipSdk from 'blip-sdk';
    import * as WebSocketTransport from 'lime-transport-websocket'
    
    // Put your identifier and access key here
    let IDENTIFIER = '';
    let ACCESS_KEY = '';
    
    // Create a client instance passing the identifier and accessKey of your chatbot
    let client = new BlipSdk.ClientBuilder()
        .withIdentifier(IDENTIFIER)
        .withAccessKey(ACCESS_KEY)
        .withTransportFactory(() => new WebSocketTransport())
        .build();
    
    // Connect with server asynchronously
    // Connection will occurr via websocket on 8081 port.
    client.connect() // This method return a 'promise'.
        .then(function(session) {
            // Connection success. Now is possible send and receive envelopes from server. */
            console.log('Application started. Press Ctrl + c to stop.')
        })
        .catch(function(err) { /* Connection failed. */ });
    

    Application started. Press Ctrl + c to stop.

    2. Receiving a message (js)

    In order to receive and handle messages you need to use addMessageReceiver method in client object. All messages sent to the chatbot are redirected to defined messages (or notifications) receivers. You also can define filters to each receiver.

    The following example show how to add a simple message receiver:

    client.addMessageReceiver(true, function(message) {
      // Process received message
    });
    

    It's also possible use a custom function as receiver filter. The sample above shows a message receiver with filter of originator:

    client.addMessageReceiver(function(message) { message.from === "553199990000@0mn.io" }, function(message) {
      // Process received message
    });
    

    Each registration of receivers return a handler that can be used to cancel the registration:

    var removeJsonReceiver = client.addMessageReceiver("application/json", handleJson);
    // ...
    removeJsonReceiver();
    

    Optional

    Optionally is also possible handle notifications adding a notification receiver. The proccess is very similar to receiving message. The notifcations are fire-and-forget and if occur some exception on receiver, this fail will be ignored.

    The next sample show how to add notification receiver with filter to received event type:

    client.addNotificationReceiver("received", function(notification) {
      // Process received notifications
    });
    

    Adding notification receiver with a filter using lambda expression

    // Using lambda expression
    client.addNotificationReceiver(() => true, function(notification) {
      // Process received notifications
    });
    

    3. Sending a message (js)

    In order to send messages and notifications use the sendMessage (or sendNotification) method in client object.

    The following sample show how to send a message after connection has been stablished:

    client.connect()
        .then(function(session) {
            // After connection is possible send messages
            var msg = {
                type: "text/plain",
                content: "Hello, world",
                to: "553199990000@0mn.io"
            };
            client.sendMessage(msg);
        });
    

    The following sample show how to send a notification after connection has been stablished:

    client.connect()
        .then(function(session) {
            // Sending "received" notification
            var notification = {
                id: "ef16284d-09b2-4d91-8220-74008f3a5788",
                to: "553199990000@0mn.io",
                event: Lime.NotificationEvent.RECEIVED
            };
            client.sendNotification(notification);
        });
    

    The process of send message is asynchronous and the status of sent messages is delivered to application by notifications. If you need to send any other message content type click here

    4. Sending a command (js)

    A command allows querying and manipulation of server resources and the consumption of BLiP extensions and integrations. To see more details about what are the commands click here.

    Using sendCommand method

    
    let resource = { category: 'payments', action: 'success-order' };
    
    client.sendCommand({
        id: Lime.Guid(),
        method: Lime.CommandMethod.SET,
        type: 'application/vnd.iris.eventTrack+json',
        uri: '/event-track',
        resource: resource
    })
    

    One of the most common extension is Event Analysis that allows to register chatbot's events to create analytics reports in portal.

    Let see some samples of how to send commands:

    Go to Extensions or Integrations sections to see all commands available to be used.

    5. Samples using Javascript

    Click here to see same bots sample created using SDK Javascript.

    Using HTTP

    Webhook enables an integration between your bot and BLiP via HTTP endpoints to exchange messages, notifications and commands. If you are not able to create your chatbot using C# or Javascript languages you must use BLiP's HTTP API agnostic for any language.

    The diagram below shows the messages flow between BLiP and your endpoint (API).

    Requirements

    Before start

    Get the Authorization token of your bot to be able to connect to the BLiP. To get them:

    imagem

    1. Receiving messages

    Any message will be delivered as a HTTP POST request on the configured chatbot's message URL. These messages have a JSON format as defined on Content Types section. A sample of a received text message is presented below.

    {
      "id": "99cf454e-f25d-4ebd-831f-e48a1c612cd4",
      "from": "551100001111@0mn.io/4ac58r6e3",
      "to": "blipmessaginghubapp@msging.net",
      "type": "text/plain",
      "content": "Help"
    }
    

    2. Sending messages

    To send messages, it is necessary to make a HTTP POST request to BLiP using the URL https://http.msging.net/messages. The request must contain an authorization header (Authorization) with Key type, as showed on chatbot settings. To know more about BLiP authentication process click here.

    The message data must be sent on the request body as a JSON following the LIME protocol format. For more details go to Content Types section.

    Imagine a chatbot with an Authorization token Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=. To send a message from this bot to a BLiP user, use:

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Length: 131
    
    {
      "id": "123e4567-e89b-12d3-a456-426655440000",
      "to": "551100001111@0mn.io",
      "type": "text/plain",
      "content": "Hello, how can I help you?"
    }
    

    For more information about messages, check the Messages documentation page or the supported content types specification.

    3. Receiving notification

    All notifications will be delivered on the configured chatbot's notification URL. Each notification contains the status of messages. Observe that notifications are sent by clients, informing if received or not some message.

    A sample of notification is presented below. This notification will be deliverd as a HTTP POST request on the chatbot notification URL.

    {
      "id": "123e4567-e89b-12d3-a456-426655440000",
      "from": "551100001111@0mn.io/4ac58r6e3",
      "to": "blipmessaginghubapp@msging.net/7a8fr233x",
      "event": "received"
    }
    

    For more information, check the Notification documentation page

    4. Sending notifications

    In order to correctly show the message history, it is important that the chatbots send notifications of messages processed to originator clients.

    For each message processed, it is important to send a notification with the consumed event. In case of problems, the chatbot must send a notification with the failed event. The request must use the URL https://http.msging.net/notifications and contain an authorization header (Authorization) with Key type, as showed on chatbot settings.

    For instance, imagine that the received message from the example above (whit id 99cf454e-f25d-4ebd-831f-e48a1c612cd4) was processed with success. The code below shows a complete notification request including the headers and the body request.

    POST https://http.msging.net/notifications HTTP/1.1
    Content-Type: application/json
    Authorization: Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=
    Content-Length: 131
    
    {
      "id": "99cf454e-f25d-4ebd-831f-e48a1c612cd4",
      "from": "551100001111@0mn.io/4ac58r6e3",
      "event": "consumed"
    }
    

    5. Sending commands

    In order to use BLiP's extensions (like schedule and directory), it is necessary to send commands. To do that, a HTTP POST request on /commands URL must be made.

    For instance, send a command to schedule some message:

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "1",
      "to": "postmaster@scheduler.msging.net",
      "method": "set",
      "uri": "/schedules",
      "type": "application/vnd.iris.schedule+json",
      "resource": {  
        "message": {  
          "id": "ad19adf8-f5ec-4fff-8aeb-2e7ebe9f7a67",
          "to": "destination@0mn.io",
          "type": "text/plain",
          "content": "Scheduling test."
        },
        "when": "2016-07-25T17:50:00.000Z",
        "name": "New Schedule"
      }
    }
    

    The command response is immediately delivered on HTTP response, as below:

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "method": "set",
      "status": "success",
      "id": "1",
      "from": "postmaster@scheduler.msging.net/#az-iris4",
      "to": "destination@0mn.io",
      "metadata": {
        "#command.uri": "lime://destination@0mn.io/schedules"
      }
    }
    

    Aditional informations

    Code Description
    202 (Accepted) Envelope was accepted by the server
    400 (Bad Request) Alert to some problem with format or fields of sent envelope.
    401 (Unauthorized) Alert to some problem or Authorization header missing
    Name Description
    Url to receive messages Endpoint where BLiP will post the messages
    Url to receive notification Endpoint where BLiP will post the notifications

    Postman Collection

    Postman is a popular tool to help test APIs. To make it more convenient for developers who are integrating with the BLiP APIs, we've developed a Postman collection that contains the full set of APIs.

    Setup

    To get started, download and install Postman.

    After installed click on the Run in Postman button download and import the collection into your app.

    Run in Postman

    Configure

    Postman offers a configurable variable map which is essentially a set of key-value pairs. It allows you to create commonly used variables that can be reference across multiple requests. You can read more about it here. Before to start using BLiP's Postman Collection you need to add the Authorization variable.

    imagem

    imagem

    Testing

    In order to test the collection access the Resource folder click in Store a resource request and than click in Send button. This request add a sample resource in your bot. Go to BLiP portal access Resources module and check the content.

    imagem

    Content Types

    If you want to see all content-types working, clone our SDK sample project:
    github.com/takenet/blip-sdk-csharp/tree/master/src/Samples/MessageTypes
    

    BLiP uses message content types defined by LIME protocol and performs the conversion of these types to the most adequate format for each destination channel. For more details, check the LIME protocol content types specification.

    Besides that, it's possible to send native contents to some channels - like Messenger -, which allows the usage of the channel capabilities without restrictions. See more details on Native contents item on the left menu.

    Metadata

    Messages received from some channels may have unique metadata information coming from the channel. This information is included in the metadata property of the BLiP messages.

    An example of a message received from Messenger:

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    {
      "id": "9dc08447-8b23-4bc2-8673-664dca202ee2",
      "from": "128271320123982@messenger.gw.msging.net",
      "to": "mybot@msging.net",
      "type": "text/plain",
      "content": "Hello",
      "metadata": {
          "messenger.mdi": "mid.$cAAAu_n30PEFiJQdYSlb8785KMO5E",
          "messenger.seq": "19062"
      }
    }
    

    The properties messenger.mdi and messenger.seq are specific to Messenger, but they are delivered together with incoming messages. In Messenger specifically, several different metadata properties can be delivered, one of the most important being the messenger.ref, which is the referral generated when a client clicks on a m.me/bot-name?ref=value link from your chatbot or when it scans a code for the bot.

    HTTP/1.1 200 OK
    Content-Type: application/json
    {
      "id": "2dc05467-4b23-1bc2-8673-664dca202ee2",
      "from": "128271320123982@messenger.gw.msging.net",
      "to": "mybot@msging.net",
      "type": "text/plain",
      "content": "Get started",
      "metadata": {
          "messenger.ref": "website",
          "messenger.source": "SHORTLINK",
          "messenger.type": "OPEN_THREAD"
      }
    }
    

    Chat state

    Sending status typing to bot user:

    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace MessageTypes
    {
    public class OptionChatStateMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionChatStateMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var chatState = new ChatState
        {
            State = ChatStateEvent.Composing
        };
        await _sender.SendMessageAsync(chatState, message.From, cancellationToken);
    }
    
    }
    }
    
    client.sendMessage({
            id: Lime.Guid(),
            to:"104222@telegram.gw.msging.net",
            type:"application/vnd.lime.chatstate+json",
            content: {
                "state": "composing"
            }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "to":"104222@telegram.gw.msging.net",
        "type":"application/vnd.lime.chatstate+json",
        "content": {
            "state": "composing"
        }
    }
    
    MIME type
    application/vnd.lime.chatstate+json

    Allows sending and receiving information about the conversation's current status. Possible status are:

    State Description
    starting Initiating new conversation
    composing Typing/preparing a message
    paused New message typing interrupted, message not sent
    deleting Deleting message (which was being prepared)
    gone Exit/Conversation finished

    In general, there is no need to receive delivery notifications messages with this content, thus it is recommended to omit the Id in these messages. For more details, check the LIME protocol specification.

    Channel mapping

    Channel Type Supported states
    BLiP Chat Chat State All
    Messenger Sender Actions and Referral composing and paused (sending only) and starting (referral of an existing thread)
    Whatsapp - None
    SMS - None
    Skype - None
    Telegram SendChatAction composing (sending only)

    Collection

    A text Collection

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class OptionDocumentCollectionMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionDocumentCollectionMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    PlainText[] documents = new PlainText[]
    {
        new PlainText
        {
            Text = "Text 1"
        },
        new PlainText
        {
            Text = "Text 2"
        },
        new PlainText
        {
            Text = "Text 3"
        }
    };
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new DocumentCollection
        {
            ItemType = "text/plain",
            Items = documents
        };
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
        client.sendMessage({
            id: Lime.Guid(),
            type: "application/vnd.lime.collection+json",
            to: "128271320123982@messenger.gw.msging.net",
            content: {
                itemType: "text/plain",
                items: [
                    "Text 1",
                    "Text 2",
                    "Text 3"
                ]
            }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "to": "553199990000@0mn.io",
        "type": "application/vnd.lime.collection+json",
        "content": {
            "itemType": "text/plain",
            "items": [
                "Text 1",
                "Text 2",
                "Text 3"
            ]
        }
    }
    

    A different type of collection, using container

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class CollectionWithDiferentTypes : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public CollectionWithDiferentTypes(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    DocumentContainer[] documents = new DocumentContainer[]
    {
        new DocumentContainer{
            Value = new MediaLink
            {
                Uri = new Uri("http://www.petshoplovers.com/wp-content/uploads/2014/03/CUIDADOS-B%C3%81SICOS-PARA-CRIAR-COELHOS.jpg"),
                Text = "Welcome to our store!",
                Type = "image/jpeg"
            }
        },
        new DocumentContainer{
            Value = new Select
            {
                Text = "Choose what you need",
                Options = new SelectOption[]
                {
                    new SelectOption
                    {
                        Order = 1,
                        Text = "See our stock"
                    },
                    new SelectOption
                    {
                        Order = 2,
                        Text = "Follow an order"
                    }
                }
    
            }
        }
    };
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new DocumentCollection
        {
            ItemType = "application/vnd.lime.container+json",
            Items = documents
        };
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
        id: Lime.Guid(),
        type: "application/vnd.lime.collection+json",
        to: "128271320123982@messenger.gw.msging.net",
        content: {
            itemType: "application/vnd.lime.container+json",
            items: [
                {
                    type: "application/vnd.lime.media-link+json",
                    value: {
                        text: "Welcome to our store!",
                        type: "image/jpeg",
                        uri: "http://www.petshoplovers.com/wp-content/uploads/2014/03/CUIDADOS-B%C3%81SICOS-PARA-CRIAR-COELHOS.jpg"
                    }
                },
                {
                    type: "application/vnd.lime.select+json",
                    value: {
                        text: "Choose what you need",
                        options: [
                            {
                                order: 1,
                                text: "See our stock"
                            },
                            {
                                order: 2,
                                text: "Follow an order"
                            }
                        ]
                    }
                }
            ]
        }
    });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "to": "553199990000@0mn.io",
        "type": "application/vnd.lime.collection+json",
        "content": {
            "itemType": "application/vnd.lime.container+json",
            "items": [
                {
                    "type": "application/vnd.lime.media-link+json",
                    "value": {
                        "text": "Welcome to our store!",
                        "type": "image/jpeg",
                        "uri": "http://www.petshoplovers.com/wp-content/uploads/2014/03/CUIDADOS-B%C3%81SICOS-PARA-CRIAR-COELHOS.jpg"
                    }
                },
                {
                    "type": "application/vnd.lime.select+json",
                    "value": {
                        "text": "Choose what you need",
                        "options": [
                            {
                                "order": 1,
                                "text": "See our stock"
                            },
                            {
                                "order": 2,
                                "text": "Follow an order"
                            }
                        ]
                    }
                }
            ]
        }
    }
    
    

    A multimedia menu collection

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class CollectionMultimidiaMenu : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    JsonDocument jsonDocuments;
    JsonDocument jsonDocuments2;
    JsonDocument jsonDocuments3;
    
    public CollectionMultimidiaMenu(ISender sender)
    {
        _sender = sender;
    }
    
    DocumentSelect[] documents = new DocumentSelect[]
    {
        jsonDocuments = new JsonDocument();
        jsonDocuments2 = new JsonDocument();
        jsonDocuments3 = new JsonDocument();
    
        jsonDocuments.Add("Key1", "value1");
        jsonDocuments.Add("Key2", "2");
    
        jsonDocuments2.Add("Key3", "value3");
        jsonDocuments2.Add("Key4", "4");
    
        jsonDocuments3.Add("Key5", "value5");
        jsonDocuments3.Add("Key6", "6");
    
        DocumentSelect[] documents = new DocumentSelect[]
        {
            new DocumentSelect
            {
                Header = new DocumentContainer
                {
                    Value = new MediaLink
                    {
                        Title = "Title",
                        Text = "This is a first item",
                        Type = "image/jpeg",
                        Uri = new Uri("http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg"),
                    }
                },
                Options = new DocumentSelectOption[]
                {
                    new DocumentSelectOption
                    {
                        Label = new DocumentContainer
                        {
                            Value = new WebLink
                            {
                                Title = "Link",
                                Uri = new Uri("http://www.adoteumgatinho.org.br/")
                            }
                        }
                    },
                    new DocumentSelectOption
                    {
                        Label = new DocumentContainer
                        {
                            Value = new PlainText
                            {
                                Text = "Text 1"
                            }
                        },
                        Value = new DocumentContainer
                        {
                            Value = jsonDocuments
                        }
                    }
                }
            },
            new DocumentSelect
            {
                Header = new DocumentContainer
                {
                    Value = new MediaLink
                    {
                        Title = "Title 2",
                        Text = "This is another item",
                        Type = "image/jpeg",
                        Uri = new Uri("http://www.freedigitalphotos.net/images/img/homepage/87357.jpg")
                    }
                },
                Options = new DocumentSelectOption[]
                {
                    new DocumentSelectOption
                    {
                        Label = new DocumentContainer
                        {
                            Value = new WebLink
                            {
                                Title = "Second link",
                                Text = "Weblink",
                                Uri = new Uri("https://pt.dreamstime.com/foto-de-stock-brinquedo-pl%C3%A1stico-amarelo-do-pato-image44982058")
                            }
                        }
                    },
                    new DocumentSelectOption
                    {
                        Label = new DocumentContainer
                        {
                            Value = new PlainText {
                                Text = "Second text"
                            }
                        },
                        Value = new DocumentContainer
                        {
                            Value = jsonDocuments2
                        }
                    },
                    new DocumentSelectOption
                    {
                        Label = new DocumentContainer
                        {
                            Value = new PlainText {
                                Text = "More one text"
                            }
                        },
                        Value = new DocumentContainer
                        {
                            Value = jsonDocuments3
                        }
                    }
                }
            }
        };
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new DocumentCollection
        {
            ItemType = "application/vnd.lime.document-select+json",
            Items = documents,
        };
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
        client.sendMessage({
            id: Lime.Guid(),
            type: "application/vnd.lime.collection+json",
            to: "128271320123982@messenger.gw.msging.net",
            content: {
                itemType: "application/vnd.lime.document-select+json",
                items: [
                    {
                        header: {
                            type: "application/vnd.lime.media-link+json",
                            value: {
                                title: "Title",
                                text: "This is a first item",
                                type: "image/jpeg",
                                uri: "http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg"
                            }
                        },
                        options: [
                            {
                                label: {
                                    type: "application/vnd.lime.web-link+json",
                                    value: {
                                        title: "Link",
                                        uri: "http://www.adoteumgatinho.org.br/"
                                    }
                                }
                            },
                            {
                                label: {
                                    type: "text/plain",
                                    value: "Text 1"
                                },
                                value: {
                                    type: "application/json",
                                    value: {
                                        key1: "value1",
                                        key2: 2
                                    }
                                }
                            }
                        ]
                    },
                    {
                        header: {
                            type: "application/vnd.lime.media-link+json",
                            value: {
                                title: "Title 2",
                                text: "This is another item",
                                type: "image/jpeg",
                                uri: "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg"
                            }
                        },
                        options: [
                            {
                                label: {
                                    type: "application/vnd.lime.web-link+json",
                                    value: {
                                        title: "Second link",
                                        text: "Weblink",
                                        uri: "https://pt.dreamstime.com/foto-de-stock-brinquedo-pl%C3%A1stico-amarelo-do-pato-image44982058"
                                    }
                                }
                            },
                            {
                                label: {
                                    type: "text/plain",
                                    value: "Second text"
                                },
                                value: {
                                    type: "application/json",
                                    value: {
                                        key3: "value3",
                                        key4: 4
                                    }
                                }
                            },
                            {
                                label: {
                                    type: "text/plain",
                                    value: "More one text"
                                },
                                value: {
                                    type: "application/json",
                                    value: {
                                        key5: "value5",
                                        key6: 6
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "5",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.collection+json",
        "content": {
            "itemType": "application/vnd.lime.document-select+json",
            "items": [
                {
                    "header": {
                        "type": "application/vnd.lime.media-link+json",
                        "value": {
                            "title": "Title",
                            "text": "This is a first item",
                            "type": "image/jpeg",
                            "uri": "http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg"
                        }
                    },
                    "options": [
                        {
                            "label": {
                                "type": "application/vnd.lime.web-link+json",
                                "value": {
                                    "title": "Link",
                                    "uri": "http://www.adoteumgatinho.org.br"
                                }
                            }
                        },
                        {
                            "label": {
                                "type": "text/plain",
                                "value": "Text 1"
                            },
                            "value": {
                                "type": "application/json",
                                "value": {
                                    "key1": "value1",
                                    "key2": 2
                                }
                            }
                        }
                    ]
                },
                {
                    "header": {
                        "type": "application/vnd.lime.media-link+json",
                        "value": {
                            "title": "Title 2",
                            "text": "This is another item",
                            "type": "image/jpeg",
                            "uri": "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg"
                        }
                    },
                    "options": [
                        {
                            "label": {
                                "type": "application/vnd.lime.web-link+json",
                                "value": {
                                    "title": "Second link",
                                    "text": "Weblink",
                                    "uri": "https://pt.dreamstime.com/foto-de-stock-brinquedo-pl%C3%A1stico-amarelo-do-pato-image44982058"
                                }
                            }
                        },
                        {
                            "label": {
                                "type": "text/plain",
                                "value": "Second text"
                            },
                            "value": {
                                "type": "application/json",
                                "value": {
                                    "key3": "value3",
                                    "key4": 4
                                }
                            }
                        },
                        {
                            "label": {
                                "type": "text/plain",
                                "value": "More one text"
                            },
                            "value": {
                                "type": "application/json",
                                "value": {
                                    "key5": "value5",
                                    "key6": 6
                                }
                            }
                        }
                    ]
                }
            ]
        }
    }
    
    MIME type C#
    application/vnd.lime.collection+json Lime.Protocol.DocumentCollection

    Allows sending multiple contents of the same type in a single message. Some channels support this type of aggregation with special layouts (for example, in Facebook Messenger a multimedia menu collection is displayed as a carousel). In other channels, multiple messages are sent instead.

    Note: It is possible to send different content types using a collection of the container type.

    For more details, check the LIME protocol specification.

    Channel mapping

    Channel Type
    BLiP Chat Collection
    Messenger Multiple messages / Generic template (if is a multimedia menu collection)
    WhatsApp Text (multiple lines)
    SMS Text (multiple lines)
    Skype Activity (multiple lines)
    Telegram Message (multiple lines)

    Input

    Requesting a user's name:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class OptionUserInputMessaReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
    
        public OptionUserInputMessaReceiver(ISender sender)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            var document = new Input
            {
                Label = new DocumentContainer{
                    Value = new PlainText {
                        Text = "What is your name?"
                    }
                },
                Validation = new InputValidation{
                    Rule = InputValidationRule.Text
                }
            };
    
            await _sender.SendMessageAsync(document, message.From, cancellationToken);
        }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.input+json",
          to: "1042225583186385@messenger.gw.msging.net",
          content: {
              label: {
                type: "text/plain",
                value: "What is your name?"
              },
              validation: {
                rule: "text"
              }
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.input+json",
        "content": {
            "label": {
              "type": "text/plain",
              "value": "What is your name?"
            },
            "validation": {
              "rule": "text"
            }
        }
    }
    

    Requesting a user's location:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class UserInputLocationReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    
    public UserInputLocationReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new Input
        {
            Label = new DocumentContainer{
                Value = "Send your location please!"
            },
            Validation = new InputValidation{
                Rule = InputValidationRule.Type,
                Type = "application/vnd.lime.location+json"
            }
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.input+json",
          to: "1042225583186385@messenger.gw.msging.net",
          content: {
              label: {
                type: "text/plain",
                value: "Send your location please!"
              },
              validation: {
                rule: "type",
                type: "application/vnd.lime.location+json"
              }
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "1334448323284655@messenger.gw.msging.net",
        "type": "application/vnd.lime.input+json",
        "content": {
            "label": {
              "type": "text/plain",
              "value": "Send your location please!"
            },
            "validation": {
              "rule": "type",
              "type": "application/vnd.lime.location+json"
            }
        }
    }
    
    MIME type
    application/vnd.lime.input+json

    Allows sending of structured information requests to the user, where it is possible to define validations rules. This is useful for building question forms and getting specific user information - like name or phone number - or typed information - like an image or location. The execution of validation rules depends of channel's support.

    For more details, check the LIME protocol specification.

    Channel mapping

    Channel Type
    BLiP Chat User input (for Location type only)
    Messenger Location
    Whatsapp Text
    SMS Text
    Skype Activity
    Telegram Message

    List

    Sending a list with a weblink header to a Messenger user:

    using System;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace MessageTypes
    {
    public class OptionListMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionListMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new DocumentList
        {
            Header = new DocumentContainer
            {
                Value = new WebLink
                {
                    Title = "Classic T-Shirt Collection",
                    Text = "See all our colors",
                    PreviewUri = new Uri("http://streetwearvilla.com/image/cache/data/Products/Supreme/T-shirt/supreme-box-logo-t-shirt-collection-600x600.png"),
                    Uri = new Uri("http://streetwearvilla.com/supreme-box-logo-t-shirt-white"),
                    Target = WebLinkTarget.SelfTall
                }
            },
            Items = new DocumentContainer[]{
                new DocumentContainer
                {
                    Value = new WebLink
                    {
                        Title = "Classic White T-Shirt",
                        Text = "100% Cotton, 200% Comfortable",
                        PreviewUri = new Uri("http://www.plainwhitetshirt.co.uk/image/cache/catalog/images/GD010vwhiteteegildan-750x750.jpg"),
                        Uri = new Uri("http://www.plainwhitetshirt.co.uk/gildan-soft-style-white-vneck-tshirt"),
                        Target = WebLinkTarget.SelfTall
                    }
                },
                new DocumentContainer
                {
                    Value = new WebLink
                    {
                        Title = "Classic Blue T-Shirt",
                        Text = "100% Cotton, 200% Comfortable",
                        PreviewUri = new Uri("https://cdn.shopify.com/s/files/1/1475/5420/products/Classic_Blue_Front_12068_1024x1024.jpg?"),
                        Uri = new Uri("https://www.theringboxingclubshop.com/products/ring-classic-blue-t-shirt"),
                        Target = WebLinkTarget.SelfTall
    
                    }
                },
                new DocumentContainer
                {
                    Value = new WebLink
                    {
                        Title = "Classic Black T-Shirt",
                        Text = "100% Cotton, 200% Comfortable",
                        PreviewUri = new Uri("http://www.lvnlifestyle.com/wp-content/uploads/2014/08/mens.black_.tshirt.jpg"),
                        Uri = new Uri("http://www.lvnlifestyle.com/product/black-mens-bamboo-organic-cotton-classic-t-shirt/"),
                        Target = WebLinkTarget.SelfTall
                    }
                }
            }
        };
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    
    }
    }
    
    
    client.sendMessage({
        id: Lime.Guid(),
        type: "application/vnd.lime.list+json",
        to: "123129898129832@msging.gw.msging.net",
        content: {
          header:{
              type: "application/vnd.lime.web-link+json",
              value: {
                  title: "Classic T-Shirt Collection",
                  text: "See all our colors",
                  previewUri: "http://streetwearvilla.com/image/cache/data/Products/Supreme/T-shirt/supreme-box-logo-t-shirt-collection-600x600.png",
                  uri: "http://streetwearvilla.com/supreme-box-logo-t-shirt-white",
                  target: "selfTall"
              }
          },
          items:[
              {
                  type: "application/vnd.lime.web-link+json",
                  value:{
                      title: "Classic White T-Shirt",
                      text: "100% Cotton, 200% Comfortable",
                      previewUri: "http://www.plainwhitetshirt.co.uk/image/cache/catalog/images/GD010vwhiteteegildan-750x750.jpg",
                      uri: "http://www.plainwhitetshirt.co.uk/gildan-soft-style-white-vneck-tshirt",
                      target: "selfTall"
                  }
              },
              {
                  type: "application/vnd.lime.web-link+json",
                  value:{
                      title: "Classic Blue T-Shirt",
                      text: "100% Cotton, 200% Comfortable",
                      previewUri: "https://cdn.shopify.com/s/files/1/1475/5420/products/Classic_Blue_Front_12068_1024x1024.jpg?",
                      uri: "https://www.theringboxingclubshop.com/products/ring-classic-blue-t-shirt",
                      target: "selfTall"
                  }
              },
              {
                  type: "application/vnd.lime.web-link+json",
                  value:{
                      title: "Classic Black T-Shirt",
                      text: "100% Cotton, 200% Comfortable",
                      previewUri: "http://www.lvnlifestyle.com/wp-content/uploads/2014/08/mens.black_.tshirt.jpg",
                      uri: "http://www.lvnlifestyle.com/product/black-mens-bamboo-organic-cotton-classic-t-shirt/",
                      target: "selfTall"
                  }
              }
          ]
        }
      });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id":"1",
      "to":"123129898129832@msging.gw.msging.net",
      "type":"application/vnd.lime.list+json",
      "content":{
        "header":{
          "type":"application/vnd.lime.web-link+json",
          "value":{
            "title":"Classic T-Shirt Collection",
            "text":"See all our colors",
            "previewUri":"http://streetwearvilla.com/image/cache/data/Products/Supreme/T-shirt/supreme-box-logo-t-shirt-collection-600x600.png",
            "uri":"http://streetwearvilla.com/supreme-box-logo-t-shirt-whitemessengerExtensions=true",
            "target":"selfTall"
          }
        },
        "items":[
          {
            "type":"application/vnd.lime.web-link+json",
            "value":{
              "title":"Classic White T-Shirt",
              "text":"100% Cotton, 200% Comfortable",
              "previewUri":"http://www.plainwhitetshirt.co.uk/image/cache/catalog/images/GD010vwhiteteegildan-750x750.jpg",
              "uri":"http://www.plainwhitetshirt.co.uk/gildan-soft-style-white-vneck-tshirt&messengerExtensions=true",
              "target":"selfTall"
            }
          },
          {
            "type":"application/vnd.lime.web-link+json",
            "value":{
              "title":"Classic Blue T-Shirt",
              "text":"100% Cotton, 200% Comfortable",
              "previewUri":"https://cdn.shopify.com/s/files/1/1475/5420/products/Classic_Blue_Front_12068_1024x1024.jpg?",
              "uri":"https://www.theringboxingclubshop.com/products/ring-classic-blue-t-shirt&messengerExtensions=true",
              "target":"selfTall"
            }
          },
          {
            "type":"application/vnd.lime.web-link+json",
            "value":{
              "title":"Classic Black T-Shirt",
              "text":"100% Cotton, 200% Comfortable",
              "previewUri":"http://www.lvnlifestyle.com/wp-content/uploads/2014/08/mens.black_.tshirt.jpg",
              "uri":"http://www.lvnlifestyle.com/product/black-mens-bamboo-organic-cotton-classic-t-shirt/&messengerExtensions=true",
              "target":"selfTall"
            }
          }
        ]
      }
    }
    
    MIME type
    application/vnd.lime.list+json

    Allows sending of a list of different documents on a single message. It's also possible to define a document as a list header.

    Channel support

    Channel Type
    BLiP Chat Not supported yet
    Messenger List template
    Whatsapp Text
    SMS Text
    Skype Activity
    Telegram Message

    Location

    Sending a location with latitude, longitude and altitude:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    //A chatbot can send and receive a location entity. For those cases, use Location type:
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new Location
        {
            Latitude = -19.918899,
            Longitude = -43.959275,
            Altitude = 853,
            Text = "Take's place"
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.location+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            latitude: -19.918899,
            longitude: -43.959275,
            altitude: 853,
            text: "Take's place"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.location+json",
        "content": {
            "latitude": -19.918899,
            "longitude": -43.959275,
            "altitude": 853,
            "text": "Take's place"
        }
    }
    

    Request location

        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.input+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            label: {
              type: "text/plain",
              value: "Send your location please!"
            },
            validation: {
              rule: "type",
              type: "application/vnd.lime.location+json"
            }
          }
        });
    
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class RequestLocation : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public RequestLocation(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var location = new Input
        {
            Label = new DocumentContainer{
                Value = new PlainText
                {
                    Text = "Send your location please!"
                }
            },
            Validation = new InputValidation{
                Rule = InputValidationRule.Type,
                Type = Location.MediaType
            }
        };
    
    await _sender.SendMessageAsync(location, message.From, cancellationToken);
    }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "1334448323284655@messenger.gw.msging.net",
        "type": "application/vnd.lime.input+json",
        "content": {
            "label": {
              "type": "text/plain",
              "value": "Send your location please!"
            },
            "validation": {
              "rule": "type",
              "type": "application/vnd.lime.location+json"
            }
        }
    }
    
    MIME type
    application/vnd.lime.location+json

    Allows sending and receiving of geographic information.

    For more details, check the LIME protocol specification.

    Channel mapping

    Channel Type
    BLiP Chat Location
    Messenger Starting August 15, 2019, updated versions of the Messenger app will no longer render Location quick reply.
    Whatsapp Text with link
    SMS Text with link
    Skype Activity
    Telegram Location

    Asks the user for her location

    Request Location

    using System;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace MessageTypes
    {
        public class OptionUserInputMessageReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public OptionUserInputMessageReceiver(ISender sender)
            {
                _sender = sender;
            }
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                Document document = new Input
                {
                    Label = new DocumentContainer
                    {
                        Value = "Send your location please!"
                    },
                    Validation = new InputValidation
                    {
                        Rule = InputValidationRule.Type,
                        Type = "application/vnd.lime.location+json"
                    }
                };
    
                await _sender.SendMessageAsync(document, message.From, cancellationToken);
            }
        }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.input+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            label: {
              type: "text/plain",
              value: "Send your location please!"
            },
            validation: {
              rule: "type",
              type: "application/vnd.lime.location+json"
            }
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "1334448323284655@messenger.gw.msging.net",
        "type": "application/vnd.lime.input+json",
        "content": {
            "label": {
              "type": "text/plain",
              "value": "Send your location please!"
            },
            "validation": {
              "rule": "type",
              "type": "application/vnd.lime.location+json"
            }
        }
    }
    

    You can send a location request by using input content-type

    Sending a location request:

    Messenger BLiPChat
    imagem imagem

    Send Location

    using System;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace MessageTypes
    {
        public class OptionLocationMessageReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public OptionLocationMessageReceiver(ISender sender)
            {
                _sender = sender;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                Document document = new Location
                {
                    Latitude = -19.919715,
                    Longitude = -43.959753,
                    Altitude = 853,
                    Text = "Take's place"
                };;
    
                await _sender.SendMessageAsync(document, message.From, cancellationToken);
            }
        }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.location+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            latitude: -19.919715,
            longitude: -43.959753,
            altitude: 853,
            text: "Take's place"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.location+json",
        "content": {
            "latitude": -19.918899,
            "longitude": -43.959275,
            "altitude": 853,
            "text": "Take's place"
        }
    }
    

    You can send a location by using location.

    Sending a location with latitude, longitude and altitude:

    Messenger BLiPChat
    imagem imagem

    Sending the link of an image including title, descriptive text and metadata:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var imageUri = new Uri("http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg", UriKind.Absolute);
        var previewUri = new Uri("https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX", UriKind.Absolute);
    
        var document = new MediaLink
        {
            Title = "Cat",
            Text = "Here is a cat image for you!",
            Type = MediaType.Parse("image/jpeg"),
            AspectRatio = "1:1",
            Size = 227791,
            Uri = imageUri,
            PreviewUri = previewUri
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "title": "Cat",
            "text": "Here is a cat image for you!",
            "type": "image/jpeg",
            "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg",
            "aspectRatio": "1:1",
            "size": 227791,
            "previewUri": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX",
            "previewType": "image/jpeg"
        }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.media-link+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            title: "Cat",
            text: "Here is a cat image for you!",
            type: "image/jpeg",
            uri: "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg",
            aspectRatio: "1:1",
            size: 227791,
            previewUri: "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX",
            previewType: "image/jpeg"
          }
        });
    

    Sending an audio link: (For more details, check the LIME protocol specification)

    var audioMediaLink = new MediaLink
    {
        Title = "Audio",
        Type = MediaType.Parse("audio/mp3"),
        Uri = new Uri("http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3"),
        Size = 3124123,
        AspectRatio = "1:1"
    };
    
    await _sender.SendMessageAsync(audioMediaLink, message.From, cancellationToken);
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "type": "audio/mp3",
            "uri": "http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3",
            "size": 3124123
        }
    }
    
    MIME type
    application/vnd.lime.media-link+json

    Allows sending and receiving of links for multimedia content. The link can be any valid URI, but most part of the channels only support content served by HTTP/HTTPS protocol. It is possible to include a title and a text, besides image metadada such as MIME type, size and preview.

    Some channels allow defining the display's aspect ratio for certain media types. For instance, in Messenger, you should set the 1:1 value for the aspectRatio property to send squared images.

        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.media-link+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            type: "audio/mp3",
            uri: "http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3",
            size: 3124123
          }
        });
    

    For more details, check the LIME protocol specification.

    Channel mapping

    Channel Type
    BLiP Chat Media Link
    Messenger Attachments (image/audio/video/file, depending of MIME type)
    Whatsapp Media Link
    SMS Text with link
    Skype Activity
    Telegram Message

    Audio

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        Document document = new MediaLink
        {
            Type = MediaType.Parse("audio/mp3"),
            Uri = new Uri("http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3"),
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.media-link+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            type: "audio/mp3",
            uri: "http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3",
            size: 3124123
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "type": "audio/mp3",
            "uri": "http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3",
            "size": "3124123"
        }
    }
    

    You can send sounds by uploading them or sharing a URL using the Media Link content type.

    Messenger BLiPChat
    imagem imagem

    Document/Files

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var uriLink = new Uri("https://gradcollege.okstate.edu/sites/default/files/PDF_linking.pdf");
        var mediaTypeLink = new MediaType(MediaType.DiscreteTypes.Application, "pdf");
        var title = "pdf_open_parameters.pdf";
    
        Document document = new MediaLink
        {
            Title = title,
            Uri = uriLink,
            Type = mediaTypeLink,
            Size = 5540,
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.media-link+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            title: "pdf_open_parameters.pdf",
            uri: "https://gradcollege.okstate.edu/sites/default/files/PDF_linking.pdf",
            type: "application/pdf",
            size: 5540
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "title": "pdf_open_parameters.pdf",
            "uri": "https://gradcollege.okstate.edu/sites/default/files/PDF_linking.pdf",
            "type": "application/pdf",
            "size": 5540
        }
    }
    

    You can send documents like PDF's by uploading them or sharing a URL using the Media Link content type.

    Messenger BLiPChat
    imagem imagem

    Gif

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var imageUri = new Uri("http://i.giphy.com/14aUO0Mf7dWDXW.gif");
    
        Document document = new MediaLink
        {
            Type = "image/gif",
            Uri = imageUri
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          to: "128271320123982@messenger.gw.msging.net",
          type: "application/vnd.lime.media-link+json",
          content: {
            type: "image/gif",
            uri: "http://i.giphy.com/14aUO0Mf7dWDXW.gif"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "uri": "http://i.giphy.com/14aUO0Mf7dWDXW.gif",
            "type": "image/gif"
        }
    }
    

    You can send gifs by uploading them or sharing a URL using the Media Link content type.

    Messenger BLiPChat
    imagem imagem

    Images

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var imageUri = new Uri("http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg", UriKind.Absolute);
        var previewUri = new Uri("https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX", UriKind.Absolute);
    
        Document document = new MediaLink
        {
            Title = "Cat",
            Text = "Here is a cat image for you!",
            Type = MediaType.Parse("image/jpeg"),
            AspectRatio = "1:1",
            Size = 227791,
            Uri = imageUri,
            PreviewUri = previewUri
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
     client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.media-link+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            title: "Cat",
            text: "Here is a cat image for you!",
            type: "image/jpeg",
            uri: "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg",
            aspectRatio: "1:1",
            size: 227791,
            previewUri: "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX",
            previewType: "image/jpeg"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "title": "Cat",
            "text": "Here is a cat image for you!",
            "type": "image/jpeg",
            "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg",
            "aspectRatio": "1:1",
            "size": 227791,
            "previewUri": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX",
            "previewType": "image/jpeg"
        }
    }
    

    You can send images by uploading them or sharing a URL using the Media Link content type. Supported formats are jpg, png and gif.

    Messenger BLiPChat
    imagem imagem

    Video

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        Document document = new MediaLink
        {
            Type = MediaType.Parse("video/mp4"),
            Uri = new Uri("http://techslides.com/demos/sample-videos/small.mp4"),
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          to: "128271320123982@messenger.gw.msging.net",
          type: "application/vnd.lime.media-link+json",
          content: {
            type: "video/mp4",
            uri: "http://techslides.com/demos/sample-videos/small.mp4"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "553199991111@0mn.io",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "uri": "http://techslides.com/demos/sample-videos/small.mp4",
            "type": "video/mp4"
        }
    }
    

    You can send videos by uploading them or sharing a URL using the Media Link content type.

    Messenger BLiPChat
    imagem imagem

    Creating a menu with 3 options

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    //Send an options list to give your client the choice between multiple answers using Select type:
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        jsonDocuments = new JsonDocument();
        jsonDocuments.Add("Key1", "value1");
        jsonDocuments.Add("Key2", "2");
    
        var document = new Select
        {
            //Scope = SelectScope.Immediate, (create a quickreply instead menu)
            Text = "Choose an option:",
            Options = new SelectOption[]
            {
                new SelectOption
                {
                    Order = 1,
                    Text = "First option!",
                    Value = new PlainText { Text = "1" }
                },
                new SelectOption
                {
                    Order = 2,
                    Text = "Second option",
                    Value = new PlainText { Text = "2" }
                },
                new SelectOption
                {
                    Order = 3,
                    Text = "Third option",
                    Value = jsonDocuments
                }
            }
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    
    }
    Note:
    
    //NOTE:
    //Value field is optional. If informed, your value will be sent to the chatbot when the user chooses the option.
    //If Value field is not provided, one of the following fields must be provided: Order or Text. The Order field will be used only if Value and Text is not provided.
    //
    //Limitations:
    //Facebook Messenger: Limit of 3 options. Otherwise, your message will not be delivered.
    //If sending more than 3 options is necessary, divide them into multiple messages.
    //Tangram SMS: The Value field will be ignored. Only the Order field will be sent if the option be selected.
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.select+json",
          to: "1042221589186385@messenger.gw.msging.net",
          content: {
            text: "Choose an option",
            options: [
                {
                    text: "First option"
                },
                {
                    order: 2,
                    text: "Second option"
                },
                {
                    order: 3,
                    text: "Third option",
                    type: "application/json",
                    value: {
                        key1: "value1",
                        key2: 2
                    }
                }
            ]
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id":"311F87C0-F938-4FF3-991A-7C5AEF7771A5",
        "to":"1042221589186385@messenger.gw.msging.net",
        "type":"application/vnd.lime.select+json",
        "content":{
            "text":"Choose an option",
            "options":[
                {
                    "text":"First option"
                },
                {
                    "order":2,
                    "text":"Second option"
                },
                {
                    "order":3,
                    "text":"Third option",
                    "type":"application/json",
                    "value":{
                        "key1":"value1",
                        "key2":2
                    }
                }
            ]
        }
    }
    
    MIME type
    application/vnd.lime.select+json

    Allows sending of a text menu to customers to make a choice. It is possible to define a document that may be delivered to the chatbot when the customer selects an option - depending on the channel support. The options can also be numbered, if needed.

    Some channels support the options scope limitation, which determines for how much time they are valid for the user selection. For example, in some cases, sent options can only be selected by the customer at that time and must disappear after the choice. In this case, the scope is immediate. In others, the options are valid for the selection at any time, and the scope is persistent.

    BLiP uses Select content type to send persistent or immediate menus. For more details, check the LIME protocol specification.

    Messenger BLiPChat
    imagem imagem

    JSON 1

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "f8cf7a7a-be4f-473a-8516-60d55534b5a6",
        "from": "1042221589186385@messenger.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "text/plain",
        "content": "First option"
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.select+json",
          to: "blipcontact@msging.net",
          content: "First option"
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "f8cf7a7a-be4f-473a-8516-60d55534b5a6",
        "from": "1042221589186385@messenger.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "text/plain",
        "content": "First option"
    }
    

    JSON 2

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "76CB408D-39E6-4212-8AA1-7435B42A6993",
        "from": "1042221589186385@messenger.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "text/plain",
        "content": "Second option"
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.select+json",
          to: "blipcontact@msging.net",
          content: "Second option"
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "76CB408D-39E6-4212-8AA1-7435B42A6993",
        "from": "1042221589186385@messenger.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "text/plain",
        "content": "Second option"
    }
    

    JSON 3

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "035E675C-D25B-437D-80BD-057AD6F70671",
        "from": "1042221589186385@messenger.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "application/json",
        "content": {
            "key1":"value1",
            "key2":2
        }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.select+json",
          to: "blipcontact@msging.net",
          content: {
                key1: "value1",
                key2: 2
            }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "035E675C-D25B-437D-80BD-057AD6F70671",
        "from": "1042221589186385@messenger.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "application/json",
        "content": {
            "key1":"value1",
            "key2":2
        }
    }
    

    When the user selects one option, a message returns according to the rule:

    Return example of the above mentioned menu:

    The return message type will always be the same as the chosen option. When a value for the field value is not defined, the type will be text/plain.

    Channel mapping

    Channel Type
    BLiP Chat Select
    Messenger Button template (on default scope) and Quick replies (on immediate scope)
    Whatsapp Quick reply and Call to Actions as Message template
    SMS Text
    Skype Activity
    Telegram Message

    Quick Replies

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        jsonDocuments = new JsonDocument();
        jsonDocuments.Add("Key1", "value1");
        jsonDocuments.Add("Key2", "2");
    
        Document document = new Select
        {
            Scope = SelectScope.Immediate,// (create a quickreply instead menu)
            Text = "Choose an option:",
            Options = new SelectOption[]
            {
                new SelectOption
                {
                    Order = 1,
                    Text = "First option!",
                    Value = new PlainText { Text = "1" }
                },
                new SelectOption
                {
                    Order = 2,
                    Text = "Second option",
                    Value = new PlainText { Text = "2" }
                },
                new SelectOption
                {
                    Order = 3,
                    Text = "Third option",
                    Value = jsonDocuments
                }
            }
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.select+json",
          to: "1042221589186385@messenger.gw.msging.net",
          content: {
            scope:"immediate", // (create a quickreply instead menu)
            text: "Choose an option",
            options: [
                {
                    text: "First option"
                },
                {
                    order: 2,
                    text: "Second option"
                },
                {
                    order: 3,
                    text: "Third option",
                    type: "application/json",
                    value: {
                        key1: "value1",
                        key2: 2
                    }
                }
            ]
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id":"311F87C0-F938-4FF3-991A-7C5AEF7771A5",
        "to":"1042221589186385@messenger.gw.msging.net",
        "type":"application/vnd.lime.select+json",
        "content":{
            "scope":"immediate",
            "text":"Choose an option",
            "options":[
                {
                    "text":"First option"
                },
                {
                    "order":2,
                    "text":"Second option"
                },
                {
                    "order":3,
                    "text":"Third option",
                    "type":"application/json",
                    "value":{
                        "key1":"value1",
                        "key2":2
                    }
                }
            ]
        }
    }
    

    Quick replies provide a way to present a set of up to 11 buttons in-conversation that contain a title and an optional image, and appear prominently above the composer. You can also use quick replies to request a person's location.

    You can send quick replies by using Select. To switch between menu and quick reply you only need to change the scope attribute. Quick replies requires scope to be 'immediate'.

    Messenger BLiPChat
    imagem imagem

    Multimedia menu

    Menu with image in the header and a link and text as options:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class OptionMultimidiaMenuMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionMultimidiaMenuMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    DocumentSelectOption[] options = new DocumentSelectOption[]
    {
        new DocumentSelectOption
        {
            Label = new DocumentContainer
            {
                Value = new WebLink
                {
                    Text = "Go to your site",
                    Uri = new Uri("https://meusanimais.com.br/14-nomes-criativos-para-o-seu-gato/")
                }
            }
        },
        new DocumentSelectOption
        {
            Label = new DocumentContainer
            {
                Value = new PlainText
                {
                    Text = "Show stock here!"
                }
            },
            Value = new DocumentContainer
            {
                Value = new JsonDocument()
            }
        }
    };
    
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new DocumentSelect
            {
                Header = new DocumentContainer
                {
                    Value = new MediaLink
                    {
                        Title = "Welcome to mad hatter",
                        Text = "Here we have the best hats for your head.",
                        Type = "image/jpeg",
                        Uri = new Uri("http://i.overboard.com.br/imagens/produtos/0741720126/Ampliada/chapeu-new-era-bucket-print-vibe.jpg"),
                        AspectRatio = "1.1"
                    }
                },
                Options = options
            };
    
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.document-select+json",
        "content": {
            "header": {
                "type": "application/vnd.lime.media-link+json",
                "value": {
                    "title": "Welcome to mad hatter",
                    "text": "Here we have the best hats for your head.",
                    "type": "image/jpeg",
                    "uri": "http://petersapparel.parseapp.com/img/item100-thumb.png",
                    "aspectRatio": "1:1"
                }
            },
            "options": [
                {
                    "label": {
                        "type": "application/vnd.lime.web-link+json",
                        "value": {
                            "text": "Go to our site",
                            "uri": "https://petersapparel.parseapp.com/view_item?item_id=100"
                        }
                    }
                },
                {
                    "label": {
                        "type": "text/plain",
                        "value": "Show stock"
                    },
                    "value": {
                        "type": "application/json",
                        "value": {
                            "action": "show-items"
                        }
                    }
                }
            ]
        }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.document-select+json",
          to: "1042221589186385@messenger.gw.msging.net",
          content: {
                header: {
                    type: "application/vnd.lime.media-link+json",
                    value: {
                        title: "Welcome to mad hatter",
                        text: "Here we have the best hats for your head.",
                        type: "image/jpeg",
                        uri: "http://petersapparel.parseapp.com/img/item100-thumb.png",
                        aspectRatio: "1:1"
                    }
                },
                options: [
                    {
                        label: {
                            type: "application/vnd.lime.web-link+json",
                            value: {
                                text: "Go to our site",
                                uri: "https://petersapparel.parseapp.com/view_item?item_id=100"
                            }
                        }
                    },
                    {
                        label: {
                            type: "text/plain",
                            value: "Show stock"
                        },
                        value: {
                            type: "application/json",
                            value: {
                                action: "show-items"
                            }
                        }
                    }
                ]
            }
        });
    
    MIME type
    application/vnd.lime.document-select+json

    Allows sending an options menu to customers where the header and options can be of any content type, such as media link or web link, and not only text - like in the Select type. For each option, it is possible to define a document that is delivered to the contact when the customer performs a choice (depending on the channel support).

    For more details, check the LIME protocol specification.

    You can send carousels by using Document Collection content type and passing an array of Select type as the Items atribute.

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace MessageTypes
    {
        public class OptionDocumentCollectionMessageReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
            Document[] documents;
            JsonDocument jsonDocuments;
            JsonDocument jsonDocuments2;
            JsonDocument jsonDocuments3;
    
            public OptionDocumentCollectionMessageReceiver(ISender sender)
            {
                _sender = sender;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                Document document;
                document = getDocumentCollectionMenuMultimidia();
    
                await _sender.SendMessageAsync(document, message.From, cancellationToken);
            }
    
            public DocumentCollection getDocumentCollectionMenuMultimidia()
            {
                jsonDocuments = new JsonDocument();
                jsonDocuments2 = new JsonDocument();
                jsonDocuments3 = new JsonDocument();
    
                jsonDocuments.Add("Key1", "value1");
                jsonDocuments.Add("Key2", "2");
    
                jsonDocuments2.Add("Key3", "value3");
                jsonDocuments2.Add("Key4", "4");
    
                jsonDocuments3.Add("Key5", "value5");
                jsonDocuments3.Add("Key6", "6");
    
                DocumentSelect[] documents = new DocumentSelect[]
                {
                    new DocumentSelect
                    {
                        Header = new DocumentContainer
                        {
                            Value = new MediaLink
                            {
                                Title = "Title",
                                Text = "This is a first item",
                                Type = "image/jpeg",
                                Uri = new Uri("http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg"),
                            }
                        },
                        Options = new DocumentSelectOption[]
                        {
                            new DocumentSelectOption
                            {
                                Label = new DocumentContainer
                                {
                                    Value = new WebLink
                                    {
                                        Title = "Link",
                                        Uri = new Uri("http://www.adoteumgatinho.org.br/")
                                    }
                                }
                            },
                            new DocumentSelectOption
                            {
                                Label = new DocumentContainer
                                {
                                    Value = new PlainText
                                    {
                                        Text = "Text 1"
                                    }
                                },
                                Value = new DocumentContainer
                                {
                                    Value = jsonDocuments
                                }
                            }
                        }
                    },
                    new DocumentSelect
                    {
                        Header = new DocumentContainer
                        {
                            Value = new MediaLink
                            {
                                Title = "Title 2",
                                Text = "This is another item",
                                Type = "image/jpeg",
                                Uri = new Uri("http://www.freedigitalphotos.net/images/img/homepage/87357.jpg")
                            }
                        },
                        Options = new DocumentSelectOption[]
                        {
                            new DocumentSelectOption
                            {
                                Label = new DocumentContainer
                                {
                                    Value = new WebLink
                                    {
                                        Title = "Second link",
                                        Text = "Weblink",
                                        Uri = new Uri("https://pt.dreamstime.com/foto-de-stock-brinquedo-pl%C3%A1stico-amarelo-do-pato-image44982058")
                                    }
                                }
                            },
                            new DocumentSelectOption
                            {
                                Label = new DocumentContainer
                                {
                                    Value = new PlainText {
                                        Text = "Second text"
                                    }
                                },
                                Value = new DocumentContainer
                                {
                                    Value = jsonDocuments2
                                }
                            },
                            new DocumentSelectOption
                            {
                                Label = new DocumentContainer
                                {
                                    Value = new PlainText {
                                        Text = "More one text"
                                    }
                                },
                                Value = new DocumentContainer
                                {
                                    Value = jsonDocuments3
                                }
                            }
                        }
                    }
    
                };
    
                var document = new DocumentCollection
                {
                    ItemType = "application/vnd.lime.document-select+json",
                    Items = documents,
                };
    
                return document;
            }
        }
    }
    
    
     client.sendMessage({
            id: Lime.Guid(),
            type: "application/vnd.lime.collection+json",
            to: "128271320123982@messenger.gw.msging.net",
            content: {
                itemType: "application/vnd.lime.document-select+json",
                items: [
                    {
                        header: {
                            type: "application/vnd.lime.media-link+json",
                            value: {
                                title: "Title",
                                text: "This is a first item",
                                type: "image/jpeg",
                                uri: "http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg"
                            }
                        },
                        options: [
                            {
                                label: {
                                    type: "application/vnd.lime.web-link+json",
                                    value: {
                                        title: "Link",
                                        uri: "http://www.adoteumgatinho.org.br/"
                                    }
                                }
                            },
                            {
                                label: {
                                    type: "text/plain",
                                    value: "Text 1"
                                },
                                value: {
                                    type: "application/json",
                                    value: {
                                        key1: "value1",
                                        key2: 2
                                    }
                                }
                            }
                        ]
                    },
                    {
                        header: {
                            type: "application/vnd.lime.media-link+json",
                            value: {
                                title: "Title 2",
                                text: "This is another item",
                                type: "image/jpeg",
                                uri: "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg"
                            }
                        },
                        options: [
                            {
                                label: {
                                    type: "application/vnd.lime.web-link+json",
                                    value: {
                                        title: "Second link",
                                        text: "Weblink",
                                        uri: "https://pt.dreamstime.com/foto-de-stock-brinquedo-pl%C3%A1stico-amarelo-do-pato-image44982058"
                                    }
                                }
                            },
                            {
                                label: {
                                    type: "text/plain",
                                    value: "Second text"
                                },
                                value: {
                                    type: "application/json",
                                    value: {
                                        key3: "value3",
                                        key4: 4
                                    }
                                }
                            },
                            {
                                label: {
                                    type: "text/plain",
                                    value: "More one text"
                                },
                                value: {
                                    type: "application/json",
                                    value: {
                                        key5: "value5",
                                        key6: 6
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "5",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.collection+json",
        "content": {
            "itemType": "application/vnd.lime.document-select+json",
            "items": [
                {
                    "header": {
                        "type": "application/vnd.lime.media-link+json",
                        "value": {
                            "title": "Title",
                            "text": "This is a first item",
                            "type": "image/jpeg",
                            "uri": "http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg"
                        }
                    },
                    "options": [
                        {
                            "label": {
                                "type": "application/vnd.lime.web-link+json",
                                "value": {
                                    "title": "Link",
                                    "uri": "http://www.adoteumgatinho.org.br"
                                }
                            }
                        },
                        {
                            "label": {
                                "type": "text/plain",
                                "value": "Text 1"
                            },
                            "value": {
                                "type": "application/json",
                                "value": {
                                    "key1": "value1",
                                    "key2": "2"
                                }
                            }
                        }
                    ]
                },
                {
                    "header": {
                        "type": "application/vnd.lime.media-link+json",
                        "value": {
                            "title": "Title 2",
                            "text": "This is another item",
                            "type": "image/jpeg",
                            "uri": "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg"
                        }
                    },
                    "options": [
                        {
                            "label": {
                                "type": "application/vnd.lime.web-link+json",
                                "value": {
                                    "title": "Second link",
                                    "text": "Weblink",
                                    "uri": "https://pt.dreamstime.com/foto-de-stock-brinquedo-pl%C3%A1stico-amarelo-do-pato-image44982058"
                                }
                            }
                        },
                        {
                            "label": {
                                "type": "text/plain",
                                "value": "Second text"
                            },
                            "value": {
                                "type": "application/json",
                                "value": {
                                    "key3": "value3",
                                    "key4": "4"
                                }
                            }
                        },
                        {
                            "label": {
                                "type": "text/plain",
                                "value": "More one text"
                            },
                            "value": {
                                "type": "application/json",
                                "value": {
                                    "key5": "value5",
                                    "key6": "6"
                                }
                            }
                        }
                    ]
                }
            ]
        }
    }
    
    Messenger
    imagem imagem
    BLiPChat
    imagem imagem

    Multimedia Menu Channel mapping

    Channel Type
    BLiP Chat Document select
    Messenger Generic template
    Whatsapp Text
    SMS Text
    Skype Activity
    Telegram Message

    Native Content

    Sending a Messenger text message:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace MessageTypes
    {
      public class OptionNativeContentReceiver : IMessageReceiver
      {
          private readonly ISender _sender;
          private readonly Settings _settings;
    
          public OptionNativeContentReceiver(ISender sender)
          {
              _sender = sender;
              _settings = settings;
          }
    
          public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
          {
              JsonDocument document = new JsonDocument();
    +         document.Add("text", "hello, world!"); //exemplo funcional no messenger
    
              await _sender.SendMessageAsync(document, message.From, cancellationToken);
          }
      }
    
    }
    
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id":"1",
      "to":"949839515125748@messenger.gw.msging.net",
      "type":"application/json",
      "content":{
        "text": "hello, world!"
      }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.payment-receipt+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
              text: "hello, world!"
          }
        });
    

    2 - Sending an airline boardingpass template message type to Messenger:

    /*
    No examples for C# here
    still possible but is too big for this doc
    */
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.payment-receipt+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            attachment:{
              type: "template",
              payload:{
                template_type: "airline_boardingpass",
                intro_message: "You are checked in.",
                locale: "en_US",
                boarding_pass:[
                  {
                    passenger_name: "SMITH\/NICOLAS",
                    pnr_number: "CG4X7U",
                    travel_class: "business",
                    seat: "74J",
                    auxiliary_fields:[
                      {
                        label: "Terminal",
                        value: "T1"
                      },
                      {
                        label: "Departure",
                        value: "30OCT 19:05"
                      }
                    ],
                    secondary_fields:[
                      {
                        label: "Boarding",
                        value: "18:30"
                      },
                      {
                        label: "Gate",
                        value: "D57"
                      },
                      {
                        label: "Seat",
                        value: "74J"
                      },
                      {
                        label: "Sec.Nr.",
                        value: "003"
                      }
                    ],
                    logo_image_url: "https://www.example.com/en/logo.png",
                    header_image_url: "https://www.example.com/en/fb/header.png",
                    qr_code: "M1SMITH/NICOLAS  CG4X7U nawouehgawgnapwi3jfa0wfh",
                    above_bar_code_image_url: "https://www.example.com/en/PLAT.png",
                    flight_info:{
                      flight_number: "KL0642",
                      departure_airport:{
                        airport_code: "JFK",
                        city: "New York",
                        terminal: "T1",
                        gate: "D57"
                      },
                      arrival_airport:{
                        airport_code: "AMS",
                        city: "Amsterdam"
                      },
                      flight_schedule:{
                        departure_time: "2016-01-02T19:05",
                        arrival_time: "2016-01-05T17:30"
                      }
                    }
                  },
                  {
                    passenger_name: "JONES/FARBOUND",
                    pnr_number: "CG4X7U",
                    travel_class: "business",
                    seat: "74K",
                    auxiliary_fields:[
                      {
                        label: "Terminal",
                        value: "T1"
                      },
                      {
                        label: "Departure",
                        value: "30OCT 19:05"
                      }
                    ],
                    secondary_fields:[
                      {
                        label: "Boarding",
                        value: "18:30"
                      },
                      {
                        label: "Gate",
                        value: "D57"
                      },
                      {
                        label: "Seat",
                        value: "74K"
                      },
                      {
                        label: "Sec.Nr.",
                        value: "004"
                      }
                    ],
                    logo_image_url: "https://www.example.com/en/logo.png",
                    header_image_url: "https://www.example.com/en/fb/header.png",
                    qr_code: "M1JONES/FARBOUND  CG4X7U nawouehgawgnapwi3jfa0wfh",
                    above_bar_code_image_url: "https://www.example.com/en/PLAT.png",
                    flight_info:{
                      flight_number: "KL0642",
                      departure_airport:{
                        airport_code: "JFK",
                        city: "New York",
                        terminal: "T1",
                        gate: "D57"
                      },
                      arrival_airport:{
                        airport_code: "AMS",
                        city: "Amsterdam"
                      },
                      flight_schedule:{
                        departure_time: "2016-01-02T19:05",
                        arrival_time: "2016-01-05T17:30"
                      }
                    }
                  }
                ]
              }
            }
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id":"2",
      "to":"949839515125748@messenger.gw.msging.net",
      "type":"application/json",
      "content":{
        "attachment":{
          "type":"template",
          "payload":{
            "template_type":"airline_boardingpass",
            "intro_message":"You are checked in.",
            "locale":"en_US",
            "boarding_pass":[
              {
                "passenger_name":"SMITH\/NICOLAS",
                "pnr_number":"CG4X7U",
                "travel_class":"business",
                "seat":"74J",
                "auxiliary_fields":[
                  {
                    "label":"Terminal",
                    "value":"T1"
                  },
                  {
                    "label":"Departure",
                    "value":"30OCT 19:05"
                  }
                ],
                "secondary_fields":[
                  {
                    "label":"Boarding",
                    "value":"18:30"
                  },
                  {
                    "label":"Gate",
                    "value":"D57"
                  },
                  {
                    "label":"Seat",
                    "value":"74J"
                  },
                  {
                    "label":"Sec.Nr.",
                    "value":"003"
                  }
                ],
                "logo_image_url":"https://www.example.com/en/logo.png",
                "header_image_url":"https://www.example.com/en/fb/header.png",
                "qr_code":"M1SMITH/NICOLAS  CG4X7U nawouehgawgnapwi3jfa0wfh",
                "above_bar_code_image_url":"https://www.example.com/en/PLAT.png",
                "flight_info":{
                  "flight_number":"KL0642",
                  "departure_airport":{
                    "airport_code":"JFK",
                    "city":"New York",
                    "terminal":"T1",
                    "gate":"D57"
                  },
                  "arrival_airport":{
                    "airport_code":"AMS",
                    "city":"Amsterdam"
                  },
                  "flight_schedule":{
                    "departure_time":"2016-01-02T19:05",
                    "arrival_time":"2016-01-05T17:30"
                  }
                }
              },
              {
                "passenger_name":"JONES/FARBOUND",
                "pnr_number":"CG4X7U",
                "travel_class":"business",
                "seat":"74K",
                "auxiliary_fields":[
                  {
                    "label":"Terminal",
                    "value":"T1"
                  },
                  {
                    "label":"Departure",
                    "value":"30OCT 19:05"
                  }
                ],
                "secondary_fields":[
                  {
                    "label":"Boarding",
                    "value":"18:30"
                  },
                  {
                    "label":"Gate",
                    "value":"D57"
                  },
                  {
                    "label":"Seat",
                    "value":"74K"
                  },
                  {
                    "label":"Sec.Nr.",
                    "value":"004"
                  }
                ],
                "logo_image_url":"https://www.example.com/en/logo.png",
                "header_image_url":"https://www.example.com/en/fb/header.png",
                "qr_code":"M1JONES/FARBOUND  CG4X7U nawouehgawgnapwi3jfa0wfh",
                "above_bar_code_image_url":"https://www.example.com/en/PLAT.png",
                "flight_info":{
                  "flight_number":"KL0642",
                  "departure_airport":{
                    "airport_code":"JFK",
                    "city":"New York",
                    "terminal":"T1",
                    "gate":"D57"
                  },
                  "arrival_airport":{
                    "airport_code":"AMS",
                    "city":"Amsterdam"
                  },
                  "flight_schedule":{
                    "departure_time":"2016-01-02T19:05",
                    "arrival_time":"2016-01-05T17:30"
                  }
                }
              }
            ]
          }
        }
      }
    }
    
    MIME type
    application/json

    Allows sending of a native content of some channel using JSON format. It is possible to use any channel's available resource, even if this content is not yet supported as a BLiP canonical type.

    Note that, for a multi channel chatbot, it is the chatbot developer's responsibility to send the correct content type to each channel.

    Channel mapping

    Channel Type
    BLiP App Does not support
    Messenger Supported (the property content refers to message element of Messenger Send API
    Whatsapp Does not support
    SMS Does not support
    Skype Does not support
    Telegram Does not support

    Payment Invoice

    Example - Sending a payment request to a Facebook Messenger user using PagSeguro:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new Invoice
        {
            Currency = "BLR",
            DueTo = DateTime.Now.AddDays(1),
            Total = 10,
            Items =
                new InvoiceItem[]
                {
                    new InvoiceItem
                    {
                        Currency = "BRL",
                        Unit = 10,
                        Description = "Subscription for product: Hit",
                        Quantity = 1,
                        Total = 10
                    }
                },
        };
    
        var toPagseguro = $"{Uri.EscapeDataString(message.From.ToIdentity().ToString())}@pagseguro.gw.msging.net";
    
        await _sender.SendMessageAsync(document, toPagseguro, cancellationToken);
    }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.invoice+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            created: "2016-08-26T19:03:37.024Z",
            dueTo: "2016-08-27T19:03:37.024Z",
            currency: "BRL",
            total: 10.85,
            items: [
                {
                    quantity: 1.0,
                    unit: 10.85,
                    currency: "BRL",
                    total: 10.85,
                    description:"Subscription for product: Hit"
                }
            ]
        }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385%40messenger.gw.msging.net@pagseguro.gw.msging.net",
        "type": "application/vnd.lime.invoice+json",
        "content": {
            "created":"2016-08-26T19:03:37.024Z",
            "dueTo":"2016-08-27T19:03:37.024Z",
            "currency":"BRL",
            "total":10.85,
            "items":[
                {
                    "quantity":1.0,
                    "unit":10.85,
                    "currency":"BRL",
                    "total":10.85,
                    "description":"Subscription for product: Hit"
                }
            ]
        }
    }
    
    MIME type
    application/vnd.lime.invoice+json

    Allows sending of a payment request to a payment channel.

    Note: Payment invoices are not mapped to channel's cards. The purpose of such messages is only to control the payment's life cycle.

    Payment receipt

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class InvoiceStatusReceiver : IMessageReceiver
    {
    private readonly IMessagingHubSender _sender;
    
    public InvoiceStatusReceiver(IMessagingHubSender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var invoiceStatus = message.Content as InvoiceStatus;
        switch (invoiceStatus?.Status)
        {
            case InvoiceStatusStatus.Cancelled:
                await _sender.SendMessageAsync("Ok, you don't need pay anything.", message.From, cancellationToken);
                break;
            case InvoiceStatusStatus.Completed:
                await _sender.SendMessageAsync("Thank you for your payment, this is only a test", message.From, cancellationToken);
                var document = new PaymentReceipt
                {
                    Currency = "BLR",
                    Total = 10
                    Items =
                        new[]
                        {
                            new InvoiceItem
                            {
                                Currency = "BRL",
                                Unit = 10,
                                Description = "Item 1",
                                Quantity = 10,
                                Total = 10
                            }
                        },
                };
                await _sender.SendMessageAsync(document, message.From, cancellationToken);
                break;
            case InvoiceStatusStatus.Refunded:
                await _sender.SendMessageAsync("Ok, your payment was refunded by PagSeguro!", message.From, cancellationToken);
                break;
        }
    }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.payment-receipt+json",
          to: "128271320123982@messenger.gw.msging.net",
          content: {
            paidOn: "2016-08-26T19:03:37.024Z",
            code: "215BF6B5-01EF-4F9A-A944-0BC05FD0F228",
            method: {
                    name: "Credit Card"
            },
            currency: "BRL",
            total: 10.85,
            items: [{
                    quantity: 1.0,
                    unit: 10.85,
                    currency: "BRL",
                    total: 10.85,
                    description: "Item 1"
                }
            ]
        }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.payment-receipt+json",
        "content": {
            "paidOn": "2016-08-26T19:03:37.024Z",
            "code": "215BF6B5-01EF-4F9A-A944-0BC05FD0F228",
            "method": {
                    "name": "Credit Card"
            },
            "currency": "BRL",
            "total": 10.85,
            "items": [{
                    "quantity": 1.0,
                    "unit": 10.85,
                    "currency": "BRL",
                    "total": 10.85,
                    "description": "Item 1"
                }
            ]
        }
    }
    
    MIME type
    application/vnd.lime.payment-receipt+json

    Allows sending of a payment receipt to a customer.

    In order to realize a payment on your chatbot, it is necessary to use the payment channel. For now, only the PagSeguro channel is supported. To request a payment, the chatbot must send a message of type Invoice to the payment channel informing the user address using the format at right bar.

    Example

    Sending a payment receipt to a Messenger user:

    Channel mapping

    Channel Type
    BLiP Chat Not supported yet
    Messenger Receipt template
    Whatsapp Text
    SMS Text
    Skype Activity
    Telegram Message

    Plain Text

    MIME type
    text/plain

    Allows sending and receiving simple text messages.

    Sending a message to a Messenger recipient:

        client.sendMessage({
            id: Lime.Guid(),
            type: "text/plain",
            to: "128271320123982@messenger.gw.msging.net",
            content: "Welcome to our service! How can I help you?"
            });
    
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    //Replying a received message with a simple text message.
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new PlainText {Text = "Welcome to our service! How can I help you?"};
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "128271320123982@messenger.gw.msging.net",
        "type": "text/plain",
        "content": "Welcome to our service! How can I help you?"
    }
    

    For more details, check the specification of LIME protocol.

    Messenger BLiPChat
    imagem imagem

    Channel mapping

    Channel Type
    BLiP Chat Text
    Messenger Text message
    Whatsapp Text
    SMS Text
    Skype Activity
    Telegram Message

    Redirect

    1 - Redirecting to the attendance service

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class OptionRedirectMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionRedirectMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new Redirect
        {
            Address = "atendimento"
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "54f1dd2e-42d2-43f2-9100-68fbbabb9c83@tunnel.msging.net",
        "type": "application/vnd.lime.redirect+json",
        "content": {
            "address": "attendance"
        }
    }
    
    client.sendMessage({
        id: Lime.Guid(),
        to: "54f1dd2e-42d2-43f2-9100-68fbbabb9c83@tunnel.msging.net",
        type: "application/vnd.lime.redirect+json",
        content: {
            address: "attendance",
        }
    });
    

    From this moment, the messages sent by the client will be forwarded to the chatbot configured as service attendance in the master model settings tab. Note: The customer identifier is not the same for the other bot.

    2 - Redirecting to the chatbot with identifier mysdkbot , passing a document as the context of the conversation.

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class SpecificRedirectPassingContext : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public SpecificRedirectPassingContext(ISender sender)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
           var document = new Redirect
            {
                Address = "mysdkbot@msging.net",
                Context = new DocumentContainer {
                    Value = new PlainText {
                        Text = "Get Started"
                    }
                }
            };
    
            await _sender.SendMessageAsync(document, message.From, cancellationToken);
        }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "54f1dd2e-42d2-43f2-9100-68fbbabb9c83@tunnel.msging.net",
        "type": "application/vnd.lime.redirect+json",
        "content": {
            "address": "mysdkbot@msging.net",
            "context": {
                "type": "text/plain",
                "value": "Get started"
            }
        }
    }
    
    client.sendMessage({
        id: Lime.Guid(),
        to: "54f1dd2e-42d2-43f2-9100-68fbbabb9c83@tunnel.msging.net",
        type: "application/vnd.lime.redirect+json",
        content: {
            address: "mysdkbot@msging.net",
            context: {
                type: "text/plain",
                value: "Get started"
            }
        }
    });
    

    In this example, the chatbot with mysdkbot identifier will receive the messages sent by the client, in addition to receiving a message with the content defined in the context, as if it had been sent by the client:

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "3",
        "from": "2bdcd8d0-9e69-484f-a88a-d5a529708864@tunnel.msging.net",
        "to": "mysdkbot@msging.net",
        "type": "text/plain",
        "content": "Get started"
    }
    
    {
        id: "3",
        from: "2bdcd8d0-9e69-484f-a88a-d5a529708864@tunnel.msging.net",
        to: "mysdkbot@msging.net",
        type: "text/plain",
        content: "Get started"
    }
    
    MIME type
    application/vnd.lime.redirect+json

    Allows the redirection of a particular chatbot conversation to a new address. In practice, it makes the handover of a conversation between different chatbots possible, which can be of any template (FAQ, Human Operator) or SDK / Webhooks.

    Currently, redirection is only supported on chatbots configured as services in master template. This can be done using the chatbot (identifier) address or the service name defined in the master model settings in the portal.

    It is possible to define a document that represents the context of the conversation and that will be received by the chatbot to which the conversation was directed. The context is useful for defining a specific flow in the destination chatbot, for example.

    Channel mapping

    Redirect is currently supported only by chatbots configured as services in the master template. In this case, all messages will have the domain @tunnel.msging.net, since the master template uses the tunnel extension for communication with services (sub-bots).

    Resource

    Sending a resource message with the welcome-message identifier:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class OptionResourceMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionResourceMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new Resource
        {
            Key = "welcome-message" //recurso previamente adicionado com extensão 'recursos' ou através do portal
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.iris.resource+json",
        "content": {
            "key": "welcome-message"
        }
    }
    
    client.sendMessage({
        id: Lime.Guid(),
        type: "application/vnd.iris.resource+json",
        to: "1042221589186385@messenger.gw.msging.net",
        content: {
            key: "welcome-message"
        }
    });
    

    In case there is a resource with this key, the server replaces the content and forwards it to the destination. Imagining that the resource with welcome-message key is a text/plain document with value Welcome to our service, the final message would be like this:

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "text/plain",
        "content": "Welcome to our service"
    }
    
    {
        id: "1",
        to: "1042221589186385@messenger.gw.msging.net",
        type: "text/plain",
        content: "Welcome to our service"
    }
    
    MIME type
    application/vnd.iris.resource+json

    Allows sending of a message where the content is a resource stored in the server. The resource should be stored through the resources extension. The server automatically replaces the content with the stored resource, in case the resource key already exists for the caller chatbot.

    The resource may contain variables which can be replaced by values specified during sending time, through the variables property.

    You can enter substitution variables for the resource using the variables property. In this case, the variables present in the resource with the ${variableName} format are replaced by the specified values.

    For example, imagine that the resource in the welcome-message key has the value Welcome to our service, ${name}!'. If you send the following:

    Request

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class ResourceMessageReplace : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public ResourceMessageReplace(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var openWith = new Dictionary<string, string>();
        openWith.Add("name",message.From.Name);
    
        var document = new Resource
        {
            Key = "welcome-message",
            Variables = openWith
    
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "application/vnd.iris.resource+json",
        "content": {
            "key": "welcome-message",
            "variables": {
                "name": "John Doe"
            }
        }
    }
    
    client.sendMessage({
        id: Lime.Guid(),
        to: "1042221589186385@messenger.gw.msging.net",
        type: "application/vnd.iris.resource+json",
        content: {
            key: "welcome-message",
            variables: {
                name: "John Doe"
            }
        }
    });
    

    The final message will be:

    Response

    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042221589186385@messenger.gw.msging.net",
        "type": "text/plain",
        "content": "Welcome to our service, John Doe!"
    }
    
    {
        id: "1",
        to: "1042221589186385@messenger.gw.msging.net",
        type: "text/plain",
        content: "Welcome to our service, John Doe!"
    }
    

    Channel mapping

    This content type is supported on all channels.

    Sensitive information

    Sending a password using text content for a Messenger user:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class OptionSensitiveMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public OptionSensitiveMessageReceiver(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
    
        var document = new SensitiveContainer
        {
            Value = "Your password is 123456"
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.sensitive+json",
          to: "1042225583186385@messenger.gw.msging.net",
          content: {
            type: "text/plain",
            value: "Your password is 123456"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "1",
      "to": "1334448251684655@messenger.gw.msging.net",
      "type": "application/vnd.lime.sensitive+json",
      "content": {
        "type": "text/plain",
        "value": "Your password is 123456"
      }
    }
    
    

    Sending a weblink:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    public class SensitiveWeblinkMessage : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public SensitiveWeblinkMessage(ISender sender)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var url = new Uri("https://mystore.com/checkout?ID=A8DJS1JFV98AJKS9");
        var document = new SensitiveContainer
        {
            Value = new WebLink
            {
                Text = "Please follow this link for the checkout",
                Uri = url
            }
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    }
    
    client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.sensitive+json",
          to: "1042225583186385@messenger.gw.msging.net",
          content: {
            type: "application/vnd.lime.web-link+json",
            value: {
              text: "Please follow this link for the checkout",
              uri: "https://mystore.com/checkout?ID=A8DJS1JFV98AJKS9"
            }
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "2",
      "to": "1334448251684655@messenger.gw.msging.net",
      "type": "application/vnd.lime.sensitive+json",
      "content": {
        "type": "application/vnd.lime.web-link+json",
        "value": {
          "text": "Please follow this link for the checkout",
          "uri": "https://mystore.com/checkout?ID=A8DJS1JFV98AJKS9"
        }
      }
    }
    
    
    MIME type
    application/vnd.lime.sensitive+json

    Wraps a message content in order to signal that the information is confidential or sensitive. In this case, the server will not store the message content in any moment. The wrapped content can be of any available BLiP type.

    Important note: This is restricted to the BLiP servers. External channels (Messenger, Telegram, etc.) still can store your information in some way. Pay attention on particular security polices for each channel.

    Sending a message to a Messenger recipient:

    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Messaging.Contents;
    using Lime.Protocol;
    using Take.Blip.Client;
    //To send a web page link use the WebLink type:
    public class PlainTextMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public PlainTextMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var url = new Uri("http://limeprotocol.org/content-types.html#web-link");
        var previewUri =
            new Uri("techbeacon.scdn7.secure.raxcdn.com/sites/default/files/styles/article_hero_image/public/documents-stack-documentation-agile-devops.jpg?itok=cFDq9Y95");
    
        var document = new WebLink
        {
            Text = "Here is a documentation weblink",
    +       Target = WebLinkTarget.Self,
            PreviewUri = previewUri,
            Uri = url
        };
    
        await _sender.SendMessageAsync(document, message.From, cancellationToken);
    }
    
    }
    
    client.sendMessage({s
          id: Lime.Guid(),
          type: "application/vnd.lime.web-link+json",
          to: "1042225583186385@messenger.gw.msging.net",
          content: {
            uri: "http://limeprotocol.org/content-types.html#web-link",
            target: "self",
            text: "Here is a documentation weblink"
          }
        });
    
    POST https://http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "1",
        "to": "1042225583186385@messenger.gw.msging.net",
        "type": "application/vnd.lime.web-link+json",
        "content": {
            "uri": "http://limeprotocol.org/content-types.html#web-link",
            "target": "self",
            "text": "Here is a documentation weblink"
        }
    }
    
    MIME type
    application/vnd.lime.web-link+json

    Allows sending of a link for a webpage to the client including metadata, such as link's title, description and a miniature image.

    Sending a message to a Messenger recipient:

    In some channels, it is possible to define how the webpage will be displayed (on the same window, openning a new window or occupying part of the device window) through the target property. For more details, check the LIME protocol specification.

    Channel mapping

    Channel Type
    BLiP Chat Web Link
    Messenger Generic template or Button (if used with the Multimedia Menu).
    Whatsapp Media Link
    SMS Text with link
    Skype Activity
    Telegram Message

    It is also possible in some channels to use special URI schemes to create links with specific behaviors as below:

    Channel URI Scheme Description Example
    Messenger tel Defines a link for the telephone call to the specific number. Mapped to a Call button. tel:+5531999990000
    Messenger share Defines a link to share current message. Mapped to a Share button. share:

    Documents

    The documents are used as responses or resources for many types of communication on this platform.

    The concept of document is presented in the Lime Protocol. For more details, check the LIME protocol definitions specification.

    AccessKey

    Represents an access key.

    MIME type
    application/vnd.iris.accessKey+json
    Name Description Type
    id the key id string
    account the account identity Identity
    key the base64 representation of the actual key string
    purpose the descriptive purpose string
    expiration the key expiration date DateTimeOffset
    requirer the account that required the access key Node
    temporary indicates if the access key must be removed after 1st use bool

    Account

    Represents an user account information. An account is an interaction with BLiP. Builder saves all account that sends a message as a Contact automatically.

    MIME type
    application/vnd.lime.account+json
    Name Description Type
    fullName the user full name string
    address the user address string
    city the number of opened tickets string
    email The user e-mail address string
    phoneNumber The user phone number. string
    photoUri The user photo URI. string
    cellPhoneNumber The user cellphone number. string
    gender The user gender (male/female). string
    timezone The user timezone relative to GMT. integer
    culture The user culture info, in the IETF language tag format. string
    extras A generic JSON property to store any key/value strings. object
    isTemporary Indicates that the account is temporary is valid only in the current session. boolean
    password Base64 representation of the account password. Only valid on set commands during the account creation or update. string
    oldPassword Base64 representation of the account password. Only valid on set commands during the account password update. string
    inboxSize Size of account inbox for storing offline messages. The default value is 0. integer
    allowGuestSender Indicates if this account allows receive messages from users with guest sessions. boolean
    allowUnknownSender Indicates if this account allows receive messages from users that are not in the account contact list. boolean
    storeMessageContent Indicates if the content of messages from this account should be stored in the server. Note that for offline messages, this will always happens. boolean
    encryptMessageContent Indicates if the content of messages from this account should be encrypted in the server. boolean

    AccountContact

    Represents an account contact for an application.

    MIME type
    application/vnd.iris.accountcontact+json
    Name Description Type
    owner the identity of the owner Identity
    identity the identity of the account contact Identity
    photoUri the uri for the account contact phot Uri

    AccountKeyRequest

    Represents an account key request model.

    MIME type
    application/vnd.iris.keyRequest+json
    Name Description Type
    alternativeAddress the account alternative address (email, phone) Identity
    purpose the key descriptive purpose string
    Temporary indicates if the access key must be removed after the first use bool
    ttl the key time to live, in milliseconds long

    AgentProductivitySummary

    Represents a summary about agent productivity.

    MIME type
    application/vnd.iris.desk.agentproductivitysummary+json
    Name Description Type
    identity the agent identity Identity
    online the amount of time the agent was online TimeSpan
    paused the amount of time the agent was in pause TimeSpan
    invisible the amount of time the agent was invisible TimeSpan
    offline the amount of time the agent was offline TimeSpan
    total the total amount of time TimeSpan

    Analysis

    Represents an AI text analysis.

    MIME type
    application/vnd.talkservice.analysis+json
    Name Description Type
    id the analysis id string
    requestDateTime the analysis date DateTimeOffset
    text the text to be analyzed string
    intention the identified intention string
    score the analysis score (confiability) double
    feedback the analysis feedback AnalysisModelFeedback
    intentionSuggested the intention suggested string
    intentions the intetions response IntentionResponse array
    entities the entities response EntitiyResponse array
    messageSource the source of the message MessageSource
    userIdentity the user identity Identity
    messageId the message id string
    modelId the model id string

    AnalysisFeedback

    Represents an AI text analysis feedback.

    MIME type
    application/vnd.iris.ai.analysis-feedback+json
    Name Description Type
    intentionId the intent associated to the analyzed input string
    analysisId the analysis id string

    AnalysisRequest

    Represents an AI text analysis request.

    MIME type
    application/vnd.iris.ai.analysis-request+json
    Name Description Type
    modelId the model id used in the request string
    text user input to be analyzed string
    providerContext provider's conversation context IDictionary
    testingRequest defines if the request is a test one bool
    reportRequest defines if the request would be used to the report bool
    extras additional information IDictionary <string, string>
    providerContext the conversation context from the configured provider IDictionary <string, object>

    AnalysisResponse

    Represents the result of an analysis request.

    MIME type
    application/vnd.iris.ai.analysis-response+json
    Name Description Type
    id the analysis id string
    text Text used to process string
    intentions The intentions found in the text IntentionResponse array
    entities The entities found in the text EntityResponse array
    provider the name of the provider used in the analysis string
    modelId the id of the model used in the analysis string
    providerContext the conversation context from the configured provider IDictionary <string, object>

    Answer

    Represents an answer associated with an intent.

    MIME type
    application/vnd.iris.ai.answer+json
    Name Description Type
    id the answer id string
    type the answer type MediaType
    value the answer document value Document
    rawValue the plain or JSON value of the value property for storage string

    AttendanceTimeSummary

    Represents a summary about attendance time.

    MIME type
    application/vnd.iris.desk.attendancetimesummary+json
    Name Description Type
    attendanceTime the attendance time TimeSpan

    Attendant

    Represents an agent attendant profile.

    MIME type
    application/vnd.iris.desk.attendant+json
    Name Description Type
    identity the identity of the team’s owner Identity
    fullName the name of the agent string
    email the email of the agent string
    teams the list of teams the agent is in string array
    status the agent status AttendantStatusEnum*
    lastServiceDate the date of the agent last ticket DateTimeOffset
    agentSlots the number of attendance slot for an agent int
    ticketsInService the number of open tickets with an agent int

    * AttendantStatusEnum:
    - Offline = 0
    - Pause = 1
    - Online = 2
    - Invisible = 3

    AttendantTeam

    Represents an agent team.

    MIME type
    application/vnd.iris.desk.attendant-team+json
    Name Description Type
    ownerIdentity the identity of the owner string
    identity the identity of the agent string
    teams the teams of the agent string
    lastServiceDate the date of the agent last ticket MessageKind array
    agentSlots the number of the agent slots for an agent int

    AttendantTicketsSummary

    Represents a summary for agent tickets.

    MIME type
    application/vnd.iris.desk.attendantticketssummary+json
    Name Description Type
    identity the agent identity string
    status the agent status AttendantStatusEnum*
    openedTickets the number of opened tickets long

    * AttendantStatusEnum:
    - Offline = 0
    - Pause = 1
    - Online = 2
    - Invisible = 3

    BillingRule

    Represents a rule for message billing.

    MIME type
    application/vnd.iris.billing.rule+json
    Name Description Type
    id the rule id string
    name the rule name string
    value the value that should be charged in case of applying the rule double
    messageKinds the message kinds of the rule MessageKind array
    contentTypes the message content type of the rule MediaType array
    destinations the destinations string array

    Capability

    Represents the messaging capabilities of a node in a session.

    MIME type
    application/vnd.lime.capability+json
    Name Description Type
    contentTypes Indicates the message content types that the session node is able to handle. By default, the server delivers all messages types to the nodes. string array
    resourceTypes Indicates the command resource types that the session node is able to handle. By default, the server blocks all command addressed to the nodes. string array

    Chart

    Represents an analytics chart.

    MIME type
    application/vnd.iris.chart+json
    Name Description Type
    id the chart unique id string
    name the chart name string
    chartType the chart type ChartTypeEnum*
    dimension the chart data dimensions Dimension**
    category the chart data category string
    order the chart order int

    * ChartTypeEnum:
    - list = 0
    - table = 1
    - line = 2
    - bar = 3
    - column = 4
    - pie = 5
    - counter = 6

    ** DimensionEnum:
    - users = 0
    - messages = 1
    - events = 2

    Comment

    Represents a comment for an account.

    MIME type
    application/vnd.iris.crm.comment+json
    Name Description Type
    id the comment id string
    authorIdentity the identity of the agent / author Identity
    storageDate the comment creation date DateTimeOffset
    content the content of the comment string

    Configuration

    Represents a configuration entry.

    MIME type
    application/vnd.iris.configuration+json
    Name Description Type
    owner the configuration owner identity Identity
    caller the configuration caller identity Identity
    name the configuration name string
    value the configuration content value string

    ConfusionMatrix

    Represents a confusion matrix model.

    MIME type
    application/vnd.iris.ai.confusion-matrix+json
    Name Description Type
    ownerIdentity the owner identifier string
    id the matrix identifier string
    modelId the model identifier string
    version the version name string
    score matrix score to be used when predicting the score for a true positive double
    sampleSize the amount of samples for each intention int
    createdDate the matrix creation date DateTimeOffset
    accuracy the matrix accuracy double
    avgScore the model average score double
    precision the model precision double
    recall the model recall double
    f1Score the model F1 Score double
    numberOfSamples the number of samples int
    matrix The matrix int matrix
    perClasses Per class summary of the matrix ConfusionMatrixClass array
    source external source containing the analysis content string

    Contact

    Represents an contact saved in BLiP.

    MIME type
    application/vnd.lime.contact+json
    Name Description Type
    identity The identity of the contact, in the name@domain forma string
    name The name of the contact. string
    address The contact address. string
    city The contact city name. string
    email The contact e-mail address. string
    phoneNumber The contact phone number. string
    photoUri The contact photo URI. string
    cellPhoneNumber The contact cellphone number. string
    gender The contact gender (male/female). string
    timezone The contact timezone relative to GMT. integer
    culture The contact culture info, in the IETF language tag format. string
    extras A generic JSON property to store any key/value strings. object
    isPending Determines if the contact is pending for acceptance by the roster owner. boolean
    sharePresence Indicates if the roster owner wants to share presence information with the contact. If true, the server provides a get delegation permission to the contact identity into the roster owner presence resource. The default value is true. boolean
    shareAccountInfo Indicates if the roster owner wants to share account information with the contact. If true, the server provides a get delegation permission to the contact identity into the roster owner account resource. The default value is true. boolean
    group Indicate the contact group name. boolean

    CustomReply

    Represents a custom reply.

    MIME type
    application/vnd.iris.desk.custom-reply+json
    Name Description Type
    id the id of the custom reply string
    category the category of the custom reply string
    name the name of the custom reply string
    document the content of the message string
    type the media type of the custom reply MediaType
    isDynamicContent check if the custom reply is a dynamic content bool

    DistributionList

    Represents a distribution list.

    MIME type
    application/vnd.iris.distribution-list+json
    Name Description Type
    Identity the identity of the list Identity

    DistributionListMessage

    Represents information about a distribution list message.

    MIME type
    application/vnd.iris.distribution-list-message+json
    Name Description Type
    id the distribution list message id string
    recipients the number of recipients long
    sent the number of messages sent int
    received the number of messages received int
    consumed the number of messages consumed int
    failed the number of messages failed int
    status the status of the messages DistributionListMessageStatus*
    statusDate the status date DateTimeOffset

    * DistributionListMessageStatus:
    - processing
    - processed
    - failed

    DistributionListNotification

    Represents a distribution list notification.

    MIME type
    application/vnd.iris.distribution-list-notification+json
    Name Description Type
    recipient the identity of the recipient Identity
    event the event Event
    reasonCode the reason code int
    reasonDescription the reason description string
    storageDate the storage date DateTimeOffset

    Entity

    Represents an entity in a model.

    MIME type
    application/vnd.iris.ai.entity+json
    Name Description Type
    id the entity id string
    name the entity name string
    storageDate the entity creation date DateTimeOffset
    values the entities examples EntityValues* array
    IsDeleted check if the entity was deleted bool
    IsSystemEntity check if is an system entity bool

    * EntityValues:

    Name Description Type
    name the example name string
    synonymous the example synonymous string array

    EventTrack

    Represents an event track.

    MIME type
    application/vnd.iris.eventTrack+json
    Name Description Type
    identity user identity Identity
    contact the event track contact EventContact
    messageId the message id string
    storageDate the event track storage date DateTimeOffset
    value the value of the event track decimal
    category the category of the event track string
    action the action of the event track string
    label the label of the event track string
    extras additional information about event track IDictionary <string,string>
    count the event track counter int

    HttpContentDocument

    Represents a http content.

    MIME type
    application/vnd.iris.httpContent+json
    Name Description Type
    uri the uri of the http content Uri
    method the method of the http content string
    headers the headers of the http content IDictionary <string, string>
    queryString the query string IDictionary <string, string>
    content the http content string

    IdentityPerDay

    Represents identities in a specific date.

    MIME type
    application/vnd.iris.analytics.identity-day+json
    Name Description Type
    owner owner that was hit in this day Identity
    storageDate storage date DateTimeOffset
    account Identity that hit owner in this day Identity

    IdentityPlan

    Represents a plan for the identity.

    MIME type
    application/vnd.iris.billing.identity-plan+json
    Name Description Type
    ownerIdentity the identity of the account Identity
    planId the id for a plan string

    IdentitySubscription

    Represents a subscription for the identity.

    MIME type
    application/vnd.iris.billing.identity-subscription+json
    Name Description Type
    ownerIdentity the identity of the account Identity
    subscriptionId the id for a subscription string

    IdentityTotalPerDay

    Represents the total of identities in a specific date.

    MIME type
    application/vnd.iris.analytics.identity-total-day+json
    Name Description Type
    owner owner of this total per day Identity
    storageDate the storage date DateTimeOffset
    total total amount of this metric int
    domain the domain identity Identity

    IdentityWallet

    Represents a wallet for the account.

    MIME type
    application/vnd.iris.billing.identity-wallet+json
    Name Description Type
    ownerIdentity the identity of the account Identity
    walletId the id for the wallet string

    Intention

    Represent an intent in a model.

    MIME type
    application/vnd.iris.ai.intention+json
    Name Description Type
    id the intention identifier string
    name the intention name string
    questions examples of questions Question array
    countQuestions the number of questions int
    healthScore the health score double
    answers the answers Answer array
    storageDate the storage date DateTimeOffset
    IsDeleted check if is deleted bool

    MetricIndicators

    Represents the number of events in a range.

    MIME type
    application/vnd.iris.analytics.metric-indicators+json
    Name Description Type
    intervalStart the initial date of the interval DateTimeOffset
    intervalEnd the end date of the interval DateTimeOffset
    count the number of events in the range int

    Model

    Represents the complete AI model.

    MIME type
    application/vnd.iris.ai.model+json
    Name Description Type
    id the model id string
    culture the model culture code string
    provider the provider name string
    externalId the id of the model in the provider string
    intentions the model intentions Intention array
    entities the model associated entities Entity array
    JsonModel the json representation of the model string
    storageDate the storage date DateTimeOffset
    publishDate the publish date DateTimeOffset
    trainingDate the training date DateTimeOffset
    apiUri the provider api uri Uri
    status the model train status ModelStatus* enum
    WorkspaceId the workspace identifier string
    Version the model version for the workspace double

    * ModelStatus:
    - None = 0
    - Training = 1
    - Trained = 2
    - Published = 3
    - Deleted = 4

    ModelSummary

    Represents a model summary.

    MIME type
    application/vnd.iris.ai.model-summary+json
    Name Description Type
    intentionsCount the intentions count int
    intetionMinQuestions the amount of intentions with less than 10 questions int
    intentionsSummary the intentions summary IntentionSummary list
    median the current median double

    OAuthToken

    Represents information about an OAuth token.

    MIME type
    application/vnd.iris.oauth-token+json
    Name Description Type
    token_type the token type string
    expires_in the amount of minutes to the token expire int
    access_token the access token string
    refresh_token the refresh token string

    OpenTicketSummary

    Represents summary about open tickets.

    MIME type
    application/vnd.iris.desk.open-ticket-summary+json
    Name Description Type
    id the open ticket id string
    sequentialId the sequential id of a ticket int
    agentIdentity the agent identifier string
    customerIdentity the customer identifier string
    ownerUserIdentity the report owner user identity Identity
    team the team name string
    queueTime the queue time TimeSpan
    firstResponseTime the first time response TimeSpan
    attendanceTime the attendance time TimeSpan

    Plan

    Represents a plan of the account.

    MIME type
    application/vnd.iris.billing.plan+json
    Name Description Type
    ownerIdentity the plan identity Identity
    id the plan id string
    name the plan name string
    extras additional information about the plan IDictionary<string, string>

    Question

    Represents a question associated with an intent.

    MIME type
    application/vnd.iris.ai.question+json
    Name Description Type
    id the question id string
    text the question text string

    Report

    Represents an analytics report.

    MIME type
    application/vnd.iris.report+json
    Name Description Type
    id the unique report id string
    name the report name string
    isPrivate defines if the report is private bool
    modifiedAt the report modified at long
    ownerUserIdentity the report owner user identity Identity

    Resource

    Represents a reference to document resource.

    MIME type
    application/vnd.iris.resource+json
    Name Description Type
    key the resource identifier string
    variables the resource replacement variables IDictionary <string, string>

    ResponseTime

    Represents a response time.

    MIME type
    application/vnd.iris.response-time+json
    Name Description Type
    timeUnit the time unit (Miliseconds, seconds, minutes) TimeUnit
    value the response time long

    Role

    Represents a portal user role.

    MIME type
    application/vnd.iris.portal.role+json
    Name Description Type
    id the id of the role string
    description the description of the role string

    RolePermission

    Represents a portal user role permission.

    MIME type
    application/vnd.iris.portal.role-permission+json
    Name Description Type
    roleId the role identifier string
    permissionId the permission identifier string
    actions the action of the permission PermissionAction array

    Rule

    Represents an forward rule for agent messages.

    MIME type
    application/vnd.iris.desk.rule+json
    Name Description Type
    id the rule id string
    ownerIdentity the identity of the rule owner Identity
    title the title of the rule string
    property the envelope property that will be analysed string
    relation the relation between property and value RuleRelationEnum*
    isActive set if rule is active or not bool
    values value to be analysed for forwarding string array

    * RuleRelationEnum:
    - Contains = 0
    - NotContains = 1
    - Equals = 2
    - NotEquals = 3

    Schedules

    Represents a message schedule.

    MIME type
    application/vnd.iris.schedule+json
    Name Description Type
    name the schedule name string
    when the date the message should be sent DateTimeOffset
    message the schedule message Message
    status the schedule status ScheduleStatus*

    * ScheduleStatus:
    - scheduled
    - executed
    - canceled

    ServiceTimeSummary

    Represents a summary about desk service time.

    MIME type
    application/vnd.iris.desk.servicetimesummary+json
    Name Description Type
    serviceTime the service time TimeSpan

    Subscription (plan)

    Represents the account's subscription of a plan.

    MIME type
    application/vnd.iris.billing.subscription+json
    Name Description Type
    ownerIdentity the subscription owner identity Identity
    subscriber the identity of the subscriber Identity
    planId the plan id string
    startDate the subscription start date DateTimeOffset
    endDate the subscription end date DateTimeOffset
    lastChangeDate the date of the last change DateTimeOffset
    isPending define if is currently pending boolean
    isActive define if is currently active boolean
    extras additional information about the subscription IDicitionary<string,string>

    Subscription (resource)

    Represents a subscription to a resource.

    MIME type
    application/vnd.iris.subscription+json
    Name Description Type
    subscriber the subscriber Node
    resourceUri the resource uri LimeUri
    persistent define if persistent bool
    local define if local bool

    SubscriptionEvent

    Represents an event that occurred in a subscription.

    MIME type
    application/vnd.iris.billing.subscription-event+json
    Name Description Type
    id the event id string
    subscriptionId the subscription id string
    date the subscription id DateTimeOffset
    eventType the event type SubscriptionEventType*

    * SubscriptionEventType:
    - Activated
    - Canceled
    - setPending
    - unsetPending

    SubscriptionItem

    Represents an item associated to a subscription.

    MIME type
    application/vnd.iris.billing.subscription-item+json
    Name Description Type
    ownerIdentity the item’s owner identity Identity
    id the item id string
    subscriptionId the subscription id string
    startDate the start date DateTimeOffset

    TagTicketsSummary

    Represents a summary for tag tickets.

    MIME type
    application/vnd.iris.desk.tag-tickets-summary+json
    Name Description Type
    name the tag name string

    Team

    Represents an agent attendant team.

    MIME type
    application/vnd.iris.desk.team+json
    Name Description Type
    name the name of the team string
    agentsOnline the number of online agents on the team int

    TeamTicketsSummary

    Represents a summary for team tickets.

    MIME type
    application/vnd.iris.desk.teamticketssummary+json
    Name Description Type
    name the team name string
    waitingTickets the number of waiting tickets long
    openedTickets the number of opened tickets long

    Tenant

    Represents a tenant in Portal.

    MIME type
    application/vnd.iris.portal.tenant+json
    Name Description Type
    id The id of the tenant string
    name the name of the tenant string
    photoUri the uri of the image of the tenant string
    ownerIdentity The tenant's owner identity Identity
    paymentAccount The tenant's payment account Identity
    creationDate The tenant's creation date DateTimeOffset

    TenantInformation

    Represents a way to carry non sensitive information about a tenant.

    MIME type
    application/vnd.iris.portal.tenant-information+json
    Name Description Type
    id the id of the tenant string
    name the name of the tenant string
    photoUri the uri of the image of the tenant string

    TenantUserInformation

    Represents a information reguarding a single tenant user.

    MIME type
    application/vnd.iris.portal.tenant-user-information+json
    Name Description Type
    tenantId the id of the tenant string
    userIdentity the identity of the user Identity
    fullName the name of the user string
    creationDate the creation date DateTimeOffset
    updateDate the update date DateTimeOffset
    userStatus the status of the user TenantUserPossibleStatus*
    roleId the role identifier string

    * TenantUserPossibleStatus:
    - PendingTenant
    - PendingUser
    - Accepted
    - Rejected

    Thread

    Represents a conversation thread. A conversation thread could be a conversation, a message or a message group. It has the limitation of only returning messages stored in the last 3 months.

    Every thread must have an associated Account or Contact.

    MIME type
    application/vnd.iris.thread+json
    Name Description Type
    ownerIdentity the owner identity Identity
    identity the thread identity Identity
    lastMessages the last message ThreadMessage
    unreadMessages the number of unread messages long
    serviceIdentity the identity of the service Identity

    ThreadMessage

    Represents a thread message.

    MIME type
    application/vnd.iris.thread-message+json
    Name Description Type
    id the unique id string
    peerIdentity the peer identity Identity
    direction the direction of the message in the thread ThreadMessageDirection
    type the type of the message MediaType
    content the content of the message Document
    date the last update DateTimeOffset
    status the ticket message status Event
    reason the ticket message reason Reason
    metadata metadata of the message IDicitionary<string,string>

    Ticket

    Represents an attendance ticket.

    MIME type
    application/vnd.iris.ticket+json
    Name Description Type
    id the id of the ticket string
    sequentialId the ticket sequential id int
    routingOwnerIdentity if present, used instead of ownerIdentity Identity
    customerDomain the domain of customer string
    agentIdentity the agent identity Identity
    provider the name of the agent provider for ticket string
    status the ticket status TicketStatusEnum
    storageDate the ticket creation date DateTimeOffset
    expirationDate the ticket expiration date DateTimeOffset
    openDate the ticket open date DateTimeOffset
    closeDate the ticket close date DateTimeOffset
    statusDate the date of the last status DateTimeOffset
    externalId the providers ticket id string
    rating the ticket rating for the agent int
    team the ticket team string
    unreadMessages the number of unread messages long
    queuePosition the position of the ticket in the queue int
    closed define if the ticket is closed boolean
    closedBy the identity that closed the ticket Identity
    tags the tags of the ticket string array
    averageAgentResponseTime average agent response time double
    firstResponseDate time the agent take to send the first response DateTimeOffset
    firstResponseDate time the agent take to send the first response DateTimeOffset
    parentSequentialId the ticket sequential if when transfered int
    customerInput the customer input used to open the ticket DocumentContainer

    TicketsMetricsSummary

    Represents summary of tickets metrics.

    MIME type
    application/vnd.iris.desk.tickets-metrics-summary+json
    Name Description Type
    maxQueueTime the max queue time TimeSpan
    maxFirstResponseTime the max first response time TimeSpan
    avgQueueTime the average queue time TimeSpan
    avgWaitTime the average wait time TimeSpan
    avgResponseTime the average response time TimeSpan
    avgAttendanceTime the attendance time TimeSpan
    ticketsPerAttendant tickets per attendant string

    TicketsSummary

    Represents the summary of tickets values.

    MIME type
    application/vnd.iris.desk.ticketssummary+json
    Name Description Type
    date the ticket date DateTimeOffset
    waiting the amount of waiting tickets long
    open the amount of open tickets long
    closed the amount of closed tickets long
    closedAttendant the amount of closed by Attendant tickets long
    closedClient the amount of closed by client tcikets long
    transferred the amount of transferred tickets long
    missed the amount of missed tickets long

    Tunnels

    Represents a tunnel.

    MIME type
    application/vnd.iris.tunnel+json
    Name Description Type
    owner the tunnel owner identity Identity
    originator the original sender of the tunnel envelope Identity
    destination the destination which will receive envelopes from the tunnel Identity

    User

    Represents the portal user.

    MIME type
    application/vnd.iris.portal.user+json
    Name Description Type
    userIdentity the identity of the user account Identity
    creationDate the date of the creation of the user DateTimeOffset

    UserPermission

    Represents the Portal user permission.

    MIME type
    application/vnd.iris.portal.user-permission+json
    Name Description Type
    userIdentity the user identifier Identity
    permissionId the id of the permission string
    updateDate the date that the permission has last changed DateTimeOffset
    actions the action of the permission PermissionAction array

    UsersRequest

    Represents the user request for Analytics.

    MIME type
    application/vnd.analytics.users-request+json
    Name Description Type
    beginDate the begin date of the request DateTimeOffset
    endDate the end date of the request DateTimeOffset
    users the user request UserRequest
    events the analyzed events IEnumerable<EventRequest>

    WaitingTicketSummary

    Represents the summary about waiting tickets.

    MIME type
    application/vnd.iris.desk.waiting-ticket-summary+json
    Name Description Type
    id the waiting ticket id string
    sequentialId the sequential identifier int
    customerIdentity the customer identifier string
    team the team name string
    queueTime the queue time TimeSpan

    Wallet

    Represents a wallet.

    MIME type
    application/vnd.iris.billing.wallet+json
    Name Description Type
    id the wallet id string
    balance the wallet balance double
    lastChange the last modification date DateTimeOffset

    WalletTransaction

    Represents a billing transaction.

    MIME type
    application/vnd.iris.billing.wallet-transaction+json
    Name Description Type
    ownerIdentity the Identity of the account’s transaction Identity
    id the transaction id string
    walletId the wallet id string
    date the transaction date DateTimeOffset
    description description provided with transaction string
    type the type of the transaction TransactionType (credit, debit, refund)
    productId the product id string
    refundTransationId the id of the refund transaction string
    value the value of the transaction double
    extras additional information about the transaction IDictionary<string, string>

    Extensions

    Extensions are BLiP connected services that provide developers with different features for their chatbots. The extensions can receive commands and messages from the chatbots and execute special tasks, e.g. schedule or send a message broadcast. Through BLiP extensions the bot's developer can reuse a lot of code and focus only on bot's logic.

    As the other platform nodes, each extension has a unique address with postmaster@[identifier].msging.net format. The identifier value is the extension sub domain. Thus, to send commands and messages, use this address. If you don't know what is a command or how you can use this on BLiP, please go to Concepts > Commands section.

    Some extensions can require permission to send messages in name of the chatbot. The command delegation is used to grant this permission and must be sent to server with postmaster@msging.net address. To learn more details, check the delegation documentation.

    Event Analysis

    Analytics

    The analytics extension allows chatabot's metrics and event tracking in order to create analytics reports in the BLiP portal. The reports, metrics and graphs can be generated through the portal, in the Panel -> Analytics option.

    To use any feature of analytics extension, send a command with the following properties:

    Name Description
    id Unique identifier of the command.
    method The command verb.
    resource The analytics document.
    uris /event-track, /reports, /metrics or /statistics
    to postmaster@analytics.msging.net

    Create a chart in a report

    Add a charts in a specific report.

    Replace {reportId} with the report id you want to add a chart into.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "a43aa4d2-566a-4be0-bc51-38d43597eb58",
      "to": "postmaster@analytics.msging.net",
      "method": "set",
      "uri": "/reports/{reportId}/charts",
      "type": "application/vnd.iris.chart+json",
      "resource": {
            "id": "14444-2995-492b-ab18-016ef01055e55",
            "name": "My Users Metrics",
            "chartType": "pie",
            "dimension": "users",
            "category": "activeUsers",
            "order": 1
       }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.chart+json",
        "resource": {
            "id": "14444-2995-492b-ab18-016ef01055e55",
            "name": "My Users Metrics",
            "chartType": "pie",
            "dimension": "users",
            "category": "activeUsers",
            "order": 1
        },
        "method": "set",
        "status": "success",
        "id": "a43aa4d2-566a-4be0-bc51-38d43597eb58",
        "from": "postmaster@analytics.msging.net/#az-iris1",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "set",
        uri: "/reports/{reportId}/charts",
        type: "application/vnd.iris.chart+json",
        resource: {
            id: Lime.Guid(),
            name: "My Users Metrics",
            chartType: "pie",
            dimension: "users",
            category: "activeUsers",
            order: 1
       }
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Set,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports/{reportId}/charts"),
        Type: "application/vnd.iris.chart+json",
        Resource = new Chart {
            Id = EnvelopeId.NewId(),
            Name = "My Users Metrics",
            ChartType = "pie",
            Dimension = "users",
            Category = "activeUsers",
            Order = 1
        }
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Create an event

    Imagine that your chatbot must track the number of payment orders realized and show this data on a real time report. To make this possible you can register every single success order as an action of the payments category, creating an Event Track.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        method: Lime.CommandMethod.SET,
        type: 'application/vnd.iris.eventTrack+json',
        uri: '/event-track',
        resource: {
          category: 'billing',
          action: 'payment'
        }
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "1",
      "to": "postmaster@analytics.msging.net",
      "method": "set",
      "type": "application/vnd.iris.eventTrack+json",
      "uri": "/event-track",
      "resource": {
        "category": "payments",
        "action": "success-order"
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "set",
        "status": "success",
        "id": "1",
        "from": "postmaster@analytics.msging.net/#az-iris1",
        "to": "contact@msging.net",
        "metadata": {
            "#command.uri": "lime://contact@msging.net/event-track"
        }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.EventTracker;
    
    namespace Extensions
    {
        public class SampleMessageReceiver : IMessageReceiver
        {
            private readonly IEventTrackExtension _eventTrackExtension;
    
            public SampleMessageReceiver(IEventTrackExtension eventTrackExtension)
            {
                _eventTrackExtension = eventTrackExtension;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                await _eventTrackExtension.AddAsync("payments", "success-order", contact: null, extras: null, cancellationToken: cancellationToken);
            }
        }
    }
    

    Create a report

    Create a new report.

    You must send a report document, informing your data.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "tgawe1231-abab486",
      "to": "postmaster@analytics.msging.net",
      "method": "set",
      "uri": "/reports",
      "type": "application/vnd.iris.report+json",
      "resource": {
        "id": "d0b4f58a-664c-4c46-8d07-016ef5d5788ec",
        "name": "Testing",
        "isPrivate": true,
        "ownerUserIdentity": "jonh%40email.net@blip.ai"
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.report+json",
        "resource": {
            "id": "d0b4f58a-664c-4c46-8d07-016ef5d5788ec",
            "name": "Testing 2",
            "isPrivate": false
        },
        "method": "set",
        "status": "success",
        "id": "5eb2c731-77e7-4506-bef0-7163c66810d5",
        "from": "postmaster@analytics.msging.net/#az-iris6",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "set",
        uri: "/reports"
        type: "application/vnd.iris.report+json",
        resource: {
            id: Lime.Guid(),
            name: "Testing",
            isPrivate: true,
            ownerIdentity: "jonh%40email.net@blip.ai"
        }
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Set,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports"),
        Type: "application/vnd.iris.report+json",
        Resource = new Report{
            Id: EnvelopeId.NewId(),
            Name = "Testing",
            IsPrivate = true,
            OwnerIdentity: "jonh%40email.net@blip.ai"
        }
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Create event with contact

    client.addMessageReceiver('text/plain', async (message) => {
        await client.sendCommand({
            id: Lime.Guid(),
            method: Lime.CommandMethod.SET,
            type: 'application/vnd.iris.eventTrack+json',
            uri: '/event-track',
            resource: {
                category: 'billing',
                action: 'payment',
                contact: {
                    identity: '123456@messenger.gw.msging.net'
                }
            }
        });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "9494447a-2581-4597-be6a-a5dff33af156",
        "to": "postmaster@analytics.msging.net",
        "method": "set",
        "type": "application/vnd.iris.eventTrack+json",
        "uri": "/event-track",
        "resource": {
            "category": "payments",
            "action": "success-order",
            "contact": { 
                "identity": "123456@messenger.gw.msging.net"
            }
        }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "set",
        "status": "success",
        "id": "9494447a-2581-4597-be6a-a5dff33af156",
        "from": "postmaster@analytics.msging.net/#az-iris4",
        "to": "contact@msging.net",
        "metadata": {
            "#command.uri": "lime://contact@msging.net/event-track"
        }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.EventTracker;
    
    namespace Extensions
    {
        public class SampleMessageReceiver : IMessageReceiver
        {
            private readonly IEventTrackExtension _eventTrackExtension;
    
            public SampleMessageReceiver(IEventTrackExtension eventTrackExtension)
            {
                _eventTrackExtension = eventTrackExtension;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                await _eventTrackExtension.AddAsync("payments", "success-order", identity: new Identity("123456", "messenger.gw.msging.net"));
            }
        }
    }
    

    It is possible to associate a specific contact in an event. You can use this to ignore events of a tester user for example. If your bot has a 123456@messenger.gw.msging.net contact identity as a tester user, you can ignore all of its tracked events by adding this identity to the event resource object.

    Delete a chart

    Delete a specific chart from a specific report.

    Replace {reportId} with the report id you want to delete the chart from. Replace {chartId} with the chart id you want to delete.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "50da3293-371b-4ab8-b264-6812aa40895d",
      "to": "postmaster@analytics.msging.net",
      "method": "delete",
      "uri": "/reports/{reportId}/charts/{chartId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "delete",
        "status": "success",
        "id": "50da3293-371b-4ab8-b264-6812aa40895d",
        "from": "postmaster@analytics.msging.net/#az-iris4",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "delete",
        uri: "/reports/{reportId}/charts/{chartId}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Delete,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports/{reportId}/charts/{chartId}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Delete a report

    If you need to delete a specific report use the following command.

    Remember to replace {reportId} with the report id you want delete.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "25aad309-5336-4a1c-be26-4b69bfeef554",
      "to": "postmaster@analytics.msging.net",
      "method": "delete",
      "uri": "/reports/{reportId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "delete",
        "status": "success",
        "id": "25aad309-5336-4a1c-be26-4b69bfeef554",
        "from": "postmaster@analytics.msging.net/#az-iris3",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "delete",
        uri: "/reports/{reportId}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports/{reportId}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Delete an event category

    If you need to delete a specific event category use the following command. Remember to replace {categoryName} variable for the category name that you want delete.

    client.addMessageReceiver('text/plain', async (message) => {
        await client.sendCommand({
           id: Lime.Guid(),
           to: "postmaster@analytics.msging.net",
           method: Lime.CommandMethod.DELETE,
           uri: "/event-track/{categoryName}"
        });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "6",
      "to": "postmaster@analytics.msging.net",
      "method": "delete",
      "uri": "/event-track/{categoryName}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "delete",
        "status": "success",
        "id": "6",
        "from": "postmaster@analytics.msging.net/#az-iris3",
        "to": "contact@msging.net",
        "metadata": {
            "#command.uri": "lime://contact@msging.net/event-track/{categoryName}"
        }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extensions
    {
        public class SampleMessageReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public SampleMessageReceiver(ISender sender)
            {
                _sender = sender;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Delete,
                    Uri = new LimeUri("/event-track/{categoryName}")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);
            }
        }
    }
    

    Get active messages

    Get the metrics of active messages by an interval.

    Replace {interval} with the date interval you want to get the metrics.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "320c2b30-aaf3-4549-85fa-bddb3389022f",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/metrics/active-messages/{interval}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 2,
            "itemType": "application/vnd.iris.analytics.metric-indicators+json",
            "items": [
                {
                    "intervalStart": "2019-11-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-05T03:00:00.000Z",
                    "count": 7
                },
                {
                    "intervalStart": "2019-12-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-10T03:00:00.000Z",
                    "count": 0
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "541a4c6a-77c5-4928-a0e3-af79cfc77ad3",
        "from": "postmaster@analytics.msging.net/#az-iris7",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/metrics/active-messages/{interval}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/metrics/active-messages/{interval}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Your interval must have one of this statistics interval:

    Interval Description QueryString
    Daily Statistics collected at each day D?startDate=DATE&endDate=DATE
    Monthly Statistics collected at each month M?startDate=DATE&endDate=DATE
    NoInterval Statistics collected with no interval NI?startDate=DATE&endDate=DATE

    Get all reports

    Get a collection of reports.

    QueryString Description Example
    $skip The number of elements to be skipped. 0
    $take Limit of total of items to be returned. 100
    $ascending Sets ascending alphabetical order. true
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "aba9899-a4as4d5asd4-aaabb",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/reports"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 2,
            "itemType": "application/vnd.iris.report+json",
            "items": [
                {
                    "id": "77ce265f-e7f2-4fb0-9b9c-016e7f6682b0",
                    "isPrivate": true,
                    "modifiedAt": 1574095454859,
                    "ownerUserIdentity": "john%40email.net@blip.ai"
                },
                {
                    "id": "b6db6c73-f1ad-4891-b100-016d681e8257",
                    "name": "Testing",
                    "isPrivate": false,
                    "modifiedAt": 1574078756205,
                    "ownerUserIdentity": "john%40email.net@blip.ai"
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "9f6bfb32-d89d-4093-8f42-32934fc30273",
        "from": "postmaster@analytics.msging.net/#az-iris5",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/reports"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Get a report

    Get a specific report by id.

    Replace {reportId} with the report id you want to get.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "ty8a9b4a-q98b1a5s-a9s0",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/reports/{reportId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.report+json",
        "resource": {
            "id": "7644-4f75-8ff7-016efc0",
            "name": "Testing",
            "isPrivate": false
        },
        "method": "get",
        "status": "success",
        "id": "e9f2c31e-caaa-4e9b-a498-02d7980b8dc3",
        "from": "postmaster@analytics.msging.net/#az-iris5",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/reports/{reportId}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports/{reportId}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Get active users

    Get the metrics of active users by an interval.

    Replace {interval} with the date interval you want to get the metrics.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "880e6454-65e0-44ad-b2f4-7a4f3a5149c5",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/metrics/active-identity/{interval}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 5,
            "itemType": "application/vnd.iris.analytics.metric-indicators+json",
            "items": [
                {
                    "intervalStart": "2019-12-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-06T03:00:00.000Z",
                    "count": 1
                },
                {
                    "intervalStart": "2019-12-06T03:00:00.000Z",
                    "intervalEnd": "2019-12-07T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-07T03:00:00.000Z",
                    "intervalEnd": "2019-12-08T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-08T03:00:00.000Z",
                    "intervalEnd": "2019-12-09T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-09T03:00:00.000Z",
                    "intervalEnd": "2019-12-10T03:00:00.000Z",
                    "count": 0
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "f792891e-2b1e-4caf-9649-9256c900ac65",
        "from": "postmaster@analytics.msging.net/#az-iris4",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/metrics/active-identity/{interval}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/metrics/active-identity/{interval}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Your interval must have one of this statistics interval:

    Interval Description QueryString
    Daily Statistics collected at each day D?startDate=DATE&endDate=DATE
    Monthly Statistics collected at each month M?startDate=DATE&endDate=DATE
    NoInterval Statistics collected with no interval NI?startDate=DATE&endDate=DATE

    Get categories

    client.addMessageReceiver('text/plain', async (message) => {
        var categories = await client.sendCommand({
            id: Lime.Guid(),
            method: Lime.CommandMethod.GET,
            uri: '/event-track'
        });
        categories.resource.items.forEach(function (item) {
            console.log(item);
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "3",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/event-track"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "itemType": "application/vnd.iris.eventTrack+json",
            "items": [
                {
                    "category": "accounts"
                },
                {
                    "category": "payments"
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "3",
        "from": "postmaster@analytics.msging.net/#az-iris5",
        "to": "contact@msging.net",
        "metadata": {
            "#command.uri": "lime://contact@msging.net/event-track"
        }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.EventTracker;
    
    namespace Extensions
    {
        public class SampleMessageReceiver : IMessageReceiver
        {
            private readonly IEventTrackExtension _eventTrackExtension;
    
            public SampleMessageReceiver(IEventTrackExtension eventTrackExtension)
            {
                _eventTrackExtension = eventTrackExtension;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                var events = await _eventTrackExtension.GetCategoriesAsync();
            }
        }
    }
    

    Retrieves all tracked categories.

    QueryString Description Example
    $skip The number of elements to be skipped. 0
    $take Limit of total of items to be returned. 100

    Get charts in a report

    Get a collection of charts in a report.

    Replace {reportId} with the report id you want to get the charts in.

    QueryString Description Example
    $skip The number of elements to be skipped. 0
    $take Limit of total of items to be returned. 100
    $ascending Sets ascending alphabetical order. true
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "751a2c4b9a-5as68as8-b4a8w9q",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/reports/{reportId}/charts"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 1,
            "itemType": "application/vnd.iris.chart+json",
            "items": [
                {
                    "id": "39465840-2995-492b-ab18-016ef5fd5e55",
                    "name": "My Users Metrics",
                    "chartType": "list",
                    "dimension": "users",
                    "category": "activeUsers",
                    "order": 0
                }
            ]
        },
        "method": "get",
        "status": "success",
        "from": "postmaster@analytics.msging.net/#az-iris3",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/reports/{reportId}/charts"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports/{reportId}/charts")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Get counters

    client.addMessageReceiver('text/plain', async (message) => {
      var events = await client.sendCommand({
        id:Lime.Guid(),
        method: Lime.CommandMethod.GET,
        uri: '/event-track/payments?startDate=2019-06-21&endDate=2019-06-28&$take=10'
      });
      events.resource.items.forEach(function (item) {
        console.log(item);
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "4",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/event-track/payments?startDate=2019-06-21&endDate=2019-06-28&$take=10"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "type": "application/vnd.lime.collection+json",
      "resource": {
        "itemType": "application/vnd.iris.eventTrack+json",
        "items": [
          {
            "storageDate": "2019-06-25T03:00:00.000Z",
            "category": "payments",
            "action": "success-order",
            "count": "4"
          },
          {
            "storageDate": "2019-06-24T03:00:00.000Z",
            "category": "payments",
            "action": "success-order",
            "count": "1"
          }
        ]
      },
      "method": "get",
      "status": "success",
      "id": "4",
      "from": "postmaster@analytics.msging.net/#az-iris5",
      "to": "contact@msging.net",
      "metadata": {
        "#command.uri": "lime://contact@msging.net/event-track/payments?startDate=2019-06-21&endDate=2019-06-28&$take=10"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.EventTracker;
    using System;
    
    namespace Extensions
    {
        public class SampleMessageReceiver : IMessageReceiver
        {
            private readonly IEventTrackExtension _eventTrackExtension;
    
            public SampleMessageReceiver(IEventTrackExtension eventTrackExtension)
            {
                _eventTrackExtension = eventTrackExtension;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                var startDate = new DateTimeOffset(2019, 6, 21, 0, 0, 0, default(TimeSpan));
                var endDate = new DateTimeOffset(2019, 6, 28, 15, 27, 0, default(TimeSpan));
                var take = 10;
    
                var events = await _eventTrackExtension.GetCategoryActionsCounterAsync(startDate, endDate, "payments", take);
            }
        }
    }
    

    To retrieve all counters of a category, add the category name to the command uri (for instance /event-track/payments). Those counters represent the number of events tracked in a specific pair of action and categories grouped by days. It is also possible to add query strings parameters as request filters. The following filters are available:

    QueryString Description
    $take Limit of total of items to be returned.
    startDate Initial date to search for events.
    endDate Limit date to retrieve the events.

    Get details

    client.addMessageReceiver('text/plain', async (message) => {
      var events = await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@analytics.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/event-track/payments/success-order?startDate=2019-06-21&endDate=2019-06-28&$take=10'
      });
      events.resource.items.forEach(function (item) {
        console.log(item);
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "5",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/event-track/payments/success-order?startDate=2019-06-21&endDate=2019-06-28&$take=10"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 5,
            "itemType": "application/vnd.iris.eventTrack+json",
            "items": [
                {
                    "category": "payments",
                    "action": "success-order",
                    "storageDate": "2016-01-01T12:30:00.000Z",
                    "extras": {
                        "expiration": "2015-12-30",
                        "customerId": "199213"
                    }   
                },
                {
                    "category": "payments",
                    "action": "success-order",
                    "storageDate": "2016-01-02T09:15:00.000Z",
                    "extras": {
                        "expiration": "2016-01-01",
                        "customerId": "4123123"
                    }
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "5",
        "from": "postmaster@analytics.msging.net/#az-iris2",
        "to": "contact@msging.net",
        "metadata": {
            "#command.uri": "lime://contact@msging.net/event-track/payments/success-order?startDate=2019-06-21&endDate=2019-06-28&$take=10"
        }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.EventTracker;
    using System;
    
    namespace Extensions
    {
        public class SampleMessageReceiver : IMessageReceiver
        {
            private readonly IEventTrackExtension _eventTrackExtension;
    
            public SampleMessageReceiver(IEventTrackExtension eventTrackExtension)
            {
                _eventTrackExtension = eventTrackExtension;
            }
    
            public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
            {
                var startDate = new DateTimeOffset(2019, 6, 21, 0, 0, 0, default(TimeSpan));
                var endDate = new DateTimeOffset(2019, 6, 28, 15, 27, 0, default(TimeSpan));
    
                var events = await _eventTrackExtension.GetAllAsync(startDate, endDate, "payments", "success-order", 0, 20, cancellationToken);
            }
        }
    }
    

    Retrieves all events tracked with a specific pair of action and categories. The following filters are available as possible query strings:

    QueryString Description
    $skip Number of items to be skipped for paging.
    $take Limit of total of items to be returned.
    startDate Initial date to search for events.
    endDate Limit date to retrieve the events.

    Get engaged users

    Get the metrics of engaged users by an interval.

    Replace {interval} with the date interval you want to get the metrics.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "880e6454-65e0-44ad-b2f4-7a4f3a5149c5",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/metrics/engaged-identity/{interval}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 5,
            "itemType": "application/vnd.iris.analytics.metric-indicators+json",
            "items": [
                {
                    "intervalStart": "2019-12-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-06T03:00:00.000Z",
                    "count": 1
                },
                {
                    "intervalStart": "2019-12-06T03:00:00.000Z",
                    "intervalEnd": "2019-12-07T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-07T03:00:00.000Z",
                    "intervalEnd": "2019-12-08T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-08T03:00:00.000Z",
                    "intervalEnd": "2019-12-09T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-09T03:00:00.000Z",
                    "intervalEnd": "2019-12-10T03:00:00.000Z",
                    "count": 0
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "f792891e-2b1e-4caf-9649-9256c900ac65",
        "from": "postmaster@analytics.msging.net/#az-iris4",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/metrics/engaged-identity/{interval}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/metrics/engaged-identity/{interval}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Your interval must have one of this statistics interval:

    Interval Description QueryString
    Daily Statistics collected at each day D?startDate=DATE&endDate=DATE
    Monthly Statistics collected at each month M?startDate=DATE&endDate=DATE
    NoInterval Statistics collected with no interval NI?startDate=DATE&endDate=DATE

    Get received messages

    Get the metrics of received messages by an interval.

    Replace {interval} with the date interval you want to get the metrics.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "320c2b30-aaf3-4549-85fa-bddb3389022f",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/metrics/received-messages/{interval}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 2,
            "itemType": "application/vnd.iris.analytics.metric-indicators+json",
            "items": [
                {
                    "intervalStart": "2019-11-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-05T03:00:00.000Z",
                    "count": 16
                },
                {
                    "intervalStart": "2019-12-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-10T03:00:00.000Z",
                    "count": 2
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "621ffd0b-6dfd-4bb2-a01d-d1f4021e9702",
        "from": "postmaster@analytics.msging.net/#az-iris4",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/metrics/received-messages/{interval}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/metrics/received-messages/{interval}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Your interval must have one of this statistics interval:

    Interval Description QueryString
    Daily Statistics collected at each day D?startDate=DATE&endDate=DATE
    Monthly Statistics collected at each month M?startDate=DATE&endDate=DATE
    NoInterval Statistics collected with no interval NI?startDate=DATE&endDate=DATE

    Get sent messages

    Get the metrics of sent messages by an interval.

    Replace {interval} with the date interval you want to get the metrics.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "320c2b30-aaf3-4549-85fa-bddb3389022f",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/metrics/sent-messages/{interval}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 5,
            "itemType": "application/vnd.iris.analytics.metric-indicators+json",
            "items": [
                {
                    "intervalStart": "2019-12-05T03:00:00.000Z",
                    "intervalEnd": "2019-12-06T03:00:00.000Z",
                    "count": 2
                },
                {
                    "intervalStart": "2019-12-06T03:00:00.000Z",
                    "intervalEnd": "2019-12-07T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-07T03:00:00.000Z",
                    "intervalEnd": "2019-12-08T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-08T03:00:00.000Z",
                    "intervalEnd": "2019-12-09T03:00:00.000Z",
                    "count": 0
                },
                {
                    "intervalStart": "2019-12-09T03:00:00.000Z",
                    "intervalEnd": "2019-12-10T03:00:00.000Z",
                    "count": 0
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "320c2b30-aaf3-4549-85fa-bddb3389022f",
        "from": "postmaster@analytics.msging.net/#az-iris7",
        "to": "demobot@msging.net",
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "get",
        uri: "/metrics/sent-messages/{interval}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/metrics/sent-messages/{interval}")
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Your interval must have one of this statistics interval:

    Interval Description QueryString
    Daily Statistics collected at each day D?startDate=DATE&endDate=DATE
    Monthly Statistics collected at each month M?startDate=DATE&endDate=DATE
    NoInterval Statistics collected with no interval NI?startDate=DATE&endDate=DATE

    Update a chart in a report

    You can update a specific chart in a report.

    Replace {reportId} with the report id you want to update the chart into. Replace {chartId} with the chart id you want to update.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "a43aa4d2-566a-4be0-bc51-38d43597eb58",
      "to": "postmaster@analytics.msging.net",
      "method": "set",
      "uri": "/reports/{reportId}/charts/{chartId}",
      "type": "application/vnd.iris.chart+json",
      "resource": {
            "id": "{chartId}",
            "name": "My Users Metrics",
            "chartType": "list",
            "dimension": "users",
            "category": "activeUsers",
            "order": 1
       }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "set",
        "status": "success",
        "id": "d5b1c796-38cc-48ed-80e2-af261c31046d",
        "from": "postmaster@analytics.msging.net/#az-iris1",
        "to": "demobot@msging.net"
    }
    
    client.sendCommand({
        id: Lime.Guid(),
        to: "postmaster@analytics.msging.net",
        method: "set",
        uri: "/reports/{reportId}/charts/{chartId}",
        type: "application/vnd.iris.chart+json",
        resource: {
            id: "{chartId}",
            name: "My Users Metrics",
            chartType: "pie",
            dimension: "users",
            category: "activeUsers",
            order: 1
       }
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Set,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/reports/{reportId}/charts/{chartId}"),
        Type: "application/vnd.iris.chart+json",
        Resource = new Chart {
            Id = "{chartId}",
            Name = "My Users Metrics",
            ChartType = "pie",
            Dimension = "users",
            Category = "activeUsers",
            Order = 1
        }
    };
    var result = await _sender.ProcessCommandAsync(command, cancellationToken);
    }
    

    Artificial Intelligence

    Address
    postmaster@ai.msging.net

    The Artificial Intelligence extension allows the creation, training and publication of artificial intelligence models in the providers associated with the chatbot, besides performing sentence analysis to identify intents and entities. The configuration of the chatbot providers is done through the Artificial Intelligence menu in the BLiP portal.

    You can associate response documents with the model that should be submitted when an intent is matched in a sentence. In addition, the extension can be used to improve the model by associating questions with intents.

    The training of the model is performed simultaneously on all of the AI ​​providers associated with chatbot. In that case, a snapshot of the model is stored and can be retrieved later to compare its effectiveness with other versions. To use a trained template, you must publish it.

    All manipulation of the model can be done through the portal of the BLiP, and this extension can be used only to perform the analysis of sentences of the users of the chabot.

    API Resources

    URI Method Description
    /intentions set Creates a new intent. The id of the intent is returned in the command response.
    /intentions get Search in all intents that are associated to the chatbot. It is possible to paginate the request using $skip and $take arguments.
    /intentions/{id} get Retrieves an intent by its id.
    /entities set Creates a new entity. The id of the entity is returned in the command response.
    /entities get Search in all entities that are associated to the chatbot. It is possible to paginate the request using $skip and $take arguments.
    /entities/{id} get Retrieves an entity by its id.
    /intentions/{id}/questions set Create questions associated to the intent id.
    /intentions/{id}/questions get Search in all questions that are associated to the intent id. It is possible to paginate the request using $skip and $take arguments.
    /intentions/{id}/questions/{qid} delete Removes the question with id qid.
    /intentions/{id}/answers set Create answers associated to the intent id.
    /intentions/{id}/answers get Search in all answers that are associated to the intent id. It is possible to paginate the request using $skip and $take arguments.
    /intentions/{id}/answers/{aid} delete Removes the answer with id aid.
    /models set Executes the training or publishing of the model. The action depends of the type of the resource (see the table below).
    /models get Search in all trained and/or published models.
    /analysis set Analyzes an user sentence using a published model.
    /analysis get Retrieves the history of performed analysis. It is possible to paginate the request using using $skip and $take arguments and filter with $filter, using the OData syntax.
    /analysis/{id}/feedback set Provides feedback to a performed analysis and suggest an intent to improve the model.
    /content get Search in all contents that are assosiated to the chatbot. It is possible to paginate the request using $skip and $take arguments.
    /content/analysis set Creates a new content analisys.
    /content/{id} get Retrieves a content by its id.
    /content/{id} set Creates a new content with a specified id.
    /content/{id} delete Removes a content with id {id}.
    /content set Creates a new content.
    /content delete Removes multiple contents that are associated to the chatbot.

    The resource types are:

    Name MIME Type Description
    Intent application/vnd.iris.ai.intention+json Intent expressed through a sentence.
    Entity application/vnd.iris.ai.entity+json Entity identified in an intent, with its synonyms.
    Question application/vnd.iris.ai.question+json A user's question that is associated with an intent for model training.
    Answer application/vnd.iris.ai.answer+json Response that can be sent in case a user's intent is identified.
    Training application/vnd.iris.ai.model-training+json Model training request.
    Publishing application/vnd.iris.ai.model-publishing+json Model publishing request, to make it available for use.
    Analysis request application/vnd.iris.ai.analysis-request+json Sentence analysis request.
    Analysis response application/vnd.iris.ai.analysis-response+json Sentence analysis response with the identified intents and entities.
    Analysis application/vnd.iris.ai.analysis+json History information about a performed analysis.
    Analysis feedback application/vnd.iris.ai.analysis-feedback+json Feedback information about a performed analysis.
    Content result application/vnd.iris.ai.content-result+json The content created.

    Analyze a model

    Retrieves the history of performed analysis. It will return an analysis document.

    The following uri filters are available to get an analysis:

    QueryString Description Example
    skip The number of analysis to be skipped. 0
    take The number of analysis to be returned. 100
    ascending Sets ascending alphabetical order. true
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "57",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/analysis"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 2,
            "itemType": "application/vnd.iris.ai.analysis+json",
            "items": [
                {
                    "id": "fedf4c07-02e9-4c3f-8efa-016d3a896cba",
                    "requestDateTime": "2019-09-16T14:45:47.110Z",
                    "text": "I need help",
                    "intention": "none",
                    "score": 1.0,
                    "intentions": [
                        {
                            "id": "none",
                            "score": 1.0
                        }
                    ],
                    "entities": [],
                    "messageSource": "Test",
                    "userIdentity": "JohnDoe@email.net"
                },
                {
                    "id": "40118f04-e678-4d19-a1d9-016d3a8930d6",
                    "requestDateTime": "2019-09-16T14:45:32.180Z",
                    "text": "oi",
                    "intention": "none",
                    "score": 1.0,
                    "intentions": [
                        {
                            "id": "none",
                            "score": 1.0
                        }
                    ],
                    "entities": [],
                    "messageSource": "Test",
                    "userIdentity": "JohnDoe@email.net"
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "83d99e0c-ed5e-4727-a26e-7b988426a43b",
        "from": "postmaster@ai.msging.net/#az-iris5",
        "to": "demobot@msging.net"
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/analysis'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Set,
                    Uri = new LimeUri("/analysis")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken)
            }
        }
    }
    

    Analyze a sentence in the last published model

    Analyzes an user sentence using a last published model.

    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Set,
                    Uri = new LimeUri("/analysis"),
                    Type = 'application/vnd.iris.ai.analysis-request+json',
                    Resource = new AnalysisRequest {
                      Text = 'I want a pepperoni pizza'
                    }
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/analysis',
        type: 'application/vnd.iris.ai.analysis-request+json',
        resource: {
          text: 'I want a pepperoni pizza'
        }
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "9",
      "to": "postmaster@ai.msging.net",
      "method": "set",
      "uri": "/analysis",
      "type": "application/vnd.iris.ai.analysis-request+json",
      "resource": {
        "text":"I want a pepperoni pizza"
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "id": "9",
      "from": "postmaster@ai.msging.net/#irismsging1",
      "to": "contact@msging.net/default",
      "method": "set",
      "status": "success",
      "type": "application/vnd.iris.ai.analysis-response+json",
      "resource": {
        "text":"I want a pepperoni pizza",
        "intentions":[
          {
            "id":"order_pizza",
            "name":"Order pizza",
            "score": 0.95
          }
        ],
        "entities":[
          {
            "id":"flavor",
            "name":"Flavor",
            "value":"Pepperoni"
          }
        ]
      }
    }
    

    Analyze a sentence with a specific model

    It is possible to analyze a sentence with a specific model, to improve the model.

    client.addMessageReceiver('text/plain', async (message) => {
      var result = await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/analysis',
        type: 'application/vnd.iris.ai.analysis-request+json',
        resource: {
          text: 'I want a pepperoni pizza',
          modelId: '12345'
        }
      });
    
      result.resource.intentions.forEach(function (intent) {
        console.log(intent);
      });
    
      result.resource.entities.forEach(function (entity) {
        console.log(entity);
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "10",
      "to": "postmaster@ai.msging.net",
      "method": "set",
      "uri": "/analysis",
      "type": "application/vnd.iris.ai.analysis-request+json",
      "resource": {
        "text":"I want a pepperoni pizza",
        "modelId":"12345"
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "type": "application/vnd.iris.ai.analysis-response+json",
      "resource": {
        "id": "456789",
        "text": "i want a pepperoni pizza",
        "intentions": [
          {
            "id": "order_pizza",
            "name": "Order pizza",
            "score": 0.5535872,
            "answer": {
              "id": "1",
              "type": "text/plain",
              "value": "Which flavor do you want?"
            }
          }
        ],
        "entities": [
          {
            "id": "flavor",
            "name": "Flavor",
            "value": "pepperoni"
          }
        ],
        "provider": "Dialogflow",
        "modelId": "12345"
      },
      "method": "set",
      "status": "success",
      "id": "10",
      "from": "postmaster@ai.msging.net/#az-iris4",
      "to": "contact@msging.net",
      "metadata": {
        "#command.uri": "lime://contact@msging.net/analysis"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver10 : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver10(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var analysisRequest = new AnalysisRequest{
                    Text = "I want a pepperoni pizza",
                    ModelId = "12345"
                };
    
                var result = await _artificialIntelligenceExtension.AnalyzeAsync(analysisRequest, cancellationToken);
            }
        }
    }
    

    Associate answers to an intent

    Associating possible answers to send an intent.

    Replace {intentId} with the intent id you want to associate with.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/intentions/{intentId}/answers',
        type: 'application/vnd.lime.collection+json',
        resource: {
          itemType: 'application/vnd.iris.ai.answer+json',
          items: [
            {
              type: 'text/plain',
              value: 'Which flavor do you want?'
            }
          ]
        }
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "5",
      "to": "postmaster@ai.msging.net",
      "method": "set",
      "uri": "/intentions/{intentId}/answers",
      "type": "application/vnd.lime.collection+json",
      "resource": {
        "itemType": "application/vnd.iris.ai.answer+json",
        "items":[
          {
            "type":"text/plain",
            "value":"Which flavor do you want?"
          }
        ]
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "method": "set",
      "status": "success",
      "id": "5",
      "from": "postmaster@ai.msging.net/#az-iris1",
      "to": "contact@msging.net"
    }
    
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var intentId = "{intentId}";
    
                var answers = new List<Answer>(){ new Answer{ Value = "Which flavor do you want?" } };
    
                await _artificialIntelligenceExtension.SetAnswersAsync(intentId, answers, cancellationToken);
            }
        }
    }
    

    Associate questions to an intent

    Associating examples of questions to an intent. A variety of examples may be added to train the artificial intelligence model.

    Replace {intentId} with the intent id you want to associate with.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/intentions/{intentId}/questions',
        type: 'application/vnd.lime.collection+json',
        resource: {
          itemType: 'application/vnd.iris.ai.question+json',
          items: [
            {
              text: 'I want a pizza'
            },
            {
              text: 'I wanna order a pizza'
            },
            {
              text: 'Give me a pizza'
            }
          ]
        }
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "4",
      "to": "postmaster@ai.msging.net",
      "method": "set",
      "uri": "/intentions/{intentId}/questions",
      "type": "application/vnd.lime.collection+json",
      "resource": {
        "itemType": "application/vnd.iris.ai.question+json",
        "items":[
          {
            "text": "I want a pizza"
          },
          {
            "text": "I wanna order a pizza"
          },
          {
            "text": "Give me a pizza"
          }
        ]
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "method": "set",
      "status": "success",
      "id": "4",
      "from": "postmaster@ai.msging.net/#az-iris5",
      "to": "contact@msging.net"
    }
    
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var intentId = "{intentId}";
    
                var questions = new List<Question>(){
                    new Question{ Text = "I want a pizza" },
                    new Question{ Text = "I wanna order a pizza" },
                    new Question{ Text = "Give me a pizza" }
                };
    
                await _artificialIntelligenceExtension.SetQuestionsAsync(intentId, questions, cancellationToken);
            }
        }
    }
    

    Create a confusion matrix

    Create a confusion matrix into your model.

    Replace version and sampleSize with the values you want.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: "/analytics/confusion-matrix",
        type: "application/vnd.iris.ai.confusion-matrix+json",
        resource: {
            version: "test",
            sampleSize: 2
        }
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Set,
                    Uri = new LimeUri("/analytics/confusion-matrix")
                    Type= "application/vnd.iris.ai.confusion-matrix+json",
                    Resource = new ConfusionMatrix{
                      Version = "teste",
                      SampleSize = 2
                    }
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "10",
        "to": "postmaster@ai.msging.net",
        "method": "set",
        "uri": "/analytics/confusion-matrix",
        "type": "application/vnd.iris.ai.confusion-matrix+json",
        "resource": {
            "version": "teste",
            "sampleSize": 2
        }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.ai.confusion-matrix+json",
        "resource": {
            "OwnerIdentity": "botbot1@msging.net",
            "id": "d0b71e41-897c-48c4-a565-29d227013111",
            "modelId": "botbot1_543659e7-902a-4326-8a2e-016adbc4b100",
            "version": "teste",
            "score": 0,
            "sampleSize": 2,
            "createdDate": "2019-05-30T17:22:02.139Z",
            "accuracy": 0,
            "avgScore": 0,
            "precision": 0,
            "recall": 0,
            "f1Score": 0,
            "numberOfSamples": 0
        },
        "method": "set",
        "status": "success",
        "id": "10",
        "from": "postmaster@ai.msging.net/#hmg-az-lx-iris2",
        "to": "botbot1@msging.net",
        "metadata": {
            "#command.uri": "lime://botbot1@msging.net/analytics/confusion-matrix"
        }
    }
    

    Create an entity

    Defining the entities present in user phrases, using the Entity document.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/entities',
        type: 'application/vnd.iris.ai.entity+json',
        resource: {
          name: 'Flavor',
          values: [
            {
              name: 'Pepperoni',
              synonymous: [
                'Peperoni',
                'Pepperonee',
                'Pepperouni',
                'Peperony'
              ]
            },
            {
              name: 'Mushrooms',
              synonymous: [
                'Mashrooms',
                'Mushroom',
                'Mshrooms'
              ]
            }
          ]
        }
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "1",
      "to": "postmaster@ai.msging.net",
      "method": "set",
      "uri": "/entities",
      "type": "application/vnd.iris.ai.entity+json",
      "resource": {
        "name": "Flavor",
        "values": [
          {
            "name": "Pepperoni",
            "synonymous": [
              "Peperoni",
              "Pepperonee",
              "Pepperouni",
              "Peperony"
            ]
          },
          {
            "name": "Mushrooms",
            "synonymous": [
              "Mashrooms",
              "Mushroom",
              "Mshrooms"
            ]
          }
        ]
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "type": "application/vnd.iris.ai.entity+json",
      "resource": {
        "id": "flavor"
      },
      "method": "set",
      "status": "success",
      "id": "1",
      "from": "postmaster@ai.msging.net/#az-iris6",
      "to": "contact@msging.net",
      "metadata": {
        "#command.uri": "lime://contact@msging.net/entities"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extensions
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var entity = new Entity{
                    Name = "Flavor",
                    Values = new [] { 
                        new EntityValues {
                            Name = "Pepperoni",
                            Synonymous = new [] {
                                "Peperoni",
                                "Pepperonee",
                                "Pepperouni",
                                "Peperony"
                            },
                        },
                        new EntityValues {
                            Name = "Mushrooms",
                            Synonymous = new [] {
                                "Mashrooms",
                                "Mushroom",
                                "Mshrooms"
                            }
                        }
                    }
                };
    
                await _artificialIntelligenceExtension.SetEntityAsync(entity, cancellationToken);
            }
        }
    }
    

    Create an intent

    The set intent command creates a new intent, or set of intents, and cleans the old intents on the knowledge base.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.SET,
        uri: '/intentions',
        type: 'application/vnd.iris.ai.intention+json',
        resource: {
          name: 'Order pizza'
        }
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "2",
      "to": "postmaster@ai.msging.net",
      "method": "set",
      "uri": "/intentions",
      "type": "application/vnd.iris.ai.intention+json",
      "resource": {
          "name": "Order pizza"
      }
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "type": "application/vnd.iris.ai.intention+json",
      "resource": {
        "id": "order_pizza"
      },
      "method": "set",
      "status": "success",
      "id": "2",
      "from": "postmaster@ai.msging.net/#az-iris2",
      "to": "contact@msging.net",
      "metadata": {
        "#command.uri": "lime://contact@msging.net/intentions"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var intention = new Intention { Name = "Order pizza" };
    
                await _artificialIntelligenceExtension.SetIntentionAsync(intention, cancellationToken);
            }
        }
    }
    

    Delete a confusion matrix

    Remove a confusion matrix from your model.

    Replace the variable {confusionMatrixId} with the Confusion Matrix Id you want to delete.

    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Delete,
                    Uri = new LimeUri("/analytics/confusion-matrix/{confusionMatrixId}")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.DELETE,
        uri: '/analytics/confusion-matrix/{confusionMatrixId}'    
      });
    });
    
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "10",
        "method": "delete",
        "to": "postmaster@ai.msging.net",
        "uri": "/analytics/confusion-matrix/{confusionMatrixId}",
        "from": "postmaster@ai.msging.net/#hmg-az-lx-iris1"
    }
    
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "id": "10",
        "method": "delete",
        "status": "success",
        "to": "test.net/portal-test%40take.net"
    }
    
    

    Delete all entities

    Deleting all entities in a model.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "aa89s7da-b4as85da8as87",
      "to": "postmaster@ai.msging.net",
      "method": "delete",
      "uri": "/entities"
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.DELETE,
        uri: '/entities'
      });
    });
    
    
    public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
      {
          var command = new Command{
              Id = EnvelopeId.NewId(),
              Method = CommandMethod.Delete,
              Uri = new LimeUri("/entities")
          };
    
          await _sender.SendCommandAsync(command, cancellationToken);
      }
    

    Delete all intents

    Deleting all intents in a model.

    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Delete,
                    Uri = new LimeUri("/intentions")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.DELETE,
        uri: '/intentions'    
      });
    });
    
    
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "10",
      "to": "postmaster@ai.msging.net",
      "method": "delete",
      "uri": "/intentions"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "delete",
        "status": "success",
        "id": "10",
        "from": "postmaster@ai.msging.net",
        "to": "contact@msging.net",
        "metadata": {
            "#command.uri": "lime://botname@msging.net/intentions"
        }
    }
    

    Delete an intent

    Deleting an intent, where {intent_id} is the intent identifier of an already created intent.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.DELETE,
        uri: '/intentions/{intent_id}',
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "10",
      "to": "postmaster@ai.msging.net",
      "method": "delete",
      "uri": "/intentions/{intent_id}",
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "method": "delete",
      "status": "success",
      "id": "10",
      "from": "postmaster@ai.msging.net/#az-iris4",
      "to": "contact@msging.net",
      "metadata": {
        "#command.uri": "lime://contact@msging.net/intentions/{intent_id}"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Delete,
                    Uri = new LimeUri("/intentions/{intent_id}")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    

    Delete answer from intent

    Delete an answer associated to an intent.

    Replace {intentId} with the intent id you to delete the answer from, and {answerId} with the answer id you want to delete.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.DELETE,
        uri: '/intentions/{intentId}/answers/{answerId}'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Delete,
                    Uri = new LimeUri("/intentions/{intentId}/answers/{answerId}")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "10",
      "to": "postmaster@ai.msging.net",
      "method": "delete",
      "uri": "/intentions/{intentId}/answers/{answerId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "delete",
        "status": "success",
        "id": "10",
        "from": "postmaster@ai.msging.net/#hmg-az-lx-iris1",
        "to": "test@msging.net",
    }
    

    Delete question from intent

    Delete an question associated to an intent.

    Replace {intentId} with the intent id you to delete the answer from, and {questionId} with the question id you want to delete.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.DELETE,
        uri: '/intentions/{intentId}/questions/{questionId}'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Delete,
                    Uri = new LimeUri("/intentions/{intentId}/questions/{questionId}")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "10",
      "to": "postmaster@ai.msging.net",
      "method": "delete",
      "uri": "/intentions/{intentId}/questions/{questionId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "method": "delete",
        "status": "success",
        "id": "10",
        "from": "postmaster@ai.msging.net/#hmg-az-lx-iris1",
        "to": "test@msging.net",
    }
    

    Get a confusion matrix

    Getting a confusion matrix.

    Replace {confusionMatrixId} with the id of the Confusion Matrix you want to get.

    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/analytics/confusion-matrix/{confusionMatrixId}'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    Method = CommandMethod.Get,
                    Uri = new LimeUri("/analytics/confusion-matrix/{confusionMatrixId}")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);     
            }           
        }
    }
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "10",
        "to": "postmaster@ai.msging.net",
        "method": "get",
        "uri": "/analytics/confusion-matrix/{confusionMatrixId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.ai.confusion-matrix+json",
        "resource": {
            "OwnerIdentity": "botbot1@msging.net",
            "id": "{confusionMatrixId}",
            "modelId": "botbot1_5fcc572f-f9c5-47f9-964f-016ac7541425",
            "version": "Reportão",
            "score": 0,
            "sampleSize": 30,
            "createdDate": "2019-05-17T21:18:33.540Z",
            "accuracy": 0.96,
            "avgScore": 0.61698660140000006,
            "precision": 0.92207792207792216,
            "recall": 0.90238095238095239,
            "f1Score": 0.980796980796981,
            "numberOfSamples": 50,
            "matrix": [[],...],
            "perClasses": [{},...]
        },
        "method": "get",
        "status": "success",
        "id": "e909fedf-fb70-463e-88c1-1cd02218c712",
        "from": "postmaster@ai.msging.net/#hmg-az-lx-iris1",
        "to": "test@msging.net",
        "metadata": {
            "#command.uri": "lime://test@msging.net/analytics/confusion-matrix/{confusionMatrixId}"
        }
    }
    

    Get a model

    Get a specific model.

    Replace the variable {modelId} with the model id you want to get.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "774455",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/model/{modelId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.ai.model+json",
        "resource": {
            "id": "demobot_47b1f7e0-a216-47cd-8635-016eb1f558ad",
            "culture": "pt-br",
            "provider": "Watson",
            "externalId": "7c3-9139-ce2b6705",
            "storageDate": "2019-11-28T12:21:16.590Z",
            "trainingDate": "2019-11-28T12:21:16.590Z",
            "apiUri": "https://gateway.watsonplatform.net/assistant/api",
            "status": "Trained"
        },
        "method": "get",
        "status": "success",
        "id": "afcc9-9eab924a",
        "from": "postmaster@ai.msging.net/#az-iris3",
        "to": "demobot@msging.net"
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
              _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
              var command = new Command{
                Id = EnvelopeId.NewId(),
                To = "postmaster@ai.msging.net",
                Method = CommandMethod.Get,
                Uri = new LimeUri("/model/{modelId}"),
              };
    
              await _sender.SendCommandAsync(command, cancellationToken);
            }
        }
    }
    
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/model/{modelId}'
      });
    });
    

    Get a model summary overview

    Get an overview about a model metrics.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "887744999",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/models/summary"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      {
        "type": "application/vnd.iris.ai.model-summary+json",
        "resource": {
            "intentionsCount": 3,
            "intentionMinQuestions": 0,
            "intentionsSummary": [
                {
                    "id": "help",
                    "name": "Help",
                    "countQuestions": 11,
                    "healthScore": 0.9
                },
                {
                    "id": "card",
                    "name": "Card",
                    "countQuestions": 10,
                    "healthScore": 1.0
                },
                {
                    "id": "work",
                    "name": "Work",
                    "countQuestions": 10,
                    "healthScore": 1.0
                }
            ],
            "median": 10.0
        },
        "method": "get",
        "status": "success",
        "id": "7bd2e1a4-0205-4743-9c25-2ee7085bdb7f",
        "from": "postmaster@ai.msging.net/#az-iris1",
        "to": "demobot4@msging.net"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly ISender _sender;
    
            public ArtificialIntelligenceReceiver(ISender sender)
            {
               _sender = sender;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var command = new Command{
                    Id = EnvelopeId.NewId(),
                    To = "postmaster@ai.msging.net",
                    Method = CommandMethod.Get,
                    Uri = new LimeUri("/models/summary")
                };
    
               await _sender.SendCommandAsync(command, cancellationToken);
            }
        }
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/models/summary'
      });
    });
    

    Get all entities

    Getting all entities from a model.

    The following uri filters are available to get a chatbot's entities:

    QueryString Description Example
    skip The number of entities to be skipped. 0
    take The number of entities to be returned. 100
    ascending Sets ascending alphabetical order. true
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "12345674455",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/entities"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 1,
            "itemType": "application/vnd.iris.ai.entity+json",
            "items": [
                {
                    "id": "entity",
                    "name": "New Entity",
                    "storageDate": "2019-08-02T11:01:36.870Z",
                    "values": [
                        {
                            "name": "Pepperoni",
                            "synonymous": [
                              "Peperoni",
                              "Pepperonee",
                              "Pepperouni",
                              "Peperony"
                            ]
                        }
                    ]
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "34e0cb67-d56b-4b5c-aeb1-6c81e9784f67",
        "from": "postmaster@ai.msging.net/#az-iris2",
        "to": "demobot@msging.net",
        "metadata": {
            "#command.uri": "lime://demobot@msging.net/entities",
            "uber-trace-id": "ea7defa3a6a9cdaa%3Aea7defa3a6a9cdaa%3A0%3A1"
        }
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/entities'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extensions
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {            
                var skip = 0; //optional
                var take = 100; //optional
                var ascending = true; //optional
    
                await _artificialIntelligenceExtension.GetEntitiesAsync(skip, take, ascending, cancellationToken);
            }
        }
    }
    

    Get all intents

    Getting all intents from a model.

    The following uri filters are available to get a chatbot's intents:

    QueryString Description Example
    skip The number of intents to be skipped. 0
    take The number of intents to be returned. 100
    ascending Sets ascending alphabetical order. true
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "12345674455",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/intentions"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.lime.collection+json",
        "resource": {
            "total": 2,
            "itemType": "application/vnd.iris.ai.intention+json",
            "items": [
                {
                    "id": "card",
                    "name": "Card",
                    "countQuestions": 10,
                    "healthScore": 0.9523809523809523,
                    "storageDate": "2019-07-23T11:16:52.210Z"
                },
                {
                    "id": "help",
                    "name": "Help",
                    "countQuestions": 11,
                    "healthScore": 0.9523809523809523,
                    "storageDate": "2019-06-28T17:00:23.220Z"
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "22018877-9b77-4773-b4ce-1130a7cbcbad",
        "from": "postmaster@ai.msging.net/#az-iris7",
        "to": "demobot@msging.net"
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/intentions'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extensions
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {            
                var skip = 0; //optional
                var take = 100; //optional
                var ascending = true; //optional
    
                await _artificialIntelligenceExtension.GetIntentionsAsync(skip, take, ascending, cancellationToken);
            }
        }
    }
    

    Get all models

    Search in all trained and/or published models.

    The following uri filters are available to get the models:

    Property Description Example
    skip The number of models to be skipped. 0
    take The number of models to be returned. 100
    ascending Sets ascending alphabetical order. -
    client.addMessageReceiver('text/plain', async (message) => {
      var models = await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/models',
      });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "7",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/models"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "type": "application/vnd.lime.collection+json",
      "resource": {
        "total": 4,
        "itemType": "application/vnd.iris.ai.model+json",
        "items": [
          {
            "id": "12345",
            "culture": "pt-br",
            "provider": "Watson",
            "externalId": "678910",
            "storageDate": "2019-07-01T13:35:36.930Z",
            "trainingDate": "2019-07-01T13:35:36.930Z",
            "apiUri": "https://gateway.watsonplatform.net/assistant/api",
            "status": "Training"
          },
          {
            "id": "111213",
            "culture": "pt-br",
            "provider": "Dialogflow",
            "externalId": "141516",
            "storageDate": "2019-07-01T13:35:34.330Z",
            "trainingDate": "2019-07-01T13:35:34.330Z",
            "status": "Trained"
          },
          {
            "id": "171819",
            "culture": "pt-br",
            "provider": "Watson",
            "storageDate": "2019-07-01T13:28:05.520Z",
            "trainingDate": "2019-07-01T13:28:05.520Z",
            "apiUri": "https://gateway.watsonplatform.net/assistant/api",
            "status": "Deleted"
          },
          {
            "id": "202122",
            "culture": "pt-br",
            "provider": "Dialogflow",
            "storageDate": "2019-07-01T13:28:01.870Z",
            "trainingDate": "2019-07-01T13:28:01.870Z",
            "status": "Deleted"
          }
        ]
      },
      "method": "get",
      "status": "success",
      "id": "7",
      "from": "postmaster@ai.msging.net/#az-iris5",
      "to": "contact@msging.net",
      "metadata": {
        "#command.uri": "lime://contact@msging.net/models"
      }
    }
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    
    namespace Extension
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {
                var skip = 0; //optional
                var take = 100; //optional
                var ascending = true; //optional
                var models = await _artificialIntelligenceExtension.GetModelsAsync(skip, take, ascending, cancellationToken);
            }
        }
    }
    

    Get an entity

    Get a specific entity.

    Replace {entityId} with the entity Id you want to get.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "123561215",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/entities/{entityId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.ai.entity+json",
        "resource": {
            "id": "nova_entidade",
            "name": "Nova Entidade",
            "storageDate": "2019-08-02T11:01:36.870Z",
            "values": [
                {
                    "name": "Pepperoni",
                    "synonymous": [
                      "Peperoni",
                      "Pepperonee",
                      "Pepperouni",
                      "Peperony"
                    ]
                }
            ]
        },
        "method": "get",
        "status": "success",
        "id": "a13d9b93-799e-44fb-a2a1-7f6baf6730d0",
        "from": "postmaster@ai.msging.net/#az-iris5",
        "to": "demobot4@msging.net",
        "metadata": {
            "#command.uri": "lime://demobot4@msging.net/entities/nova_entidade",
            "uber-trace-id": "e071d923462def6a%3Ae071d923462def6a%3A0%3A1"
        }
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/entities/{entityId}'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extensions
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {            
                var entityId = "{entityId}";
    
                await _artificialIntelligenceExtension.GetEntityAsync(entityId, cancellationToken);
            }
        }
    }
    

    Get an intent

    Get a specific intent.

    Replace {intentId} with the intent Id you want to get.

    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "123561215",
      "to": "postmaster@ai.msging.net",
      "method": "get",
      "uri": "/intentions/{intentId}"
    }
    
    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "type": "application/vnd.iris.ai.intention+json",
        "resource": {
            "id": "card",
            "name": "Card",
            "countQuestions": 10,
            "healthScore": 0.9523809523809523,
            "storageDate": "2019-07-23T11:16:52.210Z"
        },
        "method": "get",
        "status": "success",
        "id": "ac790b97-db0e-4dac-94a4-5d087a962588",
        "from": "postmaster@ai.msging.net/#az-iris5",
        "to": "demobot@msging.net",
    }
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/intentions/{intentId}'
      });
    });
    
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extensions
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {            
                var intentId = "{intentId}";
    
                await _artificialIntelligenceExtension.GetIntentionAsync(intentId, cancellationToken);
            }
        }
    }
    

    Get answers from an intent

    Get all answers associated to an intent.

    Replace {intentId} for the itent id you want to get the answers.

    The following uri filters are available to get intent's answer:

    QueryString Description Example
    skip The number of answers to be skipped. 0
    take The number of answers to be returned. 100
    ascending Sets ascending alphabetical order. true
    using System.Threading;
    using System.Threading.Tasks;
    using Lime.Protocol;
    using Take.Blip.Client;
    using Take.Blip.Client.Extensions.ArtificialIntelligence;
    using Takenet.Iris.Messaging.Resources.ArtificialIntelligence;
    
    namespace Extensions
    {
        public class ArtificialIntelligenceReceiver : IMessageReceiver
        {
            private readonly IArtificialIntelligenceExtension _artificialIntelligenceExtension;
    
            public ArtificialIntelligenceReceiver(IArtificialIntelligenceExtension artificialIntelligenceExtension)
            {
                _artificialIntelligenceExtension = artificialIntelligenceExtension;
            }
    
            public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken)
            {            
                var intentId = "{intentId}";
                var skip = 0; //optional
                var take = 100; //optional
                var ascending = true; //optional
    
                await _artificialIntelligenceExtension.GetAnswersAsync(intentId, skip, take, ascending, cancellationToken);
            }
        }
    }
    
    
    client.addMessageReceiver('text/plain', async (message) => {
      await client.sendCommand({
        id: Lime.Guid(),
        to: 'postmaster@ai.msging.net',
        method: Lime.CommandMethod.GET,
        uri: '/intentions/{intentId}/answers'
      });
    });
    
    POST https://http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "10",
        "method": "get",