Skip to content

Commit

Permalink
Merge pull request #307 from plivo/SMS-6010
Browse files Browse the repository at this point in the history
SMS-6010: Add DLT Params to Send and Get Message APIs
  • Loading branch information
renoldthomas-plivo authored Aug 3, 2023
2 parents d25f832 + a690815 commit 03771d2
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 12 deletions.
21 changes: 13 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Change Log

## [4.52.0](https://github.com/plivo/plivo-python/tree/v4.52.0) (2023-07-31)
## [4.53.0](https://github.com/plivo/plivo-node/tree/v4.53.0) (2023-08-03)
**Feature - DLT parameters**
- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the [send message API](https://www.plivo.com/docs/sms/api/message/send-a-message/)
- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message)

## [4.52.0](https://github.com/plivo/plivo-node/tree/v4.52.0) (2023-07-31)
**Feature - Number Masking**
- Added Create, Delete, Update, Get and List Masking Session API

## [v4.51.0](https://github.com/plivo/plivo-go/tree/v4.51.0) (2023-07-07)
## [v4.51.0](https://github.com/plivo/plivo-node/tree/v4.51.0) (2023-07-07)
**Fix Intermediate GET request failure**
- GET API request body removed

## [v4.50.0](https://github.com/plivo/plivo-go/tree/v4.50.0) (2023-06-28)
## [v4.50.0](https://github.com/plivo/plivo-node/tree/v4.50.0) (2023-06-28)
**Feature - Audio Streaming**
- `Audio Stream over Call` added API to start and stop streaming on a live call and get details of running or stopped streams. Also implemented the ability to generate stream XML.

Expand Down Expand Up @@ -82,23 +87,23 @@
**Brand Usecase Request**
- Brand Usecase Request endpoint added

## [v4.34.3](https://github.com/plivo/plivo-go/tree/v4.34.3) (2022-11-07)
## [v4.34.3](https://github.com/plivo/plivo-node/tree/v4.34.3) (2022-11-07)
**Bug fix - List all Endpoint**
- Removed duplicate responses

## [v4.34.2](https://github.com/plivo/plivo-go/tree/v4.34.2) (2022-10-17)
## [v4.34.2](https://github.com/plivo/plivo-node/tree/v4.34.2) (2022-10-17)
**List Endpoint query param support**
- Adding limit and offset to fetch list of endpoints.

## [v4.34.1](https://github.com/plivo/plivo-go/tree/v4.34.1) (2022-09-28)
## [v4.34.1](https://github.com/plivo/plivo-node/tree/v4.34.1) (2022-09-28)
**10DLC campaign creation**
- Adding more attributes to campaign creation request.

## [v4.34.0](https://github.com/plivo/plivo-go/tree/v4.34.0) (2022-08-07)
## [v4.34.0](https://github.com/plivo/plivo-node/tree/v4.34.0) (2022-08-07)
**Feature - Token Creation**
- `JWT Token Creation API` added API to create a new JWT token.

## [v4.33.0](https://github.com/plivo/plivo-go/tree/v4.33.0) (2022-07-11)
## [v4.33.0](https://github.com/plivo/plivo-node/tree/v4.33.0) (2022-07-11)
**Feature - STIR Attestation**
- Add stir attestation param as part of Get CDR and Get live call APIs Response

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
build:
docker-compose up --build --remove-orphans

start:
docker-compose up --build --remove-orphans --detach
docker attach $(shell docker-compose ps -q nodeSDK)

test:
@[ "${CONTAINER}" ] && \
(docker exec -it $$CONTAINER /bin/bash -c "npm install request --no-save && npm test") || \
Expand Down
24 changes: 24 additions & 0 deletions lib/resources/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class MessageGetResponse {
this.requesterIP = params.requesterIp;
this.isDomestic = params.isDomestic;
this.replacedSender = params.replacedSender;
this.dltEntityID = params.dltEntityId;
this.dltTemplateID = params.dltTemplateId;
this.dltTemplateCategory = params.dltTemplateCategory;
}
}

Expand All @@ -76,6 +79,9 @@ export class MessageListResponse {
this.requesterIP = params.requesterIp;
this.isDomestic = params.isDomestic;
this.replacedSender = params.replacedSender;
this.dltEntityID = params.dltEntityId;
this.dltTemplateID = params.dltTemplateId;
this.dltTemplateCategory = params.dltTemplateCategory;
}
}

Expand Down Expand Up @@ -169,6 +175,9 @@ export class MessageInterface extends PlivoResourceInterface {
* @param {list} [optionalParams.media_urls] For sending mms, specify the media urls in list of string
* @param {int} [optionalParams.message_expiry] The method used to expiry the message specified time.
* @param {boolean} [optionalParams.log] If set to false, the content of this message will not be logged on the Plivo infrastructure and the dst value will be masked (e.g., 141XXXXX528). Default is set to true.
* @param {string} [optionalParams.dlt_entity_id] This is the DLT entity id passed in the message request.
* @param {string} [optionalParams.dlt_template_id] This is the DLT template id passed in the message request.
* @param {string} [optionalParams.dlt_template_category] This is the DLT template category passed in the message request.
* @promise {object} return {@link PlivoGenericMessage} object if success
* @fail {Error} return Error
*/
Expand All @@ -189,6 +198,9 @@ export class MessageInterface extends PlivoResourceInterface {
* @param {string} [optionalParams.method] The method used to call the url. Defaults to POST.
* @param {boolean} [optionalParams.log] If set to false, the content of this message will not be logged on the Plivo infrastructure and the dst value will be masked (e.g., 141XXXXX528). Default is set to true.
* @param {Array} [optionalParams.media_urls] For sending mms, specify the media urls in list of string
* @param {string} [optionalParams.dlt_entity_id] This is the DLT entity id passed in the message request.
* @param {string} [optionalParams.dlt_template_id] This is the DLT template id passed in the message request.
* @param {string} [optionalParams.dlt_template_category] This is the DLT template category passed in the message request.
* @promise {object} return {@link PlivoGenericMessage} object if success
* @fail {Error} return Error
*/
Expand All @@ -206,6 +218,9 @@ export class MessageInterface extends PlivoResourceInterface {
var log = src.log;
var trackable = src.trackable;
var messageExpiry = src.messageExpiry;
var dlt_entity_id = src.dlt_entity_id;
var dlt_template_id = src.dlt_template_id;
var dlt_template_category = src.dlt_template_category;
var src = src.src;
}

Expand Down Expand Up @@ -261,6 +276,15 @@ export class MessageInterface extends PlivoResourceInterface {
if (messageExpiry){
params.message_expiry = messageExpiry;
}
if (dlt_entity_id) {
params.dlt_entity_id = dlt_entity_id
}
if (dlt_template_id) {
params.dlt_template_id = dlt_template_id
}
if (dlt_template_category) {
params.dlt_template_category = dlt_template_category
}
}

if (src) {
Expand Down
15 changes: 12 additions & 3 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,10 @@ export function Request(config) {
total_rate: '0.00350',
units: 1,
requester_ip: '192.168.1.2',
is_domestic: false
is_domestic: false,
dlt_entity_id: "9876",
dlt_template_id: "5432",
dlt_template_category: "transactional"
}
});
}
Expand Down Expand Up @@ -2194,7 +2197,10 @@ export function Request(config) {
total_rate: '0.00350',
units: 1,
requester_ip: "192.168.1.1",
is_domestic: false
is_domestic: false,
dlt_entity_id: "2233",
dlt_template_id: "4455",
dlt_template_category: "service_implicit"
},
{
error_code: '200',
Expand All @@ -2210,7 +2216,10 @@ export function Request(config) {
total_rate: '0.00350',
units: 1,
requester_ip: "192.168.1.2",
is_domestic: false
is_domestic: false,
dlt_entity_id: null,
dlt_template_id: null,
dlt_template_category: null
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plivo",
"version": "4.52.0",
"version": "4.53.0",
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
"homepage": "https://github.com/plivo/plivo-node",
"files": [
Expand Down
22 changes: 22 additions & 0 deletions test/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ describe('message', function () {
})
});

it('should have dlt parameter in get message', function () {
return client.messages.get(1)
.then(function (message) {
assert.equal(message.dltEntityID, "9876");
assert.equal(message.dltTemplateID, "5432");
assert.equal(message.dltTemplateCategory, "transactional");
})
});

it('list messages', function () {
return client.messages.list()
.then(function (messages) {
Expand All @@ -39,6 +48,19 @@ describe('message', function () {
})
});

it('should have dlt parameters in first listed message only', function () {
return client.messages.list()
.then(function (messages) {
assert.equal(messages[0].dltEntityID, "2233")
assert.equal(messages[0].dltTemplateID, "4455")
assert.equal(messages[0].dltTemplateCategory, "service_implicit")

assert.equal(messages[1].dltEntityID, null)
assert.equal(messages[1].dltTemplateID, null)
assert.equal(messages[1].dltTemplateCategory, null)
})
});

it('should create message via interface', function () {
return client.messages.create({src:'src', dst:'dst', text:'text',powerpackUUID: null})
.then(function (message) {
Expand Down

0 comments on commit 03771d2

Please sign in to comment.