Skip to content

Commit

Permalink
Merge pull request #273 from plivo/SMS-4994-update-campaign-sdk
Browse files Browse the repository at this point in the history
Update Campaign Node SDK
  • Loading branch information
renoldthomas-plivo authored Jan 5, 2023
2 parents 062cebc + 702cb31 commit 57ce72a
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [v4.37.0](https://github.com/plivo/plivo-node/tree/v4.37.0) (2022-12-16)
**Update Campaign Request**
- Update Campaign Request endpoint added

## [v4.36.0](https://github.com/plivo/plivo-node/tree/v4.36.0) (2022-12-06)
**Delete Brand and Campaign Request**
- Delete Brand and Campaign Request endpoint added
Expand Down
34 changes: 34 additions & 0 deletions lib/resources/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,40 @@ export class LinkUnlinkNumberResponse {
});
}

/**
* update Campaign
* @method
* @param {string} campaign_id
* @param {string} reseller_id
* @param {string} description
* @param {string} sample1
* @param {string} sample2
* @param {string} message_flow
* @param {string} help_message
* @param {string} optin_keywords
* @param {string} optin_message
* @param {string} optout_keywords
* @param {string} optout_message
* @param {string} help_keywords
* @promise {object} return {@link PlivoGenericResponse} object
* @fail {Error} return Error
*/
update(campaign_id,reseller_id,description,sample1,sample2,message_flow,help_message,optin_keywords,optin_message,optout_keywords,optout_message,help_keywords,params = {}) {
params.reseller_id=reseller_id;
params.description=description;
params.sample1=sample1;
params.sample2=sample2;
params.message_flow=message_flow;
params.help_message=help_message;
params.optin_keywords=optin_keywords;
params.optin_message=optin_message;
params.optout_keywords=optout_keywords;
params.optout_message=optout_message;
params.help_keywords=help_keywords;

return super.customexecuteAction(action+campaign_id + '/', 'POST', params);
}

/**
* getNumber CampaignNumbers by given campaignId, number
* @method
Expand Down
24 changes: 24 additions & 0 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,30 @@ export function Request(config) {
}
});
}
else if (action == '10dlc/Campaign/CMPT4EP/' && method == 'POST'){
resolve({
response: {},
body: {
api_id: "12ae5a32-3751-11ec-8e4c-0242ac110002",
campaign: {
brand_id: "BHYYNCK",
campaign_id: "CMPT4EP",
mno_metadata: {
AT_T: {
tpm: 4500
},
T_Mobile: {
brand_tier: "TOP"
},
Verizon_Wireless: {}
},
reseller_id: "RPDPPUM",
usecase: "ACCOUNT_NOTIFICATION",
sub_usecase: "2FA,ACCOUNT_NOTIFICATION"
}
}
});
}
else if (action == '10dlc/Brand/' && method == 'GET'){
resolve({
response: {},
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.36.0",
"version": "4.37.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
7 changes: 7 additions & 0 deletions test/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ import {
assert.equal(response.campaignId, "CMPT4EP")
})
});

it('update campaign', function () {
return client.campaign.update("CMPT4EP","","","","sample1 should be 20 minimum character","","","","","","","")
.then(function (response) {
assert.equal(response.campaign.campaignId, "CMPT4EP")
})
});
});

0 comments on commit 57ce72a

Please sign in to comment.