Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channel info cannot be obtained by _get_channel_info in sensor #61

Open
dove-young opened this issue Aug 5, 2020 · 3 comments
Open

Comments

@dove-young
Copy link

dove-young commented Aug 5, 2020

I modified poll function in packs/slack/sensors/slack_sensor.py to include debugging

    def _api_call(self, method, **kwargs):
        result = self._client.api_call(method, **kwargs)

        self._logger.info('inside _api_call ... %s  and %s ' %  (method, kwargs) )
        self._logger.info(result)
        self._logger.info(type(result))

        if isinstance(result, str):
            result = json.loads(result)

        return result

And when I type messages in a slack channel, the poll result error message says [u'[ERROR] This method is retired and can no longer be used. Please use conversations.info instead

2020-08-05 08:36:37,968 140520872485744 INFO slack_sensor [-] inside _api_call ... channels.info  and {'channel': u'CSDBKG7BP'}
2020-08-05 08:36:37,969 140520872485744 INFO slack_sensor [-] {u'headers': {u'content-length': u'222', u'x-xss-protection': u'0', u'x-content-type-options': u'nosniff', u'content-encoding': u'gzip', u'x-slack-req-id': u'3f18d6ff700b054bfbb82af86fe11638', u'access-control-expose-headers': u'x-slack-req-id, retry-after', u'vary': u'Accept-Encoding', u'x-via': u'haproxy-www-u6qh,haproxy-edge-iad-sgwj', u'expires': u'Mon, 26 Jul 1997 05:00:00 GMT', u'server': u'Apache', u'access-control-allow-origin': u'*', u'x-slack-backend': u'r', u'strict-transport-security': u'max-age=31536000; includeSubDomains; preload', u'pragma': u'no-cache', u'cache-control': u'private, no-cache, no-store, must-revalidate', u'date': u'Wed, 05 Aug 2020 15:36:37 GMT', u'x-oauth-scopes': u'identify,bot:basic', u'referrer-policy': u'no-referrer', u'content-type': u'application/json; charset=utf-8', u'access-control-allow-headers': u'slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags'}, u'ok': False, u'response_metadata': {u'messages': [u'[ERROR] This method is retired and can no longer be used. Please use conversations.info instead. Learn more: https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api.']}, u'error': u'method_deprecated'}
2020-08-05 08:36:37,970 140520872485744 INFO slack_sensor [-] <type 'dict'>
2020-08-05 08:36:37,970 140520872485744 INFO slack_sensor [-] channel_info is None

so there is no channel info returned by api call.

@dove-young dove-young changed the title there is no timestamp in sensor poll result channel info cannot be obtained by _get_channel_info in sensor Aug 5, 2020
@srimandarbha
Copy link

srimandarbha commented Nov 18, 2020

Hi All

I didnt use slackclient library but with web methods deprecated, i made some small changes to slack_sensor.py as workaround to make it work for me. However , the web methods or code changes are needed +1

Thanks in advance

@nmaludy
Copy link
Contributor

nmaludy commented Nov 18, 2020

Can one of you submit a PR with the fixes you've made?

Thanks,
Nick

@winem
Copy link

winem commented Jun 19, 2021

Just came across this issue during the 3.5 pre-release testing. I'll add this to my backlog unless someone else wants to work on it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants