[][src]Crate chatwork_client

chatwork_client (English)

The chatwork_client crate is an API client for Chatwork.

The client is currently synchronous, with plans for adding an asynchronous runtime later.

Initialising the client

The client requires a Chatwork API token which can be obtained here.

Example using an API token defined in an environment variable:

let token = env::var("CHATWORK_TOKEN").expect("Please set the CHATWORK_TOKEN enironment variable.");
let chatwork = Chatwork::new(token);

Sending a message

You can send a message by using the send_message method, specifying a room id and message.

let token = env::var("CHATWORK_TOKEN").expect("Please set the CHATWORK_TOKEN enironment variable.");
let chatwork = Chatwork::new(token);
let response = chatwork.send_message("1234", "Test message").unwrap();

println!("response = {:?}", response);

chatwork_client(日本語)

chatwork_clientチャットワークのAPIクライエントです。

非同期処理はまだ対応していませんが、追加する予定です。

クライエントの初期化

クライエントを利用するにはAPIトークンが必要です。 こちらで申し込めます。

環境変数で初期化の例:

let token = env::var("CHATWORK_TOKEN").expect("CHATWORK_TOKENを設定してください。");
let chatwork = Chatwork::new(token);

メッセージを送る

send_message関数でメッセージを送ります。ルームIDとメッセージを指定する必要があります。

let token = env::var("CHATWORK_TOKEN").expect("CHATWORK_TOKENを設定してください。");
let chatwork = Chatwork::new(token);
let response = chatwork.send_message("1234", "テストメッセージ").unwrap();

println!("response = {:?}", response);

Structs

Chatwork

The Chatwork client.