@dawntech/blip-tools 0.1.10 → 0.1.11

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/dist/index.d.ts CHANGED
@@ -48,6 +48,11 @@ export default class Blip {
48
48
  identity: string;
49
49
  content: string;
50
50
  }): Promise<void>;
51
+ sendMessageWithButtons({ identity, message, buttons, }: {
52
+ identity: string;
53
+ message: string;
54
+ buttons: string[];
55
+ }): Promise<void>;
51
56
  updateContact({ identity, contactData }: {
52
57
  identity: string;
53
58
  contactData: Record<string, unknown>;
package/dist/index.js CHANGED
@@ -142,6 +142,24 @@ export default class Blip {
142
142
  handleError(error);
143
143
  }
144
144
  }
145
+ async sendMessageWithButtons({ identity, message, buttons, }) {
146
+ try {
147
+ const response = await this.api.post('/messages', {
148
+ id: randomUUID(),
149
+ to: identity,
150
+ type: 'application/vnd.lime.select+json',
151
+ content: {
152
+ scope: buttons.length <= 3 ? 'immediate' : null,
153
+ text: message,
154
+ options: buttons.map((button, index) => ({ order: index + 1, text: button })),
155
+ },
156
+ });
157
+ validateResponse(response);
158
+ }
159
+ catch (error) {
160
+ handleError(error);
161
+ }
162
+ }
145
163
  async updateContact({ identity, contactData }) {
146
164
  try {
147
165
  const response = await this.api.post('/commands', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dawntech/blip-tools",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Node package for Blip API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",