From 39bd3a18e4a0645da8e51323c7188cb13d52edd4 Mon Sep 17 00:00:00 2001 From: Subin Lee Date: Thu, 15 Jan 2026 22:52:15 +0900 Subject: [PATCH 1/2] Add support for fax and voice message options in Solapi.Message.Service - Updated the message service to include `faxOptions` and `voiceOptions` fields. - Added tests for sending fax and voice messages, verifying the correct structure and response. --- lib/solapi/message/service.ex | 2 + test/solapi/message/service_test.exs | 62 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/lib/solapi/message/service.ex b/lib/solapi/message/service.ex index 90e8f65..c7c9218 100644 --- a/lib/solapi/message/service.ex +++ b/lib/solapi/message/service.ex @@ -89,6 +89,8 @@ defmodule Solapi.Message.Service do |> maybe_add("kakaoOptions", get_field(message, :kakao_options, "kakaoOptions")) |> maybe_add("rcsOptions", get_field(message, :rcs_options, "rcsOptions")) |> maybe_add("customFields", get_field(message, :custom_fields, "customFields")) + |> maybe_add("faxOptions", get_field(message, :fax_options, "faxOptions")) + |> maybe_add("voiceOptions", get_field(message, :voice_options, "voiceOptions")) end defp get_field(message, atom_key, string_key) do diff --git a/test/solapi/message/service_test.exs b/test/solapi/message/service_test.exs index f113f81..6e0dfc5 100644 --- a/test/solapi/message/service_test.exs +++ b/test/solapi/message/service_test.exs @@ -103,6 +103,68 @@ defmodule Solapi.Message.ServiceTest do assert {:error, %Solapi.Error.ValidationError{}} = result end + + test "FAX 메시지 발송 (faxOptions 포함)", %{bypass: bypass, client: client} do + Bypass.expect(bypass, "POST", "/messages/v4/send-many/detail", fn conn -> + {:ok, body, conn} = Plug.Conn.read_body(conn) + decoded = Jason.decode!(body) + + message = hd(decoded["messages"]) + assert message["to"] == "0212345678" + assert message["from"] == "0312345678" + assert message["faxOptions"]["fileIds"] == ["file_id_123", "file_id_456"] + + response = %{ + "groupId" => "G_FAX", + "messageId" => "M_FAX" + } + + conn + |> Plug.Conn.put_resp_content_type("application/json") + |> Plug.Conn.resp(200, Jason.encode!(response)) + end) + + result = + Service.send(client, %{ + to: "0212345678", + from: "0312345678", + fax_options: %{fileIds: ["file_id_123", "file_id_456"]} + }) + + assert {:ok, %{"messageId" => "M_FAX"}} = result + end + + test "음성 메시지 발송 (voiceOptions 포함)", %{bypass: bypass, client: client} do + Bypass.expect(bypass, "POST", "/messages/v4/send-many/detail", fn conn -> + {:ok, body, conn} = Plug.Conn.read_body(conn) + decoded = Jason.decode!(body) + + message = hd(decoded["messages"]) + assert message["to"] == "01012345678" + assert message["from"] == "0212345678" + assert message["text"] == "음성 메시지 테스트입니다." + assert message["voiceOptions"]["voiceType"] == "FEMALE" + + response = %{ + "groupId" => "G_VOICE", + "messageId" => "M_VOICE" + } + + conn + |> Plug.Conn.put_resp_content_type("application/json") + |> Plug.Conn.resp(200, Jason.encode!(response)) + end) + + result = + Service.send(client, %{ + to: "01012345678", + from: "0212345678", + text: "음성 메시지 테스트입니다.", + voice_options: %{voiceType: "FEMALE"} + }) + + assert {:ok, %{"messageId" => "M_VOICE"}} = result + end end describe "send/1 with config" do From eaeb000197849e0519adf1f759bda784c064e1d2 Mon Sep 17 00:00:00 2001 From: Subin Lee Date: Thu, 15 Jan 2026 22:53:33 +0900 Subject: [PATCH 2/2] Update version to 0.1.1 in mix.exs --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index be96126..015c932 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Solapi.MixProject do use Mix.Project - @version "0.1.0" + @version "0.1.1" @source_url "https://github.com/solapi/solapi-elixir" def project do