How can I associate the call data from the RingCentral API to the user data in the Glip API. As far as I can tell, the only overlap is the proper names located in the call logs to and from fields (which aren't always present), which can be mapped to an email address and then to a Glip user. This seems like a very indirect way of going about things. Are there ids or anything like that to link the two APIs? Specifically I'd like to know if a call that's coming from or going to a person is also a Glip user in my organization.
RingCentral Call Log API Example
https://developer.ringcentral.com/api-reference#Call-Log-loadCompanyCallLog
GET /restapi/v1.0/account/~/call-log
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/call-log?view=Simple&showBlocked=true&withRecording=false&dateFrom=2018-11-09T07:00:00.000Z&page=1&perPage=100",
"records": [
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/call-log/abcdef0123456789?view=Simple",
"id": "abcdef0123456789",
"sessionId": "1234567890",
"startTime": "2018-11-10T00:52:07.020Z",
"duration": 11,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Missed",
"to": {
"phoneNumber": "+16505550100"
},
"from": {
"phoneNumber": "+12155550101",
"location": "Philadelphia, PA"
}
},
Glip Post API Example
https://developer.ringcentral.com/api-reference#Posts-listGlipGroupPosts
GET /restapi/v1.0/glip/groups/{groupId}/posts
{
"records":[
{
"id":"1542094852",
"groupId":"155654",
"type":"TextMessage",
"text":"",
"creatorId":"glip-29507587",
"addedPersonIds":null,
"creationTime":"2018-05-31T14:45:16.822Z",
"lastModifiedTime":"2018-05-31T14:45:16.822Z",
"attachments":null,
"activity":null,
"title":null,
"iconUri":null,
"iconEmoji":null,
"mentions":null
}
]
}
Users are identified by the Call Log extensionId and the Glip personId which have the same value when the user is a company user.
extensionId.
/restapi/v1.0/account/{accountId}/call-log), you will receive call logs for all users and, to identify calls for each user, you need to query the detailed view by adding the view=Detailed query string parameter and then find the extensionId in the call legs array since multiple users can be present in a call. Each leg will have an extension property with a extensionId and HATEOAS uri property to retrieve information for the user./restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log), the extensionId is explicitly stated in the URL path.personId. The personId appears as the creatorId and in other places in the Glip API.
personId value is the same as the extensionId, e.g. 12345678personId value is prefixed by glip-, e.g. glip-12345678Here's an example of a detailed Company Call Log entry:
GET /restapi/v1.0/account/~/call-log?view=Detailed
{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/call-log?view=Detailed&showBlocked=true&withRecording=false&dateFrom=2018-11-09T07:37:00.000Z&page=1&perPage=100",
"records":[
{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/call-log/abcdef0123456789?view=Detailed",
"id":"abcdef0123456789",
"sessionId":"19923257004",
"startTime":"2018-11-10T00:52:07.020Z",
"duration":11,
"type":"Voice",
"direction":"Inbound",
"action":"Phone Call",
"result":"Missed",
"to":{
"phoneNumber":"+16505550100"
},
"from":{
"phoneNumber":"+12155550101",
"location":"Philadelphia, PA"
},
"transport":"PSTN",
"lastModifiedTime":"2018-11-10T00:52:40.001Z",
"billing":{
"costIncluded":0,
"costPurchased":0
},
"legs":[
{
"startTime":"2018-11-10T00:52:07.020Z",
"duration":11,
"type":"Voice",
"direction":"Inbound",
"action":"Phone Call",
"result":"Missed",
"to":{
"phoneNumber":"+12675550100"
},
"from":{
"phoneNumber":"+12155550101",
"location":"Philadelphia, PA"
},
"transport":"PSTN",
"billing":{
"costIncluded":0,
"costPurchased":0
},
"legType":"Accept",
"master":true
},
{
"startTime":"2018-11-10T00:52:07.050Z",
"duration":11,
"type":"Voice",
"direction":"Inbound",
"action":"Phone Call",
"result":"Missed",
"to":{
"phoneNumber":"+12679304030",
"name":"Sales Queue"
},
"from":{
"phoneNumber":"+12155550101",
"location":"Philadelphia, PA"
},
"extension":{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222",
"id":22222222
},
"transport":"PSTN",
"legType":"Accept"
},
{
"startTime":"2018-11-10T00:52:15.220Z",
"duration":3,
"type":"Voice",
"direction":"Outbound",
"action":"FindMe",
"result":"Accepted",
"to":{
"phoneNumber":"+16505550100",
"location":"Redwood City, CA"
},
"from":{
"phoneNumber":"+12675550100",
"name":"Tiger RingForce"
},
"extension":{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/111111111/extension/33333333",
"id":33333333
},
"transport":"PSTN",
"legType":"FindMe"
},
{
"startTime":"2018-11-10T00:52:15.257Z",
"duration":3,
"type":"Voice",
"direction":"Outbound",
"action":"FindMe",
"result":"Accepted",
"to":{
"phoneNumber":"+18185550100",
"location":"North Hollywood, CA"
},
"from":{
"phoneNumber":"+12675550100",
"name":"Tiger RingForce"
},
"extension":{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/130709004/extension/130836004",
"id":130836004
},
"transport":"PSTN",
"legType":"FindMe"
}
]
}
]
}
To map to a Glip user, just map it to Glip users with the personId that matches the Call Log extensionId.