@nandansravesh/sendgrid-core 0.0.1 → 0.0.3
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/README.md +49 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @nandansravesh/sendgrid-core
|
|
2
|
+
|
|
3
|
+
Core library for sending Telegram messages via the Bot API. Provides Zod-validated schemas, TypeScript types, and a single async function.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Send Telegram messages with Zod runtime validation
|
|
8
|
+
- Zero HTTP boilerplate — handles the Telegram Bot API for you
|
|
9
|
+
- Full TypeScript support with inferred types
|
|
10
|
+
- Lightweight, no external HTTP dependencies (uses native `fetch`)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @nandansravesh/sendgrid-core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { sendTelegramMessage } from "@nandansravesh/sendgrid-core";
|
|
22
|
+
|
|
23
|
+
const result = await sendTelegramMessage({
|
|
24
|
+
chatId: "123456789",
|
|
25
|
+
message: "Hello from sendgrid-core!",
|
|
26
|
+
botToken: "YOUR_BOT_TOKEN",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
console.log(result);
|
|
30
|
+
// { ok: true, chatId: "123456789", messageId: "42" }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### `sendTelegramMessage(options)`
|
|
36
|
+
|
|
37
|
+
| Param | Type | Description |
|
|
38
|
+
|----------|----------|----------------------------|
|
|
39
|
+
| chatId | `string` | Telegram chat ID |
|
|
40
|
+
| message | `string` | Message text to send |
|
|
41
|
+
| botToken | `string` | Telegram Bot API token |
|
|
42
|
+
|
|
43
|
+
Returns `Promise<{ ok: true; chatId: string; messageId: string }>`.
|
|
44
|
+
|
|
45
|
+
Throws on invalid input or Telegram API errors.
|
|
46
|
+
|
|
47
|
+
## Keywords
|
|
48
|
+
|
|
49
|
+
sendgrid telegram bot api messaging typescript zod validation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nandansravesh/sendgrid-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"exports": {
|
|
15
|
-
".": "./
|
|
15
|
+
".": "./dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsdown",
|