Skip to content

channel info cannot be obtained by _get_channel_info in sensor #61

@dove-young

Description

@dove-young

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions