# Microsoft Bot Framework

## Sample implementation

An [example of bot implementation with integration to mluvii](https://github.com/mluvii/mluviibot) is available on Git Hub.

## Supported formats of Microsoft Hero Cards

At this moment, mluvii supports the following card functionality [Hero Card](https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-add-rich-card-attachments?view=azure-bot-service-3.0):&#x20;

**Hero Card Type (contentType):**

* application/vnd.microsoft.card.hero
* application/vnd.microsoft.card.thumbnail

**Attachment Layout:**

* List
* Carousel

Chat input properties:

* [Input hints](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-add-input-hints?view=azure-bot-service-4.0)
* [Suggested actions](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-add-suggested-actions?view=azure-bot-service-3.0) of type [imBack ](https://learn.microsoft.com/en-us/previous-versions/azure/bot-service/rest-api/bot-framework-rest-connector-add-rich-cards?view=azure-bot-service-3.0#process-events-within-rich-cards)

## Integration with mluvii

The chatbot created in the [Microsoft Bot Framework](https://dev.botframework.com/) can communicate through [ChannelData](https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-channeldata). For example, it can list the available operators or send an email from the client.<br>

### Example of submitting a request

```
private async Task ConnectToOperator(IDialogContext context)
  {
      var data = JObject.Parse(@"{ ""Activity"": ""Forward"" }");
      var act = context.MakeMessage();
      act.ChannelData = data;
      await context.PostAsync(act);
  }
```

### Example of answer

```
private async Task OnMessageRecieved(IDialogContext context, IAwaitable<IMessageActivity> result)
  {
      var activity = await result;
      if (activity.AsEventActivity() != null && activity.ChannelData != null)
      {
          var availibleOperatorsInfo =
              JsonConvert.DeserializeObject<GetAvailableOperatorsResponse>(activity.ChannelData);
          await OnAvailibleOperatorsResponse(context, availibleOperatorsInfo);
      }
  }
```

### Mluvii channel identification

When communicating with a bot, the mluvii is identified by the constant Id “mluvii\_guest” in the`From`field. E.g.:

```json
"channelId": "directline"
...
"from": {
	"id": "mluvii_guest"
}
...
"conversation": {
```

## Next steps

#### Check [supported activities and events](https://docs.mluvii.com/en/for-it-specialists/chatbot-connection/supported-activities-and-events)
