Skip to content

Unable to send proactive messages to Slack platform #11

Open

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?

Activity

  1. mbrown1508 commented on Aug 21, 2017

    @mbrown1508
    Owner

    Hey,

    I am not quite sure how you are constructing the message object. Can you show me the actual code you are using?

    The from field is a pain as from is a reserved keyword in python so you set it using fromAccount rather than from. This might be the issue. I would need the code you are using the the first example to really help.

    In the second example it looks like you are setting the from field to the user field which would explain why it fails there. And again I use fromAccount internally in place of the from field. It is not actually one of the fields that gets set to/from Microsoft.

    Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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