@saysimple/node-sdk
Advanced tools
Comparing version
# 🚧 Changelog 🚧 | ||
## Latest | ||
**19 January 2021** | ||
**5 march 2021** | ||
- Added active contacts distributions | ||
## V0.0.8 | ||
**3 march 2021** | ||
- Added conversations tags used | ||
## V0.0.7 | ||
**14 January 2021** | ||
@@ -8,0 +13,0 @@ - Added average messages response times |
@@ -17,2 +17,3 @@ import { Domain } from "../domain"; | ||
getActiveContactsSummed(opts?: MetricConversationParametersInterface): Promise<MetricDataResponseInterface>; | ||
getActiveContactsDistribution(opts?: MetricConversationParametersInterface): Promise<MetricDataResponseInterface>; | ||
getSentPaidTemplatesSummed(opts?: MetricParametersInterface): Promise<MetricDataResponseInterface>; | ||
@@ -19,0 +20,0 @@ getAgents(): Promise<Response<AgentList>>; |
@@ -89,2 +89,5 @@ "use strict"; | ||
}; | ||
Intelligence.prototype.getActiveContactsDistribution = function (opts) { | ||
return this.getData("/metrics/active-contacts/distribution", opts); | ||
}; | ||
Intelligence.prototype.getSentPaidTemplatesSummed = function (opts) { | ||
@@ -91,0 +94,0 @@ return this.getData("/metrics/messages/sent-paid-templates/sum", opts); |
@@ -6,3 +6,3 @@ { | ||
"repository": "https://github.com/saysimple/node-sdk", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "The official SaySimple Node SDK. Want to use our awesome customer conversations platform? Please visit: https://saysimple.com", | ||
@@ -9,0 +9,0 @@ "main": "dist/index.js", |
@@ -41,2 +41,6 @@ import { Domain } from "../domain"; | ||
public getActiveContactsDistribution(opts?: MetricConversationParametersInterface): Promise<MetricDataResponseInterface> { | ||
return this.getData<MetricDataResponseInterface, MetricConversationParametersInterface>("/metrics/active-contacts/distribution", opts); | ||
} | ||
public getSentPaidTemplatesSummed(opts?: MetricParametersInterface): Promise<MetricDataResponseInterface> { | ||
@@ -43,0 +47,0 @@ return this.getData<MetricDataResponseInterface, MetricParametersInterface>("/metrics/messages/sent-paid-templates/sum", opts); |
@@ -175,2 +175,22 @@ import { | ||
it("should be able to get active contacts distributions", async () => { | ||
const mockedClient = new HttpClient(); | ||
jest.spyOn(mockedClient, "get").mockResolvedValue(new Response(200, expectedBody)); | ||
const options: MetricConversationParametersInterface = { | ||
between : "2020-05-21T20:25:10+02:00", | ||
and : "2020-06-20T20:25:10+02:00", | ||
channel : [ "WHATSAPP" ], | ||
identifier : "*", | ||
}; | ||
const client = new Intelligence(mockedClient); | ||
const result = await client.getActiveContactsDistribution(options); | ||
expect(mockedClient.get).toBeCalledWith("/metrics/active-contacts/distribution", options); | ||
expect(result).toEqual(expectedBody); | ||
}); | ||
it("should be able to get agents", async () => { | ||
@@ -368,6 +388,6 @@ const mockedClient = new HttpClient(); | ||
const options: MetricMessageParametersInterface = { | ||
between : "2020-05-21T20:25:10+02:00", | ||
and : "2020-06-20T20:25:10+02:00", | ||
conversation: ["8"], | ||
identifier : "*", | ||
between : "2020-05-21T20:25:10+02:00", | ||
and : "2020-06-20T20:25:10+02:00", | ||
conversation : [ "8" ], | ||
identifier : "*", | ||
}; | ||
@@ -389,4 +409,4 @@ | ||
const options: MetricMessageParametersInterface = { | ||
between : "2020-05-21T20:25:10+02:00", | ||
and : "2020-06-20T20:25:10+02:00" | ||
between : "2020-05-21T20:25:10+02:00", | ||
and : "2020-06-20T20:25:10+02:00" | ||
}; | ||
@@ -393,0 +413,0 @@ |
102805
1.37%1896
1.12%