@taysend/sdk 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +25 -2
- package/dist/index.d.ts +112 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Taysend
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @taysend/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node.js client for the [Taysend](https://taysend.com) SMS API.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @taysend/sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { SmsClient } from "@taysend/sdk";
|
|
11
|
+
|
|
12
|
+
const sms = new SmsClient({ apiKey: process.env.TAYSEND_KEY });
|
|
13
|
+
|
|
14
|
+
const message = await sms.messages.send({
|
|
15
|
+
to: "+233200000001",
|
|
16
|
+
senderId: "TAYSEND",
|
|
17
|
+
message: "Hello from Taysend",
|
|
18
|
+
type: "transactional",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log(message.id, message.status);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`baseUrl` defaults to `https://api.taysend.com`. Pass `baseUrl` to point at another host.
|
|
25
|
+
|
|
26
|
+
Docs: https://taysend.com/developers/nodejs
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export interface SmsClientOptions {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
fetch?: typeof fetch;
|
|
5
|
+
}
|
|
6
|
+
export interface SendMessageInput {
|
|
7
|
+
/** One number. Use `recipients` instead to send the same body to many. */
|
|
8
|
+
to?: string;
|
|
9
|
+
/** 1–100 numbers. Response is `{ count, data }`. */
|
|
10
|
+
recipients?: string[];
|
|
11
|
+
senderId: string;
|
|
12
|
+
/** Required unless `templateId` is set. */
|
|
13
|
+
message?: string;
|
|
14
|
+
templateId?: string;
|
|
15
|
+
/** Merge keys for `{{order_id}}` and similar. Contact name/phone fill automatically when the number is in the book. */
|
|
16
|
+
variables?: Record<string, string>;
|
|
17
|
+
/** ISO timestamp. Past or missing = send now. */
|
|
18
|
+
scheduledAt?: string;
|
|
19
|
+
type?: "otp" | "transactional" | "marketing" | "alert" | "service";
|
|
20
|
+
callbackUrl?: string;
|
|
21
|
+
metadata?: Record<string, string>;
|
|
22
|
+
clientReference?: string;
|
|
23
|
+
idempotencyKey?: string;
|
|
24
|
+
/** Snake_case aliases accepted so copy-paste from the HTTP docs works. */
|
|
25
|
+
sender_id?: string;
|
|
26
|
+
template_id?: string;
|
|
27
|
+
scheduled_at?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface MessageResponse {
|
|
30
|
+
id: string;
|
|
31
|
+
status: string;
|
|
32
|
+
to: string;
|
|
33
|
+
sender_id?: string;
|
|
34
|
+
from?: string;
|
|
35
|
+
segments: number;
|
|
36
|
+
encoding: string;
|
|
37
|
+
estimated_cost?: {
|
|
38
|
+
amount: string;
|
|
39
|
+
currency: string;
|
|
40
|
+
};
|
|
41
|
+
estimated_price?: string;
|
|
42
|
+
currency?: string;
|
|
43
|
+
created_at: string;
|
|
44
|
+
}
|
|
45
|
+
export interface BulkMessageResponse {
|
|
46
|
+
count: number;
|
|
47
|
+
data: MessageResponse[];
|
|
48
|
+
}
|
|
49
|
+
export type SendMessageResult = MessageResponse | BulkMessageResponse;
|
|
50
|
+
export declare function isBulkSend(result: SendMessageResult): result is BulkMessageResponse;
|
|
51
|
+
export interface LookupResponse {
|
|
52
|
+
e164: string;
|
|
53
|
+
valid: boolean;
|
|
54
|
+
validation_status: string;
|
|
55
|
+
country: string | null;
|
|
56
|
+
estimated_network: string | null;
|
|
57
|
+
carrier_resolution: string;
|
|
58
|
+
reason: string;
|
|
59
|
+
}
|
|
60
|
+
export interface TaysendErrorBody {
|
|
61
|
+
error: {
|
|
62
|
+
code: string;
|
|
63
|
+
message: string;
|
|
64
|
+
request_id?: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export declare class TaysendError extends Error {
|
|
68
|
+
readonly status: number;
|
|
69
|
+
readonly code: string;
|
|
70
|
+
readonly requestId?: string;
|
|
71
|
+
constructor(status: number, body: TaysendErrorBody | string);
|
|
72
|
+
}
|
|
73
|
+
export declare function verifyWebhookSignature(opts: {
|
|
74
|
+
secret: string;
|
|
75
|
+
header: string;
|
|
76
|
+
rawBody: string;
|
|
77
|
+
toleranceSeconds?: number;
|
|
78
|
+
nowSeconds?: number;
|
|
79
|
+
}): boolean;
|
|
80
|
+
export declare class SmsClient {
|
|
81
|
+
private readonly apiKey;
|
|
82
|
+
private readonly baseUrl;
|
|
83
|
+
private readonly fetchImpl;
|
|
84
|
+
constructor(options: SmsClientOptions);
|
|
85
|
+
get messages(): {
|
|
86
|
+
send: (input: SendMessageInput) => Promise<SendMessageResult>;
|
|
87
|
+
get: (id: string) => Promise<MessageResponse>;
|
|
88
|
+
list: (query?: Record<string, string>) => Promise<{
|
|
89
|
+
items: MessageResponse[];
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
get verify(): {
|
|
93
|
+
send: (input: {
|
|
94
|
+
to: string;
|
|
95
|
+
senderId?: string;
|
|
96
|
+
locale?: string;
|
|
97
|
+
}) => Promise<unknown>;
|
|
98
|
+
check: (input: {
|
|
99
|
+
verificationId: string;
|
|
100
|
+
code: string;
|
|
101
|
+
}) => Promise<unknown>;
|
|
102
|
+
};
|
|
103
|
+
get balance(): {
|
|
104
|
+
get: () => Promise<unknown>;
|
|
105
|
+
};
|
|
106
|
+
/** Prefix network estimate (MTN / Telecel / AT). Not HLR. */
|
|
107
|
+
lookup(to: string): Promise<LookupResponse>;
|
|
108
|
+
private send;
|
|
109
|
+
private request;
|
|
110
|
+
}
|
|
111
|
+
export declare function createClient(options: SmsClientOptions): SmsClient;
|
|
112
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;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,CAAe;gBAE7B,OAAO,EAAE,gBAAgB;IAMrC,IAAI,QAAQ;sBAEM,gBAAgB;kBACpB,MAAM;uBACD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;mBACb,eAAe,EAAE;;MAE5C;IAED,IAAI,MAAM;sBAEQ;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE;uBAMjD;YAAE,cAAc,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;MAM1D;IAED,IAAI,OAAO;;MAIV;IAED,6DAA6D;IAC7D,MAAM,CAAC,EAAE,EAAE,MAAM;YAIH,IAAI;YAoBJ,OAAO;CAwBtB;AASD,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAEjE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
+
export function isBulkSend(result) {
|
|
3
|
+
return typeof result === "object" && result !== null && "data" in result && Array.isArray(result.data);
|
|
4
|
+
}
|
|
5
|
+
export class TaysendError extends Error {
|
|
6
|
+
status;
|
|
7
|
+
code;
|
|
8
|
+
requestId;
|
|
9
|
+
constructor(status, body) {
|
|
10
|
+
const parsed = typeof body === "string" ? undefined : body.error;
|
|
11
|
+
super(parsed?.message ?? (typeof body === "string" ? body : "Taysend request failed"));
|
|
12
|
+
this.name = "TaysendError";
|
|
13
|
+
this.status = status;
|
|
14
|
+
this.code = parsed?.code ?? `HTTP_${status}`;
|
|
15
|
+
this.requestId = parsed?.request_id;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function verifyWebhookSignature(opts) {
|
|
19
|
+
const tolerance = opts.toleranceSeconds ?? 300;
|
|
20
|
+
const now = opts.nowSeconds ?? Math.floor(Date.now() / 1000);
|
|
21
|
+
const parts = Object.fromEntries(opts.header.split(",").map((p) => {
|
|
22
|
+
const [k, v] = p.split("=");
|
|
23
|
+
return [k?.trim() ?? "", v?.trim() ?? ""];
|
|
24
|
+
}));
|
|
25
|
+
const timestamp = Number(parts.t);
|
|
26
|
+
const signature = parts.v1;
|
|
27
|
+
if (!timestamp || !signature || Number.isNaN(timestamp))
|
|
28
|
+
return false;
|
|
29
|
+
if (Math.abs(now - timestamp) > tolerance)
|
|
30
|
+
return false;
|
|
31
|
+
const expected = createHmac("sha256", opts.secret).update(`${timestamp}.${opts.rawBody}`).digest("hex");
|
|
32
|
+
const left = Buffer.from(expected);
|
|
33
|
+
const right = Buffer.from(signature);
|
|
34
|
+
if (left.length !== right.length)
|
|
35
|
+
return false;
|
|
36
|
+
return timingSafeEqual(left, right);
|
|
37
|
+
}
|
|
38
|
+
export class SmsClient {
|
|
39
|
+
apiKey;
|
|
40
|
+
baseUrl;
|
|
41
|
+
fetchImpl;
|
|
42
|
+
constructor(options) {
|
|
43
|
+
this.apiKey = options.apiKey;
|
|
44
|
+
this.baseUrl = (options.baseUrl ?? "https://api.taysend.com").replace(/\/$/, "");
|
|
45
|
+
this.fetchImpl = options.fetch ?? fetch;
|
|
46
|
+
}
|
|
47
|
+
get messages() {
|
|
48
|
+
return {
|
|
49
|
+
send: (input) => this.send(input),
|
|
50
|
+
get: (id) => this.request("GET", `/v1/messages/${id}`),
|
|
51
|
+
list: (query) => this.request("GET", `/v1/messages${qs(query)}`),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
get verify() {
|
|
55
|
+
return {
|
|
56
|
+
send: (input) => this.request("POST", "/v1/verify/send", {
|
|
57
|
+
to: input.to,
|
|
58
|
+
sender_id: input.senderId,
|
|
59
|
+
locale: input.locale,
|
|
60
|
+
}),
|
|
61
|
+
check: (input) => this.request("POST", "/v1/verify/check", {
|
|
62
|
+
verification_id: input.verificationId,
|
|
63
|
+
code: input.code,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
get balance() {
|
|
68
|
+
return {
|
|
69
|
+
get: () => this.request("GET", "/v1/balance"),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Prefix network estimate (MTN / Telecel / AT). Not HLR. */
|
|
73
|
+
lookup(to) {
|
|
74
|
+
return this.request("GET", `/v1/lookup${qs({ to })}`);
|
|
75
|
+
}
|
|
76
|
+
async send(input) {
|
|
77
|
+
const senderId = input.senderId || input.sender_id;
|
|
78
|
+
const templateId = input.templateId ?? input.template_id;
|
|
79
|
+
const scheduledAt = input.scheduledAt ?? input.scheduled_at;
|
|
80
|
+
const body = {
|
|
81
|
+
sender_id: senderId,
|
|
82
|
+
type: input.type,
|
|
83
|
+
callback_url: input.callbackUrl,
|
|
84
|
+
metadata: input.metadata,
|
|
85
|
+
client_reference: input.clientReference,
|
|
86
|
+
};
|
|
87
|
+
if (input.recipients?.length)
|
|
88
|
+
body.recipients = input.recipients;
|
|
89
|
+
else if (input.to)
|
|
90
|
+
body.to = input.to;
|
|
91
|
+
if (templateId)
|
|
92
|
+
body.template_id = templateId;
|
|
93
|
+
if (input.message)
|
|
94
|
+
body.message = input.message;
|
|
95
|
+
if (input.variables)
|
|
96
|
+
body.variables = input.variables;
|
|
97
|
+
if (scheduledAt)
|
|
98
|
+
body.scheduled_at = scheduledAt;
|
|
99
|
+
return this.request("POST", "/v1/messages", body, input.idempotencyKey);
|
|
100
|
+
}
|
|
101
|
+
async request(method, path, body, idempotencyKey) {
|
|
102
|
+
const headers = {
|
|
103
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
104
|
+
Accept: "application/json",
|
|
105
|
+
};
|
|
106
|
+
if (body !== undefined)
|
|
107
|
+
headers["Content-Type"] = "application/json";
|
|
108
|
+
if (idempotencyKey)
|
|
109
|
+
headers["Idempotency-Key"] = idempotencyKey;
|
|
110
|
+
const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
111
|
+
method,
|
|
112
|
+
headers,
|
|
113
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
114
|
+
});
|
|
115
|
+
const text = await response.text();
|
|
116
|
+
const parsed = text ? JSON.parse(text) : {};
|
|
117
|
+
if (!response.ok) {
|
|
118
|
+
throw new TaysendError(response.status, parsed);
|
|
119
|
+
}
|
|
120
|
+
return parsed;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function qs(query) {
|
|
124
|
+
if (!query)
|
|
125
|
+
return "";
|
|
126
|
+
const params = new URLSearchParams(query);
|
|
127
|
+
const s = params.toString();
|
|
128
|
+
return s ? `?${s}` : "";
|
|
129
|
+
}
|
|
130
|
+
export function createClient(options) {
|
|
131
|
+
return new SmsClient(options);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqD1D,MAAM,UAAU,UAAU,CAAC,MAAyB;IAClD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzG,CAAC;AAgBD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,MAAM,CAAS;IACf,IAAI,CAAS;IACb,SAAS,CAAU;IAE5B,YAAY,MAAc,EAAE,IAA+B;QACzD,MAAM,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACjE,KAAK,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACvF,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC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MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,MAA0B,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,MAAW,CAAC;IACrB,CAAC;CACF;AAED,SAAS,EAAE,CAAC,KAA8B;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC5B,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAyB;IACpD,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taysend/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Node.js client for the Taysend SMS API. Send messages, check delivery, and verify OTP.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
16
|
+
"engines": { "node": ">=20.11" },
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.build.json",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"lint": "tsc --noEmit",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.8.3"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://taysend.com/developers/nodejs",
|
|
27
|
+
"keywords": ["sms", "ghana", "taysend", "otp", "bulk-sms"],
|
|
28
|
+
"publishConfig": { "access": "public" }
|
|
29
|
+
}
|