@linqapp/sdk 0.32.0 → 0.32.1
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/CHANGELOG.md +7 -0
- package/README.md +112 -82
- package/package.json +1 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.32.1](https://github.com/linq-team/linq-node/compare/v0.32.0...v0.32.1) (2026-07-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Documentation
|
|
7
|
+
|
|
8
|
+
* restructure README around getting started ([#96](https://github.com/linq-team/linq-node/issues/96)) ([1c41047](https://github.com/linq-team/linq-node/commit/1c41047b8c112a1a143f87886013d05093e03478))
|
|
9
|
+
|
|
3
10
|
## [0.32.0](https://github.com/linq-team/linq-node/compare/v0.31.0...v0.32.0) (2026-07-27)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -1,50 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>Linq</h1>
|
|
3
|
+
<p><strong>iMessage, RCS, and SMS from your backend.</strong></p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
The official TypeScript SDK for the Linq Partner API — typed access to chats, messages, attachments, phone numbers, payment requests, and webhooks.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@linqapp/sdk"><img src="https://img.shields.io/npm/v/@linqapp/sdk.svg?style=flat&colorA=1a1a1a&colorB=3178c6" alt="npm version" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@linqapp/sdk"><img src="https://img.shields.io/npm/dm/@linqapp/sdk.svg?style=flat&colorA=1a1a1a&colorB=3178c6" alt="npm downloads" /></a>
|
|
10
|
+
<a href="https://github.com/linq-team/linq-node/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@linqapp/sdk.svg?style=flat&colorA=1a1a1a&colorB=3178c6" alt="license" /></a>
|
|
11
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-4.9+-3178c6?style=flat&colorA=1a1a1a&colorB=3178c6" alt="TypeScript" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
## About Linq
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
**[Linq](https://linqapp.com)** is messaging infrastructure for businesses that want to talk to customers on the channels they already use. You get real phone numbers that send and receive native **iMessage** — with typing indicators, reactions, effects, and read receipts — and fall back to **RCS** and **SMS** when iMessage isn't available.
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
Learn more at **https://linqapp.com**.
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
## Getting Started
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40linqapp%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40linqapp%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22LINQ_API_V3_API_KEY%22%3A%22My%20API%20Key%22%2C%22LINQ_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)
|
|
23
|
+
1. Generate an API token at **[dashboard.linqapp.com/api-tooling](https://dashboard.linqapp.com/api-tooling)** (API → Overview → Generate new token).
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
2. Install the SDK:
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
```sh
|
|
28
|
+
npm install @linqapp/sdk
|
|
29
|
+
```
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
npm install @linqapp/sdk
|
|
24
|
-
```
|
|
31
|
+
3. Send your first message:
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
```ts
|
|
34
|
+
import LinqAPIV3 from '@linqapp/sdk';
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
const client = new LinqAPIV3({
|
|
37
|
+
apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
|
|
38
|
+
});
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
const { message } = await client.messages.create({
|
|
41
|
+
to: ['+14155559876'],
|
|
42
|
+
message: {
|
|
43
|
+
parts: [{ type: 'text', value: 'Hi! Thanks for reaching out — how can we help?' }],
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
console.log(message);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Sending to a handle you haven't messaged before creates the chat for you; `client.chats.create` gives you explicit control over group chats and the sending number.
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
Visit **[docs.linqapp.com](https://docs.linqapp.com)** for guides and the REST API reference. Every method, request param, and response field in this library is listed in **[api.md](api.md)** and documented in docstrings that appear on hover in most editors.
|
|
55
|
+
|
|
56
|
+
## Resources
|
|
57
|
+
|
|
58
|
+
| Resource | What it does |
|
|
59
|
+
| ----------------------------- | --------------------------------------------------------------- |
|
|
60
|
+
| `client.messages` | Send, edit, retrieve, delete messages; add reactions |
|
|
61
|
+
| `client.chats` | Create and update chats, participants, typing indicators, reads |
|
|
62
|
+
| `client.attachments` | Upload media to send as message parts |
|
|
63
|
+
| `client.phoneNumbers` | List and configure your sending numbers |
|
|
64
|
+
| `client.availableNumber` | Search numbers available to provision |
|
|
65
|
+
| `client.capability` | Check whether a handle can receive iMessage or RCS |
|
|
66
|
+
| `client.contactCard` | Read the contact card recipients see |
|
|
67
|
+
| `client.paymentRequests` | Request and collect payments in a chat |
|
|
68
|
+
| `client.webhookSubscriptions` | Manage webhook endpoints and subscribed events |
|
|
69
|
+
| `client.webhooks` | Verify and parse incoming webhook payloads |
|
|
70
|
+
|
|
71
|
+
## Webhooks
|
|
33
72
|
|
|
73
|
+
Inbound messages, reactions, and delivery updates arrive as webhooks. `client.webhooks.unwrap` verifies the signature and returns a typed, discriminated event:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
34
76
|
const client = new LinqAPIV3({
|
|
35
|
-
|
|
77
|
+
webhookSecret: process.env['LINQ_WEBHOOK_SECRET'], // This is the default and can be omitted
|
|
36
78
|
});
|
|
37
79
|
|
|
38
|
-
const
|
|
39
|
-
from: '+12052535597',
|
|
40
|
-
message: {},
|
|
41
|
-
to: ['+12052532136'],
|
|
42
|
-
});
|
|
80
|
+
const event = client.webhooks.unwrap(rawRequestBody, { headers: requestHeaders });
|
|
43
81
|
|
|
44
|
-
|
|
82
|
+
if (event.event_type === 'message.received') {
|
|
83
|
+
console.log(event.data);
|
|
84
|
+
}
|
|
45
85
|
```
|
|
46
86
|
|
|
47
|
-
|
|
87
|
+
Pass the **raw** request body — parsing it first breaks signature verification.
|
|
88
|
+
|
|
89
|
+
## Request & Response types
|
|
48
90
|
|
|
49
91
|
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
50
92
|
|
|
@@ -52,20 +94,15 @@ This library includes TypeScript definitions for all request params and response
|
|
|
52
94
|
```ts
|
|
53
95
|
import LinqAPIV3 from '@linqapp/sdk';
|
|
54
96
|
|
|
55
|
-
const client = new LinqAPIV3(
|
|
56
|
-
apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
|
|
57
|
-
});
|
|
97
|
+
const client = new LinqAPIV3();
|
|
58
98
|
|
|
59
|
-
const params: LinqAPIV3.
|
|
60
|
-
|
|
61
|
-
message: {},
|
|
62
|
-
to: ['+12052532136'],
|
|
99
|
+
const params: LinqAPIV3.MessageCreateParams = {
|
|
100
|
+
to: ['+14155559876'],
|
|
101
|
+
message: { parts: [{ type: 'text', value: 'Hello!' }] },
|
|
63
102
|
};
|
|
64
|
-
const
|
|
103
|
+
const response: LinqAPIV3.MessageCreateResponse = await client.messages.create(params);
|
|
65
104
|
```
|
|
66
105
|
|
|
67
|
-
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
68
|
-
|
|
69
106
|
## Handling errors
|
|
70
107
|
|
|
71
108
|
When the library is unable to connect to the API,
|
|
@@ -74,12 +111,8 @@ a subclass of `APIError` will be thrown:
|
|
|
74
111
|
|
|
75
112
|
<!-- prettier-ignore -->
|
|
76
113
|
```ts
|
|
77
|
-
const
|
|
78
|
-
.create({
|
|
79
|
-
from: '+12052535597',
|
|
80
|
-
message: {},
|
|
81
|
-
to: ['+12052532136'],
|
|
82
|
-
})
|
|
114
|
+
const message = await client.messages
|
|
115
|
+
.create({ to: ['+14155559876'], message: {} })
|
|
83
116
|
.catch(async (err) => {
|
|
84
117
|
if (err instanceof LinqAPIV3.APIError) {
|
|
85
118
|
console.log(err.status); // 400
|
|
@@ -120,11 +153,7 @@ const client = new LinqAPIV3({
|
|
|
120
153
|
});
|
|
121
154
|
|
|
122
155
|
// Or, configure per-request:
|
|
123
|
-
await client.
|
|
124
|
-
from: '+12052535597',
|
|
125
|
-
message: {},
|
|
126
|
-
to: ['+12052532136'],
|
|
127
|
-
}, {
|
|
156
|
+
await client.messages.create({ to: ['+14155559876'], message: {} }, {
|
|
128
157
|
maxRetries: 5,
|
|
129
158
|
});
|
|
130
159
|
```
|
|
@@ -141,11 +170,7 @@ const client = new LinqAPIV3({
|
|
|
141
170
|
});
|
|
142
171
|
|
|
143
172
|
// Override per-request:
|
|
144
|
-
await client.
|
|
145
|
-
from: '+12052535597',
|
|
146
|
-
message: {},
|
|
147
|
-
to: ['+12052532136'],
|
|
148
|
-
}, {
|
|
173
|
+
await client.messages.create({ to: ['+14155559876'], message: {} }, {
|
|
149
174
|
timeout: 5 * 1000,
|
|
150
175
|
});
|
|
151
176
|
```
|
|
@@ -185,6 +210,15 @@ while (page.hasNextPage()) {
|
|
|
185
210
|
}
|
|
186
211
|
```
|
|
187
212
|
|
|
213
|
+
## MCP Server
|
|
214
|
+
|
|
215
|
+
Use the Linq MCP Server to let AI assistants explore endpoints, make test requests, and use the documentation while integrating this SDK.
|
|
216
|
+
|
|
217
|
+
[](https://cursor.com/en-US/install-mcp?name=%40linqapp%2Fsdk-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBsaW5xYXBwL3Nkay1tY3AiXSwiZW52Ijp7IkxJTlFfQVBJX1YzX0FQSV9LRVkiOiJNeSBBUEkgS2V5IiwiTElOUV9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)
|
|
218
|
+
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40linqapp%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40linqapp%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22LINQ_API_V3_API_KEY%22%3A%22My%20API%20Key%22%2C%22LINQ_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)
|
|
219
|
+
|
|
220
|
+
> Note: You may need to set environment variables in your MCP client.
|
|
221
|
+
|
|
188
222
|
## Advanced Usage
|
|
189
223
|
|
|
190
224
|
### Accessing raw Response data (e.g., headers)
|
|
@@ -199,25 +233,17 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
|
|
|
199
233
|
```ts
|
|
200
234
|
const client = new LinqAPIV3();
|
|
201
235
|
|
|
202
|
-
const response = await client.
|
|
203
|
-
.create({
|
|
204
|
-
from: '+12052535597',
|
|
205
|
-
message: {},
|
|
206
|
-
to: ['+12052532136'],
|
|
207
|
-
})
|
|
236
|
+
const response = await client.messages
|
|
237
|
+
.create({ to: ['+14155559876'], message: {} })
|
|
208
238
|
.asResponse();
|
|
209
239
|
console.log(response.headers.get('X-My-Header'));
|
|
210
240
|
console.log(response.statusText); // access the underlying Response object
|
|
211
241
|
|
|
212
|
-
const { data:
|
|
213
|
-
.create({
|
|
214
|
-
from: '+12052535597',
|
|
215
|
-
message: {},
|
|
216
|
-
to: ['+12052532136'],
|
|
217
|
-
})
|
|
242
|
+
const { data: message, response: raw } = await client.messages
|
|
243
|
+
.create({ to: ['+14155559876'], message: {} })
|
|
218
244
|
.withResponse();
|
|
219
245
|
console.log(raw.headers.get('X-My-Header'));
|
|
220
|
-
console.log(
|
|
246
|
+
console.log(message);
|
|
221
247
|
```
|
|
222
248
|
|
|
223
249
|
### Logging
|
|
@@ -297,7 +323,7 @@ parameter. This library doesn't validate at runtime that the request matches the
|
|
|
297
323
|
send will be sent as-is.
|
|
298
324
|
|
|
299
325
|
```ts
|
|
300
|
-
client.
|
|
326
|
+
client.messages.create({
|
|
301
327
|
// ...
|
|
302
328
|
// @ts-expect-error baz is not yet public
|
|
303
329
|
baz: 'undocumented option',
|
|
@@ -395,20 +421,6 @@ const client = new LinqAPIV3({
|
|
|
395
421
|
});
|
|
396
422
|
```
|
|
397
423
|
|
|
398
|
-
## Frequently Asked Questions
|
|
399
|
-
|
|
400
|
-
## Semantic versioning
|
|
401
|
-
|
|
402
|
-
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
403
|
-
|
|
404
|
-
1. Changes that only affect static types, without breaking runtime behavior.
|
|
405
|
-
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
406
|
-
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
407
|
-
|
|
408
|
-
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
409
|
-
|
|
410
|
-
We are keen for your feedback; please open an [issue](https://www.github.com/linq-team/linq-node/issues) with questions, bugs, or suggestions.
|
|
411
|
-
|
|
412
424
|
## Requirements
|
|
413
425
|
|
|
414
426
|
TypeScript >= 4.9 is supported.
|
|
@@ -428,6 +440,24 @@ Note that React Native is not supported at this time.
|
|
|
428
440
|
|
|
429
441
|
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
|
|
430
442
|
|
|
443
|
+
## Semantic versioning
|
|
444
|
+
|
|
445
|
+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
446
|
+
|
|
447
|
+
1. Changes that only affect static types, without breaking runtime behavior.
|
|
448
|
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
449
|
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
450
|
+
|
|
451
|
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
452
|
+
|
|
453
|
+
## Issues
|
|
454
|
+
|
|
455
|
+
Found a bug or have a feature request? Please [open an issue](https://github.com/linq-team/linq-node/issues) on GitHub. Searching existing issues first helps avoid duplicates.
|
|
456
|
+
|
|
431
457
|
## Contributing
|
|
432
458
|
|
|
433
|
-
See [the contributing documentation](./CONTRIBUTING.md).
|
|
459
|
+
This library is generated with [Stainless](https://www.stainless.com/) from Linq's OpenAPI spec. See [the contributing documentation](./CONTRIBUTING.md) before opening a pull request.
|
|
460
|
+
|
|
461
|
+
## License
|
|
462
|
+
|
|
463
|
+
[Apache-2.0](./LICENSE) © [Linq](https://linqapp.com)
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.32.
|
|
1
|
+
export const VERSION = '0.32.1'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.32.
|
|
1
|
+
export declare const VERSION = "0.32.1";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.32.
|
|
1
|
+
export declare const VERSION = "0.32.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.32.
|
|
1
|
+
export const VERSION = '0.32.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|