phonet-sdk
v1.1.5
Published
SDK for Phonet telecommunication system
Downloads
5
Readme
PHONET SDK
How to use
Setup
Install it:
yarn add phonet-sdk
Initialize:
services/phonet.js
import Phonet from 'phonet-sdk'
const default Phonet({
domain: 'test4.phonet.com.ua',
apiKey: 'bHGbn240QSjFJgydW0WyZ3v6UeNDT8CV'
})
Phonet
object recived the following properties:
domain
- your api server from the Phonet dashboardapiKey
- your api key from the Phonet dashboard
Usage
WebSockets
Subscribe for call
import Phonet from 'services/phonet.js'
const id = '007'
const socket = await Phonet.wss.subscribeToCall(id)
subscribeToCall
method recived the following properties:
id
- user id to subscribe
Teler CRM
Write contacts
import Phonet from 'services/phonet.js'
const data = {
merge : 1,
contacts : [{
id: 7068,
lastModified: 1443597876359,
responsibleUserId: 18,
createUserId: 59,
fields: [{
id: 32134,
enumCode: 'Category',
values: [{
id: 12334,
enumValueCode: 'Category',
lastModified: 1443597876359,
value: 'EMPL'
}]
}]
}]
}
const res = await Phonet.teler.postContacts(data)
postContacts
method recived the following properties:
data
- for more information please see Phonet documentation :p
Search contact by phone number
import Phonet from 'services/phonet.js'
const phoneNumber = '+380111222333'
const contact = await Phonet.teler.searchContactByPhoneNumber(phoneNumber)
searchContactByPhoneNumber
method recived the following properties:
phoneNumber
- contact phone number