Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gravityblast/messenger

Facebook messenger API client for Elixir
https://github.com/gravityblast/messenger

Last synced: about 9 hours ago
JSON representation

Facebook messenger API client for Elixir

Awesome Lists containing this project

README

        

# Messenger

Facebook messenger API client for Elixir

## Installation

1. Add messenger to your list of dependencies in `mix.exs`:

```elixir
def deps do
[{:messenger, "~> 0.0.1"}]
end
```

2. Ensure messenger is started before your application:

```elixir
def application do
[applications: [:messenger]]
end
```

## Usage

```elixir
alias Messenger.Recipient
alias Messenger.Message
alias Messenger.Request

page_access_token = System.get_env "PAGE_ACCESS_TOKEN"
my_user_id = System.get_env "MY_USER_ID"

recipient = Recipient.new
|> Recipient.put_id(my_user_id)

message = TextMessage.new
|> TextMessage.put_text("Hello world")

resp = Request.new
|> Request.put_recipient(recipient)
|> Request.put_message(message)
|> Request.send(page_access_token)
```