Send a chat message with Thinwrap (Erlang)
Post a chat message via thinwrap_notifications:send_chat/2 in Erlang — one call shape for Slack, Discord, Teams and every other provider.
1. Install
{deps, [{thinwrap_notifications, "~> 1.2"}]}.2. Send the call
Config = #{provider => slack,
webhook_url => list_to_binary(os:getenv("SLACK_WEBHOOK_URL"))},
case thinwrap_notifications:send_chat(Config, #{
body => <<"Deploy finished for build 1042.">>
}) of
{ok, #{status := Status, provider_message_id := Id}} ->
io:format("~s ~s~n", [Status, Id]);
{error, #{code := Code, message := Msg}} ->
io:format("~s: ~ts~n", [Code, Msg])
end.
Same code works for all supported providers — just change the provider ID.