Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enilsen16/hedwig_messenger
A Facebook Messenger Adapter for Hedwig
https://github.com/enilsen16/hedwig_messenger
facebook hedwig messenger messenger-bot robot
Last synced: 6 days ago
JSON representation
A Facebook Messenger Adapter for Hedwig
- Host: GitHub
- URL: https://github.com/enilsen16/hedwig_messenger
- Owner: enilsen16
- Created: 2016-11-19T00:06:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-11T01:41:23.000Z (almost 8 years ago)
- Last Synced: 2024-10-30T16:55:51.355Z (17 days ago)
- Topics: facebook, hedwig, messenger, messenger-bot, robot
- Language: Elixir
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HedwigMessenger
An in-progress alpha...
## Configuration
Below is an example configuration
```elixir
use Mix.Configconfig :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`:
```elixir
defp deps do
[
{:cowboy, "~> 1.0"},
{:plug, "~> 1.1"}
]
end
```Finally, add `Hedwig.Adapters.Messenger.Callback` to your supervision tree alongside your robot
```elixir
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`
```elixir
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.