Skip to content

Unable to send proactive messages to Slack platform #11

@meets7

Description

@meets7

Sending async/ad hoc messages for skype is working well with the following message object:

      message = {
           'type': 'message',
           'channelId': user['channelId'],
           'conversation': {
               'id': user['conversationId']
           },
           'serviceUrl': user['serviceUrl'],
           'from': {
               'id': '*******:*********',
               'name': 'botname'
           }
       }

But the above doesn't work for slack. It gives me the following error:

Error posting to Microsoft Bot Connector. Status Code: 400, Text { error: { code: Missing Property, message: The from field is required } }

If I change the mesage to following:

message = {'type': 'message',
                   # 'id': '*********',
                   # 'timestamp': '2017-08-16T17:22:07.1718198Z',
                   'serviceUrl': 'https://slack.botframework.com',
                   'channelId': 'slack',
                   'fromAccount': {
                       'id': '*******:********',
                       'name': 'botname'
                   },
                   'conversation': {
                       'isGroup': False,
                       'id': '*****:*******:*********'
                   },
                   'from': {
                       'id': user['userId'],
                       'name': user['name']
                   },
                   'recipient': {
                       'id': user['userId'],
                       'name': user['name']
                   },
                   'channelData': {
                       'SlackMessage': {
                           # 'type': 'user_typing',
                           'channel': '*********',
                           'user': '********'
                       },
                       # 'ApiToken': 'xxxxxxxxxxx'
                    }
                   }

I get the following error:

ERROR:microsoftbotframework.response:Error posting to Microsoft Bot Connector. Status Code: 400, Text {
"error": {
"code": "MissingProperty",
"message": "The bot referenced by the 'from' field is unrecognized"
}
}

Btw sending replies to slack works normally using:

        reply = ReplyToActivity(fill=message,
                        channelData={},
                        **response).send()

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions