Giter VIP home page Giter VIP logo

hedwig_messenger's Introduction

HedwigMessenger

An in-progress alpha...

Configuration

Below is an example configuration

use Mix.Config

config :alfred, Alfred.Robot,
  adapter: Hedwig.Adapters.Messenger,
  name: "alfred",
  token: "", #Your Page Access Token
  responders: [
    {Hedwig.Responders.Help, []},
    {Hedwig.Responders.Ping, []},
  ]

Facebook Callback

Messages are received from Facebook using an HTTP callback. You can use the included Hedwig.Adapters.Messenger.Callback module or define one yourself as long as it calls Hedwig.Adapters.Messenger.handle_in/2 to send the message to the robot.

Using the included server

To use the included callback with your robot, update your dependencies by including plug and cowboy:

  defp deps do
    [
      {:cowboy, "~> 1.0"},
      {:plug, "~> 1.1"}
    ]
  end

Finally, add Hedwig.Adapters.Messenger.Callback to your supervision tree alongside your robot

    children = [
      worker(Alfred.Robot, []),
      worker(Hedwig.Adapters.Messenger.Callback, [])
    ]

The parameters are:

  • cowboy_options - a keyword list of options to pass to cowboy (optional)

Defining your own callback

If you are defining your own callback (for instance in a phoenix app), just make sure to call Hedwig.Adapters.Messenger.handle_in/2

    def my_messenger_callback(conn, params) do
        case Hedwig.Adapters.Messenger.handle_in(robot_name, params) do
            {:error, reason} ->
                # Handle robot not found
            :ok ->
                # Message sent to robot.
       end
    end

What's Supported

Send API Supported?
Text Messages โœ“
Audio Messages
File Messages
Image Messages
Video Messages
Typing Indicators
Quick Replies
Buttons
Templates
Webhook Reference Supported?
Message Received โœ“
Message Delivered
Message Read
Message Echo
Postback
Plugin Opt-in
Referral
Payment
Checkout Update
Account Linking

Thanks

Initially based on @bryanjos's hedwig_sms design.

hedwig_messenger's People

Contributors

enilsen16 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

hedwig_messenger's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.