Giter VIP home page Giter VIP logo

Comments (8)

xNok avatar xNok commented on July 22, 2024

Hi @mcsescott,

Thanks for the feedback it helps me improve the tutorial. First, make sure your application has the right permissions. Luckily it is now easy to do with App Manifest: look at the GIF in this article (I did not update the tutorial accordingly yet :-{ )

Once the configuration is OK then It may be a bug. Someone else Open a bug recently #3. For a reason that I did not understand yet, the UserId is not from the event is empty when coming to the App Home for the first time.

Please validate the first point, on my side I will dig deeper into that UserId issue.

from slack-go-demo-socketmode.

mcsescott avatar mcsescott commented on July 22, 2024

Thanks for the comment. I compared my manifest to yours, and they look to be in order. I saw issue #3 but it was closed so I assumed you had updated it in the code. I will delete the app/code and reinstall it from scratch (probably tomorrow) and see what happens.

_metadata: major_version: 1 minor_version: 1 display_information: name: VZ Taskmaster description: Test for tasks background_color: "#2c2d30" features: app_home: home_tab_enabled: true messages_tab_enabled: true messages_tab_read_only_enabled: false bot_user: display_name: VZ Taskmaster always_online: false slash_commands: - command: /vztasks description: Let's do something! should_escape: false oauth_config: scopes: bot: - app_mentions:read - channels:history - channels:read - chat:write - commands - groups:read - im:history - im:read - im:write - reactions:read - reactions:write - users:read - links:read settings: event_subscriptions: user_events: - message.app_home bot_events: - app_home_opened - app_mention - member_joined_channel - message.channels - message.im interactivity: is_enabled: true org_deploy_enabled: false socket_mode_enabled: true token_rotation_enabled: false

from slack-go-demo-socketmode.

xNok avatar xNok commented on July 22, 2024

If the manifest is correct you should see the event logged in when you open App Home. Like this:

socketmode: 2021/07/11 11:49:51 socket_mode_managed_conn.go:336: Received WebSocket message: {"envelope_id":"ec3e6fbc-c624-4cf9-b709-ed56788497cd","payload":{"token":"WvsrrpDjaTWiZLsGcuXGUQrh","team_id":"T01KL8ALRPU","api_app_id":"A01PM8UB8JG","event":{"type":"app_home_opened","user":"U01K5EZ9A7R","channel":"D01P8ARNXK8","tab":"home","view":{"id":"V01PL81GWDR","team_id":"T01KL8ALRPU","type":"home","blocks":[{"type":"section","block_id":"4+o","text":{"type":"mrkdwn","text":"*Welcome Back!* \nThis is a home for Stickers app. You can add small notes here!","verbatim":false},"accessory":{"type":"button","action_id":"add_note","text":{"type":"plain_text","text":"Add a Stickie","emoji":true}}},{"type":"divider","block_id":"8Av"}],"private_metadata":"","callback_id":"","state":{"values":[]},"hash":"1626018527.6R4napTR","title":{"type":"plain_text","text":"View Title","emoji":true},"clear_on_close":false,"notify_on_close":false,"close":null,"submit":null,"previous_view_id":null,"root_view_id":"V01PL81GWDR","app_id":"A01PM8UB8JG","external_id":"","app_installed_team_id":"T01KL8ALRPU","bot_id":"B01PFA6BA75"},"event_ts":"1626018587.211703"},"type":"event_callback","event_id":"Ev0282JQ0BR7","event_time":1626018587,"authorizations":[{"enterprise_id":null,"team_id":"T01KL8ALRPU","user_id":"U01PTNN2733","is_bot":true,"is_enterprise_install":false}],"is_ext_shared_channel":false},"type":"events_api","accepts_response_payload":false,"retry_attempt":1,"retry_reason":"timeout"}

Do you see this error in the logs 2021/07/11 11:49:51 Unexpected event type received: error_bad_message. it seems to me that slack-go is not able to correctly parse the event received. I will dig into it and make a PR to slack-go.

In the meantime, you can force the app_home to initialize for a specific user with the integration tests

go test ./...

For the integration test to work you need to have test_slack.env at the root of the project:

SLACK_BOT_TOKEN=xoxb-xxxxxxxxxx
SLACK_APP_TOKEN=xapp-1-xxxxxxxxxxxxx
TEST_USER=UXXXXXXXXXX

Once the home is initialized the rest of the tutorial works as intended.

from slack-go-demo-socketmode.

xNok avatar xNok commented on July 22, 2024

related issue: slack-go/slack#943

from slack-go-demo-socketmode.

mcsescott avatar mcsescott commented on July 22, 2024

There was also this issue from Slack, which affected many of our other integrations/workflows. It mentions the App Home, so this could be the reason why it didn't work:

https://status.slack.com//2021-07/4963fe758b1115d8

I am still trying to follow your guides, but they seem to be slightly confusing (to me) and may not be updated (go commands aren't correct). I will also be deleting the app and starting over from the beginning, as I have tried so many different things/iterations to get it working that I may be confusing myself, which is certainly easy.

Example command which doesn't work:

https://betterprogramming.pub/build-a-slack-app-home-in-golang-using-socket-mode-aff7b855bb31
Step 1: Create the Project Repository
go mod init go get -u github.com/slack-go/slack

from slack-go-demo-socketmode.

xNok avatar xNok commented on July 22, 2024

It is two separate commands

go mod init
go get -u github.com/slack-go/slack

go mod init create the go.mod file and go get installs dependencies.

from slack-go-demo-socketmode.

xNok avatar xNok commented on July 22, 2024

I have identified two bugs related to the app_home_opened event:

  • Once you initialized the Home, all subsequent events are error_bad_message
  • The event seems sometimes not to be correctly parsed and do not contain the UserId

I look for fixes in the upcoming days.

from slack-go-demo-socketmode.

xNok avatar xNok commented on July 22, 2024

I monkey patched appHomeController.go to make the demo work.

I believe now that app_home_opened has been updated on Slack's side but it has not been reflecting in slack-go, thus the troubles we are running into.

I will have to compare the specs and see what is going wrong.

from slack-go-demo-socketmode.

Related Issues (4)

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.