Coder Social home page Coder Social logo

karix-api's Introduction

karix-api

PayPal Ask me anything Version Downloads Get help on Codementor

Karix.io API wrapper for Node.js

The Karix.io API V2 Reference is a good resource to learn more about these APIs.

โ˜๏ธ Installation

# Using npm
npm install --save karix-api

# Using yarn
yarn add karix-api

๐Ÿ“‹ Example

const Karix = require("karix-api");

var client = new Karix({
    accountId: process.env.KARIX_ACCOUNT_ID
  , accountToken: process.env.KARIX_ACCOUNT_TOKEN

    // This is optional
  , host: process.env.KARIX_HOST || "https://api.karix.io/"
});

client.getSubaccount((err, data) => {
    console.log(err || data);
    // =>
    // {
	//	"objects": [
	//		{
	//		"name": "Beth Smith",
	//		"status": "enabled",
	//		"uid": "7fea9708-ea28-42e9-871f-a07fe7cef72f",
	//		"token": "e664221d-4aed-415b-929b-7edf887e4680",
	//		"is_parent": false,
	//		"created_time": "2017-08-04T09:59:29.660Z",
	//		"updated_time": "2017-08-05T09:59:29.660Z",
	//		"account_type": "prepaid",
	//		"credit_balance": "127.33",
	//		"auto_recharge": false
	//		}
	//	],
	//	"meta": {
	//		"request_uuid": "e54b13f5-0831-40f1-959f-e9c5a8ff2957",
	//		"next": "https://api.karix.co/<resource>/?limit=10&offset=10",
	//		"previous": "string",
	//		"total": 1
	//	}
	//	}
});

client.getSubaccountById({ uid: "7fea9708-ea28-42e9-871f-a07fe7cef72f" }, (err, data) => {
    console.log(err || data);
    // =>
	//	{
	//		"meta": {
	//			"request_uuid": "e54b13f5-0831-40f1-959f-e9c5a8ff2957"
	//		},
	//		"data": {
	//			"name": "Beth Smith",
	//			"status": "enabled",
	//			"uid": "7fea9708-ea28-42e9-871f-a07fe7cef72f",
	//			"token": "e664221d-4aed-415b-929b-7edf887e4680",
	//			"is_parent": false,
	//			"created_time": "2017-08-04T09:59:29.660Z",
	//			"updated_time": "2017-08-05T09:59:29.660Z",
	//			"account_type": "prepaid",
	//			"credit_balance": "127.33",
	//			"auto_recharge": false
	//		}
	//	}
});

โ“ Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.

  2. For bug reports and feature requests, open issues. ๐Ÿ›

  3. For direct and quick help, you can use Codementor. ๐Ÿš€

๐Ÿ“ Documentation

Karix(options)

Creates the instance of the Karix class.

Params

  • Object options: An object containing:
  • accountId (String): Karix Account ID (mandatory).
  • accountToken (String): Karix Account Token (mandatory)
  • host (String): The karix.io host (default: https://api.karix.io/).

createSubaccount(data, cb)

Create a new subaccount

Params

  • Object data: The Subaccount object as documented here.
  • Function cb: The callback function.

getSubaccount(params, cb)

Get a list of details of all subaccounts, including the main account.

Params

  • Object params: The query params as documented here.
  • Function cb: The callback function.

getSubaccountById(uid, cb)

Get details of an account by its uid. Both main account and subaccounts can be fetched using their uids.

Params

  • String uid: Alphanumeric ID of the subaccount to get.
  • Function cb: The callback function.

patchSubaccount(uid, data, cb)

Edit details of your account or its subaccount

Params

  • String uid: Alphanumeric ID of the subaccount to edit.
  • Object data: The Subaccount object (documented here).
  • Function cb: The callback function.

sendMessage(data, cb)

Send a message to a list of destinations.

Params

  • Object data: The Create Message object data (documented here).
  • Function cb: The callback function.

getMessage(params, cb)

Get list of messages sent or received. Sorted by descending order of created_time (latest messages are first)

Params

  • Object params: The query params (documented here).
  • Function cb: The callback function.

getMessageById(uid, cb)

Get message details by id.

Params

  • String uid: Alphanumeric ID of the message to get.
  • Function cb: The callback function.

getMedia(uid, cb)

Download or Stream media by id

Params

  • String uid: Alphanumeric ID of the media to get.
  • Function cb: The callback function.

createWebhook(data, cb)

Create webhooks to receive Message

Params

  • Object data: The Create Webhook object (documented here).
  • Function cb: The callback function.

getWebhook(params, cb)

Get a list of your webhooks

Params

  • Object params: The query params (documented here).
  • Function cb: The callback function.

getWebhookById(uid, cb)

Get a webhook by ID

Params

  • Object params: Alphanumeric ID of the webhook to get.
  • Function cb: The callback function.

patchWebhook(uid, data, cb)

Edit a webhook

Params

  • String uid: Alphanumeric ID of the webhook to edit.
  • Object data: The request body (documented here).
  • Function cb: The callback function.

deleteWebhookById(uid, cb)

Delete a webhook by ID

Params

  • String uid: Alphanumeric ID of the webhook to delete.
  • Function cb: The callback function.

numberSearch(params, cb)

Query for phone numbers in our inventory.

Params

  • Object params: The query params (documented here).
  • Function cb: The callback function.

rentNumber(data, cb)

Rent a phone number

Params

  • Object data: The Rent Details object (documented here).
  • Function cb: The callback function.

getNumber(params, cb)

Get details of all phone numbers linked to your account.

Params

  • Object params: The query params data (documented here).
  • Function cb: The callback function.

number(number, cb)

Get details of a number

Params

  • Integer number: Number for which details need to be fetched.
  • Function cb: The callback function.

patchNumber(number, data, cb)

Edit phone number belonging to your account

Params

  • Integer number: Number which needs to be edited.
  • Object data: The request body object (documented here).
  • Function cb: The callback function.

unrentNumber(number, cb)

Unrent number from your account

Params

  • Integer number: Number which needs to be unrented.
  • Function cb: The callback function.

๐Ÿ˜‹ How to contribute

Have an idea? Found a bug? See how to contribute.

๐Ÿ’– Support my projects

I do web services and open-source my used projects as much as I can. I will try to reply to everyone needing help using these projects. It consumes a lot of time and hardwork. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • PayPalโ€”You can make one-time donations via PayPal. I'll probably buy a coffee tea. ๐Ÿต

  • Support me on Patreonโ€”Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).

  • Bitcoinโ€”You can send me bitcoins at this address (or scanning the code below): 344FWmvxDt6FFFoYoFjftiT3gGus68AqNw

Thank you! โค๏ธ

๐Ÿ“œ License

[MIT][license]

karix-api's People

Contributors

imjeffparedes avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.