Karix.io API wrapper for Node.js
The Karix.io API V2 Reference is a good resource to learn more about these APIs.
# Using npm
npm install --save karix-api
# Using yarn
yarn add karix-api
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
// }
// }
});
There are few ways to get help:
-
Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
-
For bug reports and feature requests, open issues. ๐
-
For direct and quick help, you can use Codementor. ๐
Creates the instance of the Karix
class.
- Object
options
: An object containing: accountId
(String): Karix Account ID (mandatory).accountToken
(String): Karix Account Token (mandatory)host
(String): Thekarix.io
host (default:https://api.karix.io/
).
Create a new subaccount
- Object
data
: The Subaccount object as documented here. - Function
cb
: The callback function.
Get a list of details of all subaccounts, including the main account.
- Object
params
: The query params as documented here. - Function
cb
: The callback function.
Get details of an account by its uid. Both main account and subaccounts can be fetched using their uids.
- String
uid
: Alphanumeric ID of the subaccount to get. - Function
cb
: The callback function.
Edit details of your account or its subaccount
- String
uid
: Alphanumeric ID of the subaccount to edit. - Object
data
: The Subaccount object (documented here). - Function
cb
: The callback function.
Send a message to a list of destinations.
- Object
data
: The Create Message object data (documented here). - Function
cb
: The callback function.
Get list of messages sent or received. Sorted by descending order of created_time (latest messages are first)
- Object
params
: The query params (documented here). - Function
cb
: The callback function.
Get message details by id.
- String
uid
: Alphanumeric ID of the message to get. - Function
cb
: The callback function.
Download or Stream media by id
- String
uid
: Alphanumeric ID of the media to get. - Function
cb
: The callback function.
Create webhooks to receive Message
- Object
data
: The Create Webhook object (documented here). - Function
cb
: The callback function.
Get a list of your webhooks
- Object
params
: The query params (documented here). - Function
cb
: The callback function.
Get a webhook by ID
- Object
params
: Alphanumeric ID of the webhook to get. - Function
cb
: The callback function.
Edit a webhook
- String
uid
: Alphanumeric ID of the webhook to edit. - Object
data
: The request body (documented here). - Function
cb
: The callback function.
Delete a webhook by ID
- String
uid
: Alphanumeric ID of the webhook to delete. - Function
cb
: The callback function.
Query for phone numbers in our inventory.
- Object
params
: The query params (documented here). - Function
cb
: The callback function.
Rent a phone number
- Object
data
: The Rent Details object (documented here). - Function
cb
: The callback function.
Get details of all phone numbers linked to your account.
- Object
params
: The query params data (documented here). - Function
cb
: The callback function.
Get details of a number
- Integer
number
: Number for which details need to be fetched. - Function
cb
: The callback function.
Edit phone number belonging to your account
- Integer
number
: Number which needs to be edited. - Object
data
: The request body object (documented here). - Function
cb
: The callback function.
Unrent number from your account
- Integer
number
: Number which needs to be unrented. - Function
cb
: The callback function.
Have an idea? Found a bug? See how to contribute.
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:
-
โYou can make one-time donations via PayPal. I'll probably buy a
coffeetea. ๐ต -
โ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! โค๏ธ
[MIT][license]