1

I am trying to write a nodeJS code which sends a simple notification to a Skype for Business account using the UCWA web API but I am not succeeding.

The customer uses Skype for Business 2015 on-premises.

To implement that I followed the link bellow: https://www.matthewproctor.com/Send-An-IM-With-UCWA-Sending-the-IM/

It looks like I completed the part 2 successfully.

On the part 3 I am supposed to be able to send the message, the process starts by requesting the following URL using the method POST: /ucwa/oauth/v1/applications/1023*********/communication/messagingInvitations

Bellow the POST data example:

{
  "importance":"Normal",
  "sessionContext":"33dc0ef6-0570-4467-bb7e-49fcbea8e944",
  "subject":"Sample Subject Line",
  "telemetryId":null,
  "to":"sip:scottgu@contoso.com",
  "operationId":"5028e824-2268-4b14-9e59-1abad65ff393"
}

Question 1: Does someone knows where do I get the operationId param from? It wasn't clear for me when the article says it was done on part 1. I am using the example operationId but not sure if it is the cause of not having it working properly on the following steps.

After the request is done, the desktop app of the account I am sending the message pops up on the bottom right of the screen with the account and title I am sending (subject) the request.

The UCWA returned (201 Created) as described on the article, but the body which would return the events URL is blank.

Because I didn't get the events URL I hard-coded it, so I could keep going on the following requests.
Then I call:

/ucwa/oauth/v1/applications/102........../events?ack=1

and

/ucwa/oauth/v1/applications/102........../events?ack=3

(I am replacing the code 102.......... with the application Id I got on the /messagingInvitations request.)

The response of the last request returned a big object which I parsed and I got the _embedded.messaging._links.sendMessage when the state (itemEvents._embedded.messaging.state) is equal 'Connected'.

With the above URL, I make the next request (POST) something like:

<hostname>/ucwa/oauth/v1/applications/10682720060/communication/conversations/f96afecd-8893-4cc2-a972-06bcd0b363cd/messaging/messages

Then I get the response bellow,

{"code":"NotFound","message":"The requested resource couldn\u0027t be found."}

Any help?

Many thanks

user3667143
  • 61
  • 1
  • 1
  • 4
  • You application is getting down, you should call reportMyActivity Api periodically to keep user online. And user must not be offline for sending message. And also check whether present user is offline or online, check user presence with /me/presence api. – curious_one Jul 30 '19 at 05:15

1 Answers1

0

I'm currently fighting with UCWA too and here's what I founded so far:

Question 1: Does someone knows where do I get the operationId param from?

When you create your app with "POST /ucwa/oauth/v1/applications", you get a response in JSON which is containing your OperationID. It will be in "_embedded" > "communication" section. But it's difficult to get, as the OperationID value is the key of the field with, for only clue "Please pass this in PUT request" as field value.

Because I didn't get the events URL I hard-coded it, so I could keep going on the following requests.

That's also in the create application response that you'll find the event link in "_links" > "events" section.

Here the example of application response:

{
    "culture":"en-US",
    "userAgent":"UCWA Test",
    "_links":{
        "self":{"href":"/ucwa/oauth/v1/applications/101********"},
        ...
        "events":{"href":"/ucwa/oauth/v1/applications/101********/events?ack=1"}
    },
    "_embedded":{
        "me":{
            ...
        },
        "people":{
            ...
        },
        "onlineMeetings":{
            ...
        },
        "communication":{
            "0000aaaa-00aa-00aa-00aa-000000aaaaaa":"please pass this in a PUT request",
            ...
        }
    },
    "rel":"application"
}

For the sending message error, I don't really know what could be involved in yours (do you have a HTTP status code?). Maybe check your header, the "Content-Type" one in particular, UCWA doesn't easily recognize what we send to it if the "Content-Type" header is not OK. It often results in a 500 error even if it should rather be a 400 or 415 error.

Teazane
  • 134
  • 2
  • 11