@dawntech/blip-tools 0.1.7 → 0.1.8
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 +5 -0
- package/dist/index.js +23 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -55,4 +55,9 @@ export default class Blip {
|
|
|
55
55
|
identity: string;
|
|
56
56
|
}): Promise<void>;
|
|
57
57
|
getWhatsAppIdentity(phone: string): Promise<string>;
|
|
58
|
+
createTrackEvent({ category, action, identity }: {
|
|
59
|
+
category: string;
|
|
60
|
+
action: string;
|
|
61
|
+
identity?: string;
|
|
62
|
+
}): Promise<void>;
|
|
58
63
|
}
|
package/dist/index.js
CHANGED
|
@@ -202,4 +202,27 @@ export default class Blip {
|
|
|
202
202
|
throw handleError(error);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
async createTrackEvent({ category, action, identity }) {
|
|
206
|
+
try {
|
|
207
|
+
const body = {
|
|
208
|
+
id: randomUUID(),
|
|
209
|
+
to: 'postmaster@analytics.msging.net',
|
|
210
|
+
method: 'set',
|
|
211
|
+
type: 'application/vnd.iris.eventTrack+json',
|
|
212
|
+
uri: '/event-track',
|
|
213
|
+
resource: {
|
|
214
|
+
category,
|
|
215
|
+
action,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
if (identity && body.resource) {
|
|
219
|
+
body.resource.contact = { identity };
|
|
220
|
+
}
|
|
221
|
+
const response = await this.api.post('/commands', body);
|
|
222
|
+
validateResponse(response);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
throw handleError(error);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
205
228
|
}
|