phoenix_microsoftbot v0.1.0 MicrosoftBot.Router

This module defines the routes needed to handle messages from the Microsoft bot service

Summary

Macros

Responsible for defining routes necessary to communicate with the Microsoft bot service

Macros

microsoftbot_routes(path, controller)

Specs

microsoftbot_routes(term, String.t, module) :: any

Responsible for defining routes necessary to communicate with the Microsoft bot service

The route is - post /api/message for getting messages

It takes the controller that uses MicrosoftBot.Phoenix.Controller

Examples

Defining the controller

defmodule MessageController do
  use MicrosoftBot.Phoenix.Controller

  def message_received(%MicrosoftBot.Models.Message{} = message) do
    # ...
    # send message back or resp(conn, 200, "")
  end
end

In the routes.ex

defmodule YourApp.Router do
  use YourApp.Web, :router

  # Add the following two lines
  use MicrosoftBot.Router
  microsoftbot_routes "/api/message", MessageController
end

Parameters:

  • path the path you want use for receiving messages
  • controller the controller you want to use to handle the received messages