Skip to content

sakhro/phonet-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHONET SDK

version node yarn

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 dashboard
  • apiKey - 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published