rampatra / jbot

Make Slack and Facebook Bots in Java.
GNU General Public License v3.0
1.2k stars 349 forks source link

Slackbot does not function and I see that No web socket url returned by Slack #188

Open techiechat opened 4 years ago

techiechat commented 4 years ago

I newly created the slackbot token and git cloned the code then I added the slackbot token in application properties file. and made few changes in controller and service code

then started the slack bot app and even though slack app is started it doesnot function as intended. below is the error I see in the console :

2020-09-28 23:53:07.507 ERROR 12828 --- [ main] me.ramswaroop.jbot.core.slack.Bot : No web socket url returned by Slack. 2020-09-28 23:53:07.625 INFO 12828 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-09-28 23:53:07.805 INFO 12828 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2020-09-28 23:53:07.808 INFO 12828 --- [ main] c.v.v.vrt.slackbot.SlackBotApplication : Started SlackBotApplication in 2.286 seconds (JVM running for 2.649)

Can you please help me debug this ?

techiechat commented 4 years ago

"No web socket url returned by Slack. " is the returned in console It seems like its unable to startRTM And WebSocketConnection ...

I have created slackbot app and added slack token in application.properties Am i missing something here?

rampatra commented 3 years ago

No, that should be it. Just paste the token in application.properties file and make sure you have slack in active profiles like below:

# jbot
spring.profiles.active=slack
spring.jackson.property-naming-strategy=SNAKE_CASE
logging.level.me.ramswaroop=DEBUG
server.port=8080

# slack integrations
slackApi=https://slack.com/api
slackBotToken=<paste your slack bot token>             # <-------------- your token here
yours-truly-phil commented 3 years ago

I run into the same Issue, cloned, didn't make any changes except copying the bot token to the application.properties and removing the facebook profile (only slack is active).

The App seems running and in the Log there is one Error No web socket url returned by Slack.

The Bot doesn't seem to react to any messages (or anything as far as I can tell). The Bot token scopes are channels:history, channels:join, chat:write, im:read, im:write, reactions:read, reactions:write.

What I expected to happen is that I run the sample application and having the bot react to direct messages and to messages in the channel the bot is in that are in the form of "ab12ab" (as the javadoc on onReceiveMessage suggests). I don't see any activity in Slack or the log.

2021-02-07 17:34:55.510  INFO 4181 --- [           main] example.jbot.JBotApplication             : Starting JBotApplication on Philipps-MBP with PID 4181 (/Users/pseeger/git/jbot/jbot-example/target/classes started by pseeger in /Users/pseeger/git/jbot)
2021-02-07 17:34:55.513  INFO 4181 --- [           main] example.jbot.JBotApplication             : The following profiles are active: slack
2021-02-07 17:34:55.551  INFO 4181 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3feb2dda: startup date [Sun Feb 07 17:34:55 CET 2021]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/Users/pseeger/.m2/repository/org/springframework/spring-core/4.3.2.RELEASE/spring-core-4.3.2.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-02-07 17:34:56.245  INFO 4181 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2021-02-07 17:34:56.253  INFO 4181 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2021-02-07 17:34:56.254  INFO 4181 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.4
2021-02-07 17:34:56.300  INFO 4181 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-02-07 17:34:56.300  INFO 4181 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 753 ms
2021-02-07 17:34:56.455  INFO 4181 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2021-02-07 17:34:56.461  INFO 4181 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2021-02-07 17:34:56.462  INFO 4181 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2021-02-07 17:34:56.462  INFO 4181 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2021-02-07 17:34:56.462  INFO 4181 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2021-02-07 17:34:56.508  INFO 4181 --- [           main] m.r.j.c.c.c.DefaultConfiguration         : There are no any rest template beans defined, creating default rest template...
2021-02-07 17:34:57.298 ERROR 4181 --- [           main] me.ramswaroop.jbot.core.slack.Bot        : No web socket url returned by Slack.
2021-02-07 17:34:57.585  INFO 4181 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3feb2dda: startup date [Sun Feb 07 17:34:55 CET 2021]; root of context hierarchy
2021-02-07 17:34:57.610  INFO 4181 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/slash-command],methods=[POST],consumes=[application/x-www-form-urlencoded]}" onto public me.ramswaroop.jbot.core.slack.models.RichMessage example.jbot.slack.SlackSlashCommand.onReceiveSlashCommand(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
2021-02-07 17:34:57.611  INFO 4181 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2021-02-07 17:34:57.612  INFO 4181 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2021-02-07 17:34:57.628  INFO 4181 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-02-07 17:34:57.628  INFO 4181 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-02-07 17:34:57.650  INFO 4181 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-02-07 17:34:57.783  INFO 4181 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2021-02-07 17:34:57.811  INFO 4181 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2021-02-07 17:34:57.814  INFO 4181 --- [           main] example.jbot.JBotApplication             : Started JBotApplication in 2.585 seconds (JVM running for 3.119)