Direxion
A Microsoft Directline Client in Elixir
Installation
If available in Hex, the package can be installed
by adding direxion to your list of dependencies in mix.exs:
def deps do
[
{:direxion, "~> 0.1.0"}
]
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/direxion.
Usage
defmodule DirectlineTest do
import Direxion
...
activity_response = message(DIRECTLINE_TOKEN_HERE, ACTIVITY_TO_SEND)
The message function is a composite of three underneath functions each of which does the following
- Starts a conversation with Directline
- Sends it an activity
- Receives the reponse activity
Composite Functions
start_conversation
Parameters:
- token - The Directline Tokenå
Starts a conversation with directline
start_conversation(DIRECTLINE_TOKEN_HERE)send_activity
Parameters:
- token - The Directline Token
- conversation_id - The Conversation ID
- activity - The activity payload
Sends an activity to a given conversation
send_activity(DIRECTLINE_TOKEN_HERE, CONVERSATION_ID, ACTITVITY_TO_SEND)receive_activities
Parameters:
- token - The Directline Token
- conversation_id - The Conversation ID
Receive the activities from a conversation.
receive_activities(DIRECTLINE_TOKEN_HERE, CONVERSATION_ID)