Giter VIP home page Giter VIP logo

Comments (9)

GDay avatar GDay commented on June 12, 2024

Sounds like either the Slack bot api token is not there. When you filled out the details in ChiefOnboarding and went to the next step, you got a "add to slack" button. When you clicked that and added the bot, did you get redirected back to your chiefonboarding instance? That's required for the token to be fetched.

You can check if you have a token on the server:

python mange.py shell
from integrations.models import AccessToken
print(AccessToken.objects.get(integration=0, active=True).bot_token)

That should print out the secret token that has been set for the bot, used to interact with people.

from chiefonboarding.

fculpo avatar fculpo commented on June 12, 2024

Hi,

It did redirect me to the chief instance, but it seems that there is no token in the database:

Python 3.9.7 (default, Aug 31 2021, 18:27:13)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from integrations.models import AccessToken
>>> print(AccessToken.objects.get(integration=0, active=True).bot_token)
None
>>>

from chiefonboarding.

fculpo avatar fculpo commented on June 12, 2024

From DB side:

-[ RECORD 2 ]------+-------------------------------------------------------------------------
id                 | 10
integration        | 0
token              |
refresh_token      |
base_url           |
redirect_url       |
account_id         |
name               |
active             | t
ttl                |
expiring           |
app_id             | redacted
client_id          | redacted.redacted
client_secret      | redacted
signing_secret     | redacted
verification_token | redacted
bot_token          |
bot_id             |
one_time_auth_code | redacted

from chiefonboarding.

fculpo avatar fculpo commented on June 12, 2024

I found the bot token in slack app page (starting with xoxb-), can I insert this in the DB ?
If yes how exactly as the bot_token field is a bytea in pgsql table

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024
id                 | 10

Did you try it multiple times? Seems like the ID is 10.

Anyway, yes you can, but you will have to do it through django like this:

python manage.py shell
from integrations.models import AccessToken
access_record = AccessToken.objects.get(integration=0, active=True)
access_record.bot_token = "xoxb-....."
access_record.save()

The bot_token field is an encrypted field, so therefore you can't just insert it in the DB with an sql command. You have to use the script above.

from chiefonboarding.

fculpo avatar fculpo commented on June 12, 2024

Yes I tried a lot of time, deleting the slack app, recreating it, enabling DEBUG, etc.

Let me try to add the token manually and I will post here the result.

In any case, is it possible to diagnose why the token is not fetched ? Can you help and/or reproduce ?

from chiefonboarding.

fculpo avatar fculpo commented on June 12, 2024

Adding the token manually worked fine, the bot responded "You don't seem to be setup yet. Please ask your supervisor for access." to my "hello".

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

In any case, is it possible to diagnose why the token is not fetched ? Can you help and/or reproduce ?

Yeah, I will look into it probably next week.

Adding the token manually worked fine, the bot responded "You don't seem to be setup yet. Please ask your supervisor for access." to my "hello".

That's normal behavior. You are probably good to move forward with this now. If you want to get rid of that, then you will have to go to people->employees add yourself there and then click on "give access".

I will keep the issue open until I figured out why it didn't save it.

Thanks for letting me know!

Note to myself:

Probably not getting "ok" back. Might be a change Slack made.

data = json.loads(json_response.text)
if data['ok']:
access_token.bot_token = data['bot']['bot_access_token']
access_token.bot_id = data['bot']['bot_user_id']
access_token.token = data['access_token']
access_token.save()
return redirect('/#/admin/newhire')

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

Hey, sorry for the late reply, but I just had time to look into it and figured it out. It's fixed once I merge this PR: #111 (which will happen in the next few hours)

Thanks again for reporting this!

from chiefonboarding.

Related Issues (20)

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.