symphonyoss / hubot-symphony

Hubot adapter for Symphony
Apache License 2.0
12 stars 11 forks source link

Support MessageML v2 & Structured Objects #58

Open jonfreedman opened 7 years ago

mistryvinay commented 7 years ago

Hi Jon, Any chance we could update Hubot to support the V4 endpoints which are now available https://rest-api.symphony.com/docs/messagemlv2

jonfreedman commented 7 years ago

Development is taking place on the 1.46 branch. This will take a bit more development work to get ready, the nock-server scripts need to be extended further to handle the fact that if you send <messageML>Hello world!</messageML> you now get back <div data-format=\"PresentationML\" data-version=\"2.0\">Hello world!</div>

For reference here is sample output from polling a v4 datafeed, looks like random <br/> tags may also be inserted:

[{
    "id": "ePWX9h",
    "timestamp": 1501432861213,
    "type": "MESSAGESENT",
    "initiator": {
        "user": {
            "userId": 346621040656398,
            "firstName": "Jon",
            "lastName": "Freedman",
            "displayName": "Jon Freedman",
            "email": "not@my.email",
            "username": "not@my.email"
        }
    },
    "payload": {
        "messageSent": {
            "message": {
                "messageId": "ze_erMbOemaKZzvPhhodSn___qJroK3ldA",
                "timestamp": 1501432861213,
                "message": "<div data-format=\"PresentationML\" data-version=\"2.0\"><br/>mozart ping</div>",
                "data": "{}",
                "user": {
                    "userId": 346621040656398,
                    "firstName": "Jon",
                    "lastName": "Freedman",
                    "displayName": "Jon Freedman",
                    "email": "not@my.email",
                    "username": "not@my.email"
                },
                "stream": {
                    "streamId": "YUoYm7ObKgjQzIOe_-nYXH___qiA61_2dA",
                    "streamType": "IM"
                },
                "externalRecipients": false
            }
        }
    }
}]
jonfreedman commented 7 years ago

I've released version 3.0.12 which supports sending MessageML v2 - the adapter still subscribes to a v2 datafeed so you cannot listen for structured objects but given hubot is designed to be text based I'm not sure that is a big issue.