3

I would try UCWA API by sending a post request to a client. Here's the doc

After app initialization I create my request.

const request = require('request-promise');
...

let URL= "https://************.lync.com"
let req= {
    url: URL + body.communication.startMessaging,
    method: 'POST',
    headers: {
        "Accept": "application/json; charset=utf-8",
        "authorization": "Bearer " + APP.Token
    },
    body: {
        importance:"Normal",
        sessionContext:"33dc0ef6-0570-4467-bb7e-49fcbea8e944",
        subject:"Sample Subject Line",
        telemetryId:null,
        to:"sip:hamza@opencircle.co",
        operationId:"5028e824-2268-4b14-9e59-1abad65ff393"
    },
    json:true
}
return new Promise((resolve,reject)=> {
    console.log(req);
    request(req).then(res=> {console.log("OK",res)},err=> console.log("ERRoR",err.message)).catch(err=>console.log("ERROR CATCH",err));
})

I get this error message

'400 - {"code":"BadRequest","subcode":"CallbackUriUnreachable","message":"Exception of type \'PlatformService.Web.ValidationException\' was thrown.","debugInfo":{"errorReportId":"a8034d8ad14c4b0695f7f78dc12c19fe"}}'

infodev
  • 4,673
  • 17
  • 65
  • 138
  • Are you using a specific library for `request`? At first glance, it looks that you are not embedding values like `operationId` inside the body of the POST request – Rodrigo Mata Aug 01 '18 at 21:37
  • I'm using request-promise library – infodev Aug 01 '18 at 21:40
  • Ok, can you try setting the parameters for [Request body](https://learn.microsoft.com/en-us/skype-sdk/ucwa/startmessaging_ref#request-body) under a property named `formData`? Something like [here](https://github.com/request/request/tree/master/examples#flickr-image-upload). – Rodrigo Mata Aug 01 '18 at 21:44
  • I have changed it to body not form data as mentioned it in request-promise package on github but still have this error `400 - {"code":"BadRequest","subcode":"CallbackUriUnreachable","message":"Exception of type 'PlatformService.Web.ValidationException' was thrown.","debugInfo":{"errorReportId":"0ea13fc537ab4faabcdc9faad2e28746"}} ` – infodev Aug 01 '18 at 22:01
  • Did you added the `json: true` option? Also, does `body.communication.startMessaging` contains a valid path? – Rodrigo Mata Aug 01 '18 at 22:05
  • Yes I have added `json:true` and url should be OK, I doubt that the operationId is not working because I have hard typed a random string ? – infodev Aug 01 '18 at 22:15
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/177235/discussion-between-infodev-and-rodrigo-mata). – infodev Aug 01 '18 at 22:31

0 Answers0