Giter VIP home page Giter VIP logo

hedwig_slack's People

Contributors

doomspork avatar knewter avatar schlenks avatar scrogson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hedwig_slack's Issues

Issue Connecting to RTM and WS behind Proxy

Using Hedwig behind a firewall does not connect to the Slack RTM api.

Issue:

When connecting, hedwig will receive a {:error, :nxdomain} message.

Requested Usage:
Add configuration options for proxy and accompanying settings.

Examples:
config :alfred,
Alfred.Robot,
adapter: Hedwig.Adapters.Slack,
name: "aflred",
aka: "/",
token: System.get_env("SLACK_API_TOKEN"),
rooms: [],
proxy: System.get_env("HTTP_PROXY"),
ssl_options: [insecure: true, ssl_options: [protocol: 'tlsv1.2']]
responders: [
{Hedwig.Responders.Help, []},
{Hedwig.Responders.Ping, []}
]

Access slack data

Since the adapter is a genserver, it would be handy if it could respond to queries for information about users, channels, etc. that is being stored in the state object.

Hedwig Slack dependencies incompatible with Phoenix

I attempted to include Hedwig with Slack in an umbrella which also included a Phoenix project and there are dependency conflicts:

โžœ  omgbot mix deps.update --all
Running dependency resolution

Failed to use "cowlib" (versions 1.0.0 to 1.0.2) because
  cowboy (versions 1.0.0 to 1.0.4) requires ~> 1.0.0
  gun (version 1.0.0-pre.1) requires 1.3.0

Failed to use "poison" (versions 1.3.0 to 1.5.2) because
  ecto (version 1.1.9) requires ~> 1.0 or ~> 2.0
  hedwig_slack (version 0.1.0) requires ~> 2.0
  phoenix (versions 1.1.1 and 1.1.2) requires ~> 1.3
  phoenix_ecto (version 2.0.2) requires ~> 1.3 or ~> 2.0

Failed to use "ranch" (versions 1.2.0 and 1.2.1) because
  cowboy (versions 1.0.0 to 1.0.4) requires ~> 1.0
  gun (version 1.0.0-pre.1) requires 1.1.0

** (Mix) Hex dependency resolution failed, relax the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock)

It appears that cowboy requires an older version of ranch and cowlib than gun, which is required by hedwig_slack. It also appears that the newer version of cowlib is not backwards compatible and I was unable to get it to work with cowboy. There is no more recent version of cowboy.

Not sure how I can get around this problem.

Supervisor: Simple_one_for_one strategy is deprecated

mix run --no-halt
warning: :simple_one_for_one strategy is deprecated, please use DynamicSupervisor instead
  (elixir 1.10.4) lib/supervisor.ex:604: Supervisor.init/2
  (elixir 1.10.4) lib/supervisor.ex:556: Supervisor.start_link/2
  (alfred 0.1.0) lib/hedwig/robot.ex:89: Alfred.Robot.init/1
  (stdlib 3.8) gen_server.erl:374: :gen_server.init_it/2
  (stdlib 3.8) gen_server.erl:342: :gen_server.init_it/6

Only hear when mentioned?

Its possible to only hear when the bot is mentioned unless in its own chat? This would only affect responders. I would be much nicer in slack to write @bot help instead of bot help.

Slack has deprecated the RTM API, and it won't work with new apps (error msg: `{:error, :no_scheme}`)

If you make a new Slack app and try to use Hedwig, it won't work, you'll just get this very confusing error:

[error] GenServer #PID<0.592.0> terminating
** (MatchError) no match of right hand side value: {:error, :no_scheme}
    (hedwig_slack 1.0.0) lib/hedwig_slack/connection.ex:16: HedwigSlack.Connection.start/1
    (hedwig_slack 1.0.0) lib/hedwig_slack/adapter.ex:48: Hedwig.Adapters.Slack.handle_info/2
    (stdlib 3.15.2) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.15.2) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:EXIT, #PID<0.590.0>, {{:badmatch, {:error, :no_scheme}}, [{HedwigSlack.Connection, :start, 1, [file: 'lib/hedwig_slack/connection.ex', line: 16]}, {Hedwig.Adapters.Slack, :handle_info, 2, [file: 'lib/hedwig_slack/adapter.ex', line: 48]}, {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 695]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 771]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}}
State: {:state, {#PID<0.592.0>, Supervisor.Default}, :simple_one_for_one, {[Hedwig.Responder], %{Hedwig.Responder => {:child, :undefined, Hedwig.Responder, {Hedwig.Responder, :start_link, []}, :transient, false, 5000, :worker, [Hedwig.Responder]}}}, {:maps, %{#PID<0.593.0> => [Hedwig.Responders.Help, {nil, "DubzCat", [], #PID<0.590.0>}], #PID<0.594.0> => [Hedwig.Responders.Ping, {nil, "DubzCat", [], #PID<0.590.0>}], #PID<0.595.0> => [DubzCat.Responders.Meow, {nil, "DubzCat", [], #PID<0.590.0>}]}}, 3, 5, [], 0, :never, Supervisor.Default, {:ok, {%{intensity: 3, period: 5, strategy: :simple_one_for_one}, [{Hedwig.Responder, {Hedwig.Responder, :start_link, []}, :transient, 5000, :worker, [Hedwig.Responder]}]}}}

The issue is that Slack has deprecated the RTM API, in favour of the Events API - see https://api.slack.com/authentication/basics

If you use IO.inspect on the data you get back here https://github.com/hedwig-im/hedwig_slack/blob/master/lib/hedwig_slack/adapter.ex#L45

you'll see %{"error" => "invalid_auth", "ok" => false}

I think the only way to fix this for new apps (my old app seems to still work) will be to upgrade this adapter to not use the RTM API

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.