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

Unable to send proactive messages to Slack platform #11

Open
meets7 opened this issue Aug 16, 2017 · 1 comment
Open

Unable to send proactive messages to Slack platform #11

meets7 opened this issue Aug 16, 2017 · 1 comment

Comments

@meets7
Copy link

meets7 commented Aug 16, 2017

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?

@mbrown1508
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants