Blip Docs | API Reference NAV
C# JavaScript Python 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(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
    Messenger messenger.gw.msging.net
    Instagram instagram.gw.msging.net
    WhatsApp wa.gw.msging.net
    AzureBotService (Microsoft Teams) abs.gw.msging.net
    Google RCS googlercs.gw.msging.net
    Skype skype.gw.msging.net
    Telegram telegram.gw.msging.net
    Workplace workplace.gw.msging.net
    Email mailgun.gw.msging.net
    Apple Business Chat businesschat.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"
    }
    
    message = Message(
      id="65603604-fe19-479c-c885-3195b196fe8e",
      from_n="551199991111@0mn.io/182310923192",
      to="mycontact@msging.net",
      type_n="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);
        });
    
    message = Message(
        id='1',
        type_n='text/plain',
        content='Hello, world',
        to='553199990000@0mn.io'
    )
    
    await client.connect_async()
    
    client.send_message(message)
    

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

    
    POST https://{{contract.id}}.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();
    
    def message_processor(message: Message) -> None:
        # Process received message
        pass
    
    # Add simple message receiver example
    client.add_message_receiver(Receiver(True, message_processor))
    
    # Example of message receiver with filter of originator
    client.add_message_receiver(Receiver(lambda m: m.from == '553199990000@0mn.io', message_processor))
    
    # Each registration of receivers return a `handler` that can be used to cancell the registration:
    remove_json_receiver = client.add_message_receiver(Receiver(lambda m: m.type_n == 'application/json', lambda m: print(m)))
    # ...
    remove_json_receiver()
    

    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
    };
    
    notification = Notification(
      id='65603604-fe19-479c-c885-3195b196fe8e',
      from_n='551199991111@0mn.io/182310923192',
      to='mycontact@msging.net',
      event='received'
    )
    
    var notification = {
      id: "65603604-fe19-479c-c885-3195b196fe8e",
      from: "551199991111@0mn.io/182310923192",
      to: "mycontact@msging.net",
      event: "received"
    }
    
    POST https://{{contract_id}}.http.msging.net/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"
      }
    }
    
    notification = Notification(
      id='65603604-fe19-479c-c885-3195b196fe8e',
      from_n='postmaster@msging.net/server1',
      to='mycontact@msging.net',
      event='failed',
      reason= Reason(42, 'Destination not found')
    )
    
    # or with .from_json
    
    notification = Notification.from_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'
        }
      }
    )
    
    POST https://{{contract_id}}.http.msging.net/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);
    

    We send a notification using a client object with method send_notification

    await client.connect_async()
    
    # Sending "received" notification
    notification = Notification.from_json(
        {
            'id': 'ef16284d-09b2-4d91-8220-74008f3a5788',
            'to': '553199990000@0mn.io',
            'event': lime_python.NotificationEvent.RECEIVED
        }
    )
    client.send_notification(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://{{contract_id}}.http.msging.net/notifications HTTP/1.1
    Content-Type: application/json
    Authorization: Key {key}
    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 next sample shows how to add a notification receiver with filter to the `received` event type:

    def notification_processor(notification: Notification) -> None:
        # Process received notifications
        pass
    
    client.add_notification_receiver(Receiver(lambda n: n.event == 'received', notification_processor))
    

    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"
      }
    } 
    
    command = Command(
      id='1',
      to='postmaster@broadcast.msging.net',
      method='set',
      uri='/lists',
      type_n='application/vnd.iris.distribution-list+json',
      resource={
        'identity':  'list@broadcast.msging.net'
      }
    ) 
    
    # Or using the .from_json static method
    
    command = Command.from_json(
      {
        '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://{{contract_id}}.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);
        });
    
    
    command = Command.from_json(
        {
            'id': '1',
            'method': 'get',
            'uri': '/ping'
        }
    )
    
    response = await client.process_command_async(command)
    # or sync
    # response = client.process_command(command)
    
    
    POST https://{{contract_id}}.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

    Payments

    The Stripe integration allows you to connect Smart Contact to the Stripe payment provider, making it easy to generate payment links (credit card and boleto) or Card On File payment directly in the chatbot flow.

    To use it properly is necessary to understand some important concepts:

    Throughputs

    For the exchanging of messages, notifications, and commands on the platform, we consider the following limits.

    Description Free Paid
    Message throughput (per second) 3 50
    Notification throughput (per second) 6 100
    Command throughput (per second) 48 200

    These limits apply to any type of exchange performed asynchronously via chatbot. In case of exceeding the listed limits, the next requests will automatically receive a 429 return for a period of 2 minutes.

    In a situation where message, notification and/or command exchange is high, we highly recommend the implementation of a queue control to avoid information loss.

    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://{{contract.id}}.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 SDK Python

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

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

    Requirements

    Before start

    Create a empty Python project, we recomend the usage of pipenv to better handle your enviroments

    mkdir my-bot
    cd my-bot
    
    # if you use pipenv
    pipenv --python 3.9
    

    Install blip-sdk, lime-python and lime-transport-websocket package (via pipenv/pip) as a dependecy of your project in order to access the BLiP server.

    pipenv install blip-sdk lime-python lime-transport-websocket
    
    # or with pip
    pip install blip-sdk lime-python lime-transport-websocket
    

    1. Starting the bot (python)

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

    imagem

    Create a main.py file, add the code below and replace the variables IDENTIFIER and ACCESS_KEY with informations of your bot.

    You can start the client asynchronously or synchronously

    Asynchronously (the recommended way)

    import asyncio
    
    from lime_transport_websocket import WebSocketTransport
    from blip_sdk import ClientBuilder
    
    
    async def main_async() -> None:
        # Create a client instance passing the identifier and access key of your chatbot
        client = ClientBuilder() \
            .with_identifier(IDENTIFIER) \
            .with_access_key(ACCESS_KEY) \
            .with_transport_factory(lambda: WebSocketTransport()) \
            .build()
    
        # Connect with the server asynchronously
        # Connection will occurr via websocket on the 8081 port
        await client.connect_async()
        print('Application started. Press Ctrl + c to stop.')
    
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main_async())
    loop.run_forever()
    

    Or the sync version (we only recommend for scripts)

    from time import sleep
    from lime_transport_websocket import WebSocketTransport
    from blip_sdk import ClientBuilder
    
    
    def main() -> None:
        # Create a client instance passing the identifier and access key of your chatbot
        client = ClientBuilder() \
            .with_identifier(IDENTIFIER) \
            .with_access_key(ACCESS_KEY) \
            .with_transport_factory(lambda: WebSocketTransport()) \
            .build()
    
        # Connect with the server asynchronously
        # Connection will occurr via websocket on the 8081 port
        client.connect()
        print('Application started. Press Ctrl + c to stop.')
    
    main()
    
    while True:
        sleep(1)
    

    Application started. Press Ctrl + c to stop.

    2. Receiving a message (python)

    In order to receive and handle messages you need to use add_message_receiver 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 callback function passed to a Receiver can be async or sync.

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

    from blip_sdk import ClientBuilder, Receiver
    # ...
    
    client.add_message_receiver(Receiver(True, lambda m: print(m)))
    

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

    from lime_python import Message
    from blip_sdk import ClientBuilder, Receiver
    # ...
    
    def filter_originator(message: Message) -> bool:
        return message.from_n == '553199990000@0mn.io'
    
    def message_processor(message: Message) -> None:
        # Process received message
        pass
    
    client.add_message_receiver(Receiver(filter_originator, message_processor))
    

    Each registration of a receiver returns a handler that can be used to cancel the registration:

    from lime_python import Message
    from blip_sdk import ClientBuilder, Receiver
    # ...
    
    def json_filter(message: Message) -> bool:
        return message.type_n == 'application/json'
    
    def message_processor(message: Message) -> None:
        # Process received message
        pass
    
    remove_receiver = client.add_message_receiver(Receiver(json_filter, message_processor))
    
    # ...
    remove_receiver()
    

    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:

    from lime_python import Notification, NotificationEvent
    from blip_sdk import ClientBuilder, Receiver
    # ...
    
    def notifications_filter(notification: Notification) -> bool:
        return notification.event == NotificationEvent.RECEIVED
    
    async def notification_processor_async(notification: Notification) -> None:
        # Process received notifications
        pass
    
    client.add_notification_receiver(
        Receiver(
            notification_filter,
            notification_processor_async
        )
    )
    

    Adding notification receiver with a filter using lambda expression

    client.add_notification_receiver(
        Receiver(
            lambda n: n.event == NotificationEvent.CONSUMED,
            lambda m: print(m)
        )
    )
    

    3. Sending a message (python)

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

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

    import asyncio
    
    from lime_python import Message
    from blip_sdk import ClientBuilder
    # ...
    
    async def main_async() -> None:
        # ...
        await client.connect_async()
    
        msg = Message(
            'text/plain',
            'Hello, world!',
            to='553199990000@0mn.io'
        )
        client.send_message(message)
    
    # ...
    

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

    import asyncio
    
    from lime_python import Notification, NotificationEvent
    from blip_sdk import ClientBuilder
    # ...
    
    async def main_async() -> None:
        # ...
        await client.connect_async()
    
        notification = Notification(
            NotificationEvent.RECEIVED,
            to='553199990000@0mn.io'
        )
        client.send_notification(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 (python)

    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 send_command method (fire and forget, i.e. no result is returned)

    from lime_python import Command
    from blip_sdk import ClientBuilder
    # ...
    
    resource = {
        'category': 'payments', 
        'action': 'success-order'
    }
    
    client.send_command(
        Command(
            CommandMethod.SET,
            '/event-track',
            'application/vnd.iris.eventTrack+json',
            resource
        )
    )
    

    Using process_command method

    In order to use process command sync you can't have a event loop runnning, this means that this method can only be used in scripts where the connection where made synchronously

    from lime_python import Command
    from blip_sdk import ClientBuilder
    # ...
    
    resource = {
        'category': 'payments', 
        'action': 'success-order'
    }
    
    # In order to use process command sync you can't have a event loop runnning
    # This method should only be used in scripts where the connection where made synchronously
    result = client.process_command(
        Command(
            CommandMethod.SET,
            '/event-track',
            'application/vnd.iris.eventTrack+json',
            resource
        )
    )
    
    print(result)
    

    Using process_command_async method (Recommended)

    import asyncio
    
    from lime_python import Notification, NotificationEvent
    from blip_sdk import ClientBuilder
    # ...
    
    async def main_async() -> None:
        # ...
        await client.connect_async()
    
        resource = {
            'category': 'payments', 
            'action': 'success-order'
        }
        client.send_notification(notification)
    
        result = await client.process_command_async(
            Command(
                CommandMethod.SET,
                '/event-track',
                'application/vnd.iris.eventTrack+json',
                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 Python

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

    Using HTTP

    You can integrate 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 starting

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

    imagem

    Optionally you can enable OAuth 2.0 authentication on the message and notification URLs; That way, when calling the provided URLs, Blip will use OAuth authentication. In order to enable it, open the OAuth 2.0 section and fill the provided fields. Note that only authentication through the Client Credentials Grant is supported.

    You can also instruct Blip to send custom headers when sending requests to the message and notification URLs. To do that, click on the Add header button under the Custom Headers section and set the key and value fields with the header name and value respectively.

    If OAuth authentication is enabled, an Authorization header defined as a custom header won't be sent, the OAuth Authorization header take precedence over custom headers.

    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://{{contract.id}}.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.

    For instance, given a chatbot with an Authorization token Key bWVzc2FnaW5naHViQHRha2VuZXQuY29tLmJyOjEyMzQ=, you would send a message from this bot to a Blip user like this:

    POST https://{{contract.id}}.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://{{contract_id}}.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://{{contract_id}}.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://{{contract_id}}.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"
      }
    }
    

    The timeout for the server to deliver the command response to your request is 60 seconds.

    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
    504 (Gateway Timeout) The server was unable to return a response within 60 seconds.
    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://{{contract.id}}.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"
            }
        });
    
    client.send_message(
        Message.from_json(
            {
                'to':'104222@telegram.gw.msging.net',
                'type':'application/vnd.lime.chatstate+json',
                'content': {
                    'state': 'composing'
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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"
                ]
            }
        });
    
    client.send_message(
        Message.from_json(
            {
                'to': '553199990000@0mn.io',
                'type': 'application/vnd.lime.collection+json',
                'content': {
                    'itemType': 'text/plain',
                    'items': [
                        'Text 1',
                        'Text 2',
                        'Text 3'
                    ]
                }   
            }
        )
    )
    
    POST https://{{contract.id}}.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"
                            }
                        ]
                    }
                }
            ]
        }
    });
    
    client.send_message(
        Message.from_json(
            {
                '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'
                                }
                            ]
                        }
                    }
                ]
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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)

    Copy and Paste

    MIME type
    application/vnd.lime.copy-and-paste+json

    Allows sending copy and paste messages for BLiP Chat channel.

    Sending a copy and paste to a BLiP Chat recipient:

    client.sendMessage({
        id: Lime.Guid(),
        to: 'to@msging.net',
        from: 'from@msging.net',
        type: 'application/vnd.lime.copy-and-paste+json',
        content: {
          header: 'Segue o código',
          body: 'Clique no botão abaixo para copiar o código Pix.',
          footer: 'O código expira em 10 minutos.',
          button: {
            text: 'Copiar código Pix',
            value: 'Value'
          }
        }
      });
    
    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 copy and paste document.
    public class CopyAndPasteMessageSender : IMessageSender
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public CopyAndPasteMessageSender(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        var document = new CopyAndPaste {
            Header = "Segue o código", 
            Body = "Clique no botão abaixo para copiar o código Pix.",
            Footer = "O código expira em 10 minutos.",
            Button = {
              Text = "Copiar código Pix",
              Value = "Value"
            }
          };
        await _sender.SendMessageAsync(document, message.To, cancellationToken);
    }
    }
    
    client.send_message(
        Message.from_json(
          {
            'id': uuid.uuid4(),
            'to': 'to@msging.net',
            'from': 'from@msging.net',
            'type': 'application/vnd.lime.copy-and-paste+json',
            'content': {
              'header': 'Segue o código',
              'body': 'Clique no botão abaixo para copiar o código Pix.',
              'footer': 'O código expira em 10 minutos.',
              'button': {
                'text': 'Copiar código Pix',
                'value': 'Value'
              }
            }
          }
        )
    )
    
    POST https://{{contract.id}}.http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "{{$guid}}",
        "to": "to@msging.net",
        "from": "from@msging.net",
        "type": "application/vnd.lime.copy-and-paste+json",
        "content": {
          "header": "Segue o código",
          "body": "Clique no botão abaixo para copiar o código Pix.",
          "footer": "O código expira em 10 minutos.",
          "button": {
            "text": "Copiar código Pix",
            "value": "Value"
          }
        }
    }
    

    For more details, check the specification of LIME protocol.

    BLiPChat
    imagem

    Channel mapping

    Channel Copy and Paste
    Blip Chat Copy and Paste

    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"
              }
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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'
                    }
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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"
              }
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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'
                    }
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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"
                  }
              }
          ]
        }
      });
    
    client.send_message(
      Message.from_json(
        {
          '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'
                }
              }
            ]
          }
        }
      )
    )
    
    POST https://{{contract.id}}.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.send_message(
      Message.from_json(
        {
          'id': 'dsads',
          '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'
          }
        }
      )
    )
    
        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://{{contract.id}}.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"
            }
          }
        });
    
    client.send_message(
      Message(
        id='1',
        type_n='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://{{contract.id}}.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"
            }
          }
        });
    
    client.send_message(
      Message.from_json(
        {
          'id': '1',
          '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://{{contract.id}}.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"
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                '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://{{contract.id}}.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://{{contract.id}}.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"
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                '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);
    
    client.send_message(
        Message.from_json(
            {
                '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
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                '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://{{contract.id}}.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
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                '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://{{contract.id}}.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"
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                '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://{{contract.id}}.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"
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                '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://{{contract.id}}.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"
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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'
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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

    Voice

    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 VoiceMessageReceiver : IMessageReceiver
    {
    private readonly ISender _sender;
    private readonly Settings _settings;
    
    public VoiceMessageReceiver(ISender sender, Settings settings)
    {
        _sender = sender;
        _settings = settings;
    }
    
    public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
    {
        Document document = new MediaLink
        {
            Type = MediaType.Parse("voice/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: 'chatbot@msging.net',
          content: {
            type: "voice/mp3",
            uri: "http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3",
            size: 3124123
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '1',
                'type': 'application/vnd.lime.media-link+json',
                'to': 'chatbot@msging.net',
                'content': {
                    'type': 'voice/mp3',
                    'uri': 'http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3',
                    'size': 3124123
                }
            }
        )
    )
    
    POST https://{{contract.id}}.http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "2",
        "to": "chatbot@msging.net",
        "type": "application/vnd.lime.media-link+json",
        "content": {
            "type": "voice/mp3",
            "uri": "http://blaamandagjazzband.dk/jazz/mp3/basin_street_blues.mp3",
            "size": "3124123"
        }
    }
    

    You can send voice audio by recording them or sharing a URL using the Media Link content type.

    BLiPChat
    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
                    }
                }
            ]
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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
                            }
                        }
                    ]
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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://{{contract.id}}.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"
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': 'f8cf7a7a-be4f-473a-8516-60d55534b5a6',
                'from': '1042221589186385@messenger.gw.msging.net',
                'to': 'blipcontact@msging.net',
                'type': 'text/plain',
                'content': 'First option'
            }     
        )
    )
    
    POST https://{{contract.id}}.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://{{contract.id}}.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"
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '76CB408D-39E6-4212-8AA1-7435B42A6993',
                'from': '1042221589186385@messenger.gw.msging.net',
                'to': 'blipcontact@msging.net',
                'type': 'text/plain',
                'content': 'Second option'
            }
        )
    )
    
    POST https://{{contract.id}}.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://{{contract.id}}.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
            }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': '035E675C-D25B-437D-80BD-057AD6F70671',
                'from': '1042221589186385@messenger.gw.msging.net',
                'to': 'blipcontact@msging.net',
                'type': 'application/json',
                'content': {
                    'key1':'value1',
                    'key2':2
                }
            }     
        )
    )
    
    POST https://{{contract.id}}.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
                    }
                }
            ]
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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
                            }
                        }
                    ]
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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://{{contract.id}}.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.send_message(
        Message.from_json(
            {
                '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
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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'
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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://{{contract.id}}.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.send_message(
      Message.from_json(
        {
          '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"
                      }
                    }
                  }
                ]
              }
            }
          }
        });
    
    client.send_message(
      Message.from_json(
        {
          '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'
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      )
    )
    
    POST https://{{contract.id}}.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

    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);
    }
    }
    
    client.send_message(
        Message.from_json(
            {
                'id': uuid.uuid4(),
                'to': '128271320123982@messenger.gw.msging.net',
                'type': 'text/plain',
                'content': 'Welcome to our service! How can I help you?'
            }
        )
    )
    
    POST https://{{contract.id}}.http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "{{$guid}}",
        "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

    Reaction

    MIME type
    application/vnd.lime.reaction+json

    Allows receiving reaction messages.

    Lime Protocol

    Name Description Type
    emoji the emojis associated with the reaction UnicodeSequence
    emoji.values the Unicode representation of the sequence uint[]
    inReactionTo the reference to the message to which the reaction is associated InReactionTo
    inReactionTo.id the identifier of the message being reacted to string
    inReactionTo.value the contained document value Document
    inReactionTo.direction the direction of the message in the thread MessageDirection

    The platform will receive the messages that the user reacted, with the message id. Possible messages directions are:

    Direction Description
    received The replied message was received by the thread owner
    sent The replied message was sent by the thread owner

    Directions examples on whatsapp:

    Direction Received Direction Sent
    imagem imagem

    Channel mapping

    Channel Type
    Instagram Plain Text
    Messenger Plain Text
    Whatsapp Plain Text

    Receiving reaction 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;
    
    public class ReactionMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public ReactionMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            var document = new Reaction
            {
                Emoji = new UnicodeSequence()
                {
                    // The Unicode {0x2B06, 0xFE0F} is the emoji /* ⬆️ */
                    Value = new uint[2] {0x2B06, 0xFE0F}
                },
                InReactionTo = new InReactionTo()
                {
                    Id = "wamid.HBgMNTUzN........",
                    Type = MediaType.Parse("text/plain")
                    Value = "Reaction text",
                    Direction = MessageDirection.Sent
                }
            };
    
            await _sender.SendMessageAsync(document, message.From, cancellationToken);
        }
    }
    
    POST https://{{contract.id}}.http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "{{$guid}}",
        "from": "5531999998888@wa.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "application/vnd.lime.reaction+json",
        "content": {
            "Emoji": {"0x2B06", "0xFE0F"},
            "inReactionTo": {
                "id": "wamid.HBgMNTUzN........",
                "type": "text/plain",
                "value": "Reaction text",
                "direction": "sent"
            }
        }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.reaction+json",
          from: '5531999998888@wa.gw.msging.net',
          to: "blipcontact@wa.gw.msging.net",
          content: {
            "Emoji":  {"0x2B06", "0xFE0F"},
            "inReactionTo": {
                "id": "wamid.HBgMNTUzN........",
                "type": "text/plain",
                "value": "Reaction text",
                "direction": "sent"
            }
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': uuid.uuid4(),
                'from': '5531999998888@wa.gw.msging.net',
                'to': 'blipcontact@msging.net',
                'type': 'application/vnd.lime.reaction+json',
                'content': {
                    'emoji':  {'0x2B06"', '0xFE0F'},
                    'inReactionTo': {
                        'id': 'wamid.HBgMNTUzN........',
                        'type': 'text/plain',
                        'value': 'Reaction text',
                        'direction': 'sent'
                    }
                }
            }
        )
    )
    

    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://{{contract.id}}.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.send_message(
        Message.from_json(
            {
                '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://{{contract.id}}.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.send_message(
        Message.from_json(
            {
                '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://{{contract.id}}.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"
    }
    
    client.send_message(
        Message.from_json(
            {
                '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).

    Reply

    MIME type
    application/vnd.lime.reply+json

    Allows receiving reply messages.

    Lime Protocol

    Name Description Type
    replied the content of the reply DocumentContainer
    inReplyTo the reference to the message being replied to InReplyTo
    inReplyTo.id the identifier of the message being replied to string
    inReplyTo.value the contained document value Document
    inReplyTo.direction the direction of the message in the thread MessageDirection

    The platform will receive the messages that the user replied, with the reply text and the message id. Possible messages directions are:

    Direction Description
    received The replied message was received by the thread owner
    sent The replied message was sent by the thread owner

    Directions examples on whatsapp:

    Direction Received Direction Sent
    imagem imagem

    Channel mapping

    Channel Type
    Instagram Select, Plain Text and Image
    Messenger Select, Plain Text and Image
    Whatsapp Select, Plain Text and Image

    Receiving reply 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;
    
    public class ReplyMessageReceiver : IMessageReceiver
    {
        private readonly ISender _sender;
        private readonly Settings _settings;
    
        public ReplyMessageReceiver(ISender sender, Settings settings)
        {
            _sender = sender;
            _settings = settings;
        }
    
        public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
        {
            var document = new Reply
            {
                Replied = new DocumentContainer()
                {
                    Type = MediaType.Parse("text/plain")
                    Value = "Reply text"
                },
                InReplyTo = new InReplyTo()
                {
                    Id = "wamid.HBgMNTUzN........",
                    Type = MediaType.Parse("text/plain")
                    Value = "message",
                    Direction = MessageDirection.Sent
                }
            };
    
            await _sender.SendMessageAsync(document, message.From, cancellationToken);
        }
    }
    
    POST https://{{contract.id}}.http.msging.net/messages HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "{{$guid}}",
        "from": "5531999998888@wa.gw.msging.net",
        "to": "blipcontact@msging.net",
        "type": "application/vnd.lime.reply+json",
        "content": {
            "replied": {
                "type": "text/plain",
                "value": "Reply text"
            },
            "inReplyTo": {
                "id": "wamid.HBgMNTUzN........",
                "type": "text/plain",
                "value": "message",
                "direction": "sent"
            }
        }
    }
    
        client.sendMessage({
          id: Lime.Guid(),
          type: "application/vnd.lime.reply+json",
          from: '5531999998888@wa.gw.msging.net',
          to: "blipcontact@wa.gw.msging.net",
          content: {
            "replied": {
                "type": "text/plain",
                "value": "Reply text"
            },
            "inReplyTo": {
                "id": "wamid.HBgMNTUzN........",
                "type": "text/plain",
                "value": "message",
                "direction": "sent"
            }
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                'id': uuid.uuid4(),
                'from': '5531999998888@wa.gw.msging.net',
                'to': 'blipcontact@msging.net',
                'type': 'application/vnd.lime.reply+json',
                'content': {
                    'replied': {
                        'type': 'text/plain',
                        'value': 'Reply text'
                    },
                    'inReplyTo': {
                        'id': 'wamid.HBgMNTUzN........',
                        'type': 'text/plain',
                        'value': 'message',
                        'direction': 'sent'
                    }
                }
            }
        )
    )
    

    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://{{contract.id}}.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.send_message(
        Message.from_json(
            {
                '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://{{contract.id}}.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"
    }
    
    client.send_message(
        Message.from_json(
            {
                '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://{{contract.id}}.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.send_message(
        Message.from_json(
            {
                '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://{{contract.id}}.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!"
    }
    
    client.send_message(
        Message.from_json(
            {
                '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"
          }
        });
    
    client.send_message(
      Message.from_json(
        {
          'id': '1',
          'to': '1334448251684655@messenger.gw.msging.net',
          'type': 'application/vnd.lime.sensitive+json',
          'content': {
            'type': 'text/plain',
            'value': 'Your password is 123456'
          }
        }
      )
    )
    
    POST https://{{contract.id}}.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"
            }
          }
        });
    
    client.send_message(
      Message.from_json(
        {
          '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'
            }
          }
        }
      )
    )
    
    POST https://{{contract.id}}.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"
          }
        });
    
    client.send_message(
        Message.from_json(
            {
                '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'
                }
            }
        )
    )
    
    POST https://{{contract.id}}.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 contact's identity, in the name@domain forma string
    name The contact's name. string
    address The contact's address. string
    city The contact's city name. string
    email The contact's e-mail address. string
    phoneNumber The contact's phone number. string
    photoUri The contact's photo URI. string
    cellPhoneNumber The contact's cellphone number. string
    gender The contact's gender (male/female). string
    timezone The contact's timezone relative to GMT. integer
    culture The contact's 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 The contact's group name. boolean
    lastMessageDate The contact's last interaction. datetimeoffset
    taxDocument The contact's identification document number. string
    source The contact's source (channel). Check here. string

    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

    Event

    Represents Stripe event.

    MIME type
    application/vnd.iris.stripe.event+json
    Name Description Type
    stripeSessionId Stripe session Id string
    stripePaymentIntentId Stripe PaymentIntent id string
    stripeEventCode Stripe event code string
    reasonCode Reason Code string
    reasonDescription Reason description string
    messageId Internal message Id bool
    json Event Json object

    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
    domain the destination domain string

    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

    Payment Intent

    Represents Stripe payment intent.

    MIME type
    application/vnd.iris.stripe.payment-intent+json
    Name Description Type
    id Application internal id guid
    stripePaymentIntentId Stripe PaymentIntent id string
    stripeCustomerId Stripe customer id. string
    status Payment status string
    stripeCardId Stripe Card id. string

    Payment Intent Confirm

    Represents Stripe payment intent confirm.

    MIME type
    application/vnd.iris.stripe.payment-intent-confirm+json
    Name Description Type
    paymentIntentId Stripe PaymentIntent id string
    customerId Stripe customer id. string
    status Payment status string
    options Payment intent confirmation options. PaymentIntentConfirmOptions

    Payment Intent Confirm Options

    Represents Stripe payment intent confirm options.

    MIME type
    application/vnd.iris.stripe.payment-method-options+json
    Name Description Type
    clientSecret The client secret of this PaymentIntent guid
    offSession Set to true to indicate that the customer is not in your checkout flow during this payment attempt bool
    paymentMethod ID of the payment method (a PaymentMethod, Card, or compatible Source object) to attach to this PaymentIntent string
    paymentMethodTypes The list of payment method types (e.g. card) that this PaymentIntent is allowed to use List
    receiptEmail Email address that the receipt for the resulting payment will be sent to. string
    returnUrl The URL to redirect your customer back to after they authenticate or cancel their payment on the payment string
    setupFutureUsage Indicates that you intend to make future payments with this PaymentIntent's payment method string

    Payment Method

    Represents Stripe payment method.

    MIME type
    application/vnd.iris.stripe.payment-method+json
    Name Description Type
    id Application internal id guid(string unique identifier)
    brand Card brand(Visa, mastercard ,etc). string
    country Card country string
    expirationMonth Card month expiration string
    expirationYear Card year expiration string
    funding Card type(debit, credit) string
    last4Digits Last card 4 digits string

    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
    isActive set if rule is active or not bool
    Conditions Conditions to meet object. Condition
    Priority The priority rule create order. int

    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

    Session

    Represents Stripe session.

    MIME type
    application/vnd.iris.stripe.session+json
    Name Description Type
    id Application internal id guid
    stripeSessionId Stripe session id string
    method Payment method selected by customer. string
    url Webpage url string
    status Payment status string
    expirationDate Webpage expiration date dateTimeOffSet
    paymentIntentId Application payment intent internal id guid
    stripePaymentIntentId Stripe PaymentIntent id string

    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
    sequentialSuffix the optional suffix of sequential id string
    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
    priority The ticket's priority level int

    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.

    Analytics

    The analytics extension allows chatbot'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
    to postmaster@analytics.msging.net

    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'
        }
      });
    });
    
    await client.analytics_extension.create_event_track_async(
        'billing',
        'payment'
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "{{$guid}}",
      "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 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'
                }
            }
        });
    });
    
    await client.analytics_extension.create_event_track_async(
        'billing',
        'payment',
        '123456@messenger.gw.msging.net'
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
        "id": "{{$guid}}",
        "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.

    Get event 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);
      });
    });
    
    categories = await client.analytics_extension.get_categories_async()
    
    for category in categories.resource['items']:
        print(category)
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "{{$guid}}",
      "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. Values between 1 and 10000 are allowed. If the value is not allowed, an error will be returned. 100

    Get event 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);
      });
    });
    
    actions = await client.analytics_extension.get_category_actions_counter_async(
        'payments',
        '2019-06-21',
        '2019-06-28',
        10
    )
    
    for action in actions.resource['items']:
        print(action)
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "{{$guid}}",
      "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
    Example
    $take Limit of total of items to be returned. Values between 1 and 10000 are allowed. If the value is not allowed, an error will be returned. 100
    $skip The number of elements to be skipped. 0
    startDate Initial date to search for events. 2019-06-21
    endDate Limit date to retrieve the events. 2019-06-28

    Get event 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);
      });
    });
    
    events = await client.analytics_extension.get_event_details_async(
        'payments',
        'success-order',
        '2019-06-21',
        '2019-06-28',
        10
    )
    
    for event in events.resource['items']:
        print(event)
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "{{$guid}}",
      "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
    Example
    $skip Number of items to be skipped for paging. 0
    $take Limit of total of items to be returned. Values between 1 and 500 are allowed. If the value is not allowed, an error will be returned. 100
    startDate Initial date to search for events. 2019-06-21
    endDate Limit date to retrieve the events. 2019-06-28

    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}"
        });
    });
    
    await client.analytics_extension.delete_category_async('categoryName')
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "{{$guid}}",
      "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);
            }
        }
    }
    

    Create a report

    Create a new report.

    You must send a report document, informing your data.

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.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'
                }
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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 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.

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.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
                }
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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);
    }
    

    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
    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.GET,
                'uri': '/reports'
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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.

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.GET,
                'uri': '/reports/{reportId}'
            }   
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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 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. Values between 1 and 1000 are allowed. If the value is not allowed, an error will be returned. 100
    $ascending Sets ascending alphabetical order. true
    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.GET,
                'uri': '/reports/{reportId}/charts'
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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);
    }
    

    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.

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.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
                }
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$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": "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);
    }
    

    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.

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.DELETE,
                'uri': '/reports/{reportId}/charts/{chartId}'
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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.

    result = await client.process_command_async(
        Command.from_json(
            {
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.DELETE,
                'uri': '/reports/{reportId}'
            }  
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {
      "id": "{{$guid}}",
      "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);
    }
    

    Get active messages

    Get the metrics of active messages by an interval.

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

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.GET,
                'uri': '/metrics/active-messages/{interval}'
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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 active messages per domain

    Get the metrics of active messages per domain by an interval.

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

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.GET,
                'uri': '/metrics/active-messages-per-domain/{interval}'
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "to": "postmaster@analytics.msging.net",
      "method": "get",
      "uri": "/metrics/active-messages-per-domain/{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": "2021-03-01T03:00:00.000Z",
                    "intervalEnd": "2021-03-05T03:00:00.000Z",
                    "count": 43,
                    "domain": "messenger.gw.msging.net"
                },
                {
                    "intervalStart": "2021-03-01T03:00:00.000Z",
                    "intervalEnd": "2021-03-05T03:00:00.000Z",
                    "count": 100,
                    "domain": "wa.gw.msging.net"
                }
            ]
        },
        "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-per-domain/{interval}"
    })
    
    var command = new Command(){
        Id = EnvelopeId.NewId(),
        Method = CommandMethod.Get,
        To = "postmaster@analytics.msging.net",
        Uri = new LimeUri("/metrics/active-messages-per-domain/{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 active users

    Get the metrics of active users by an interval.

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

    result = await client.process_command_async(
        Command.from_json(
            {  
                'id': '{{$guid}}',
                'to': 'postmaster@analytics.msging.net',
                'method': CommandMethod.GET,
                'uri': '/metrics/active-identity/{interval}'
            }
        )
    )
    
    POST https://{{contract_id}}.http.msging.net/commands HTTP/1.1
    Content-Type: application/json
    Authorization: Key {YOUR_TOKEN}
    
    {  
      "id": "{{$guid}}",
      "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",
        "fro