From 87b28d7463eed829d7846da16a0fd3fa508c1754 Mon Sep 17 00:00:00 2001 From: Narayana Shanbhog Date: Wed, 28 Sep 2022 17:44:48 +0530 Subject: [PATCH] campaign_creation adding more attributes like message_flow, help_message (#148) * campaign_creation adding more attributes like message_flow, help_message * updated the date to current date Co-authored-by: Renold Jose Thomas --- CHANGELOG.md | 4 +++ baseclient.go | 2 +- campaign.go | 14 +++++++++++ campaign_test.go | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcaf718b..dd392079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [7.12.1](https://github.com/plivo/plivo-go/tree/v7.12.1) (2022-09-28) +**Adding more attributes to campaign creation** +- Adding more attributes to campaign creation request + ## [7.12.0](https://github.com/plivo/plivo-go/tree/v7.12.0) (2022-08-30) **Feature - 10DLC api updates** - Updated 10dlc api with total 15 apis now such as campaign, brand, profile and number link diff --git a/baseclient.go b/baseclient.go index afc0f81c..a46b1b53 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.12.0" +const sdkVersion = "7.12.1" const lookupBaseUrl = "lookup.plivo.com" diff --git a/campaign.go b/campaign.go index 80c3533d..f3cef4f1 100644 --- a/campaign.go +++ b/campaign.go @@ -23,6 +23,13 @@ type CampaignCreationParams struct { Sample2 *string `json:"sample2,omitempty" url:"sample2,omitempty"` URL string `json:"url,omitempty" url:"url,omitempty"` Method string `json:"method,omitempty" url:"method,omitempty"` + MessageFlow string `json:"message_flow,omitempty" url:"message_flow"` + HelpMessage string `json:"help_message,omitempty" url:"help_message"` + OptinKeywords string `json:"optin_keywords,omitempty" url:"optin_keywords"` + OptinMessage string `json:"optin_message,omitempty" url:"optin_message"` + OptoutKeywords string `json:"optout_keywords,omitempty" url:"optout_keywords"` + OptoutMessage string `json:"optout_message,omitempty" url:"optout_message"` + HelpKeywords string `json:"help_keywords,omitempty" url:"help_keywords"` } type CampaignListResponse struct { @@ -49,6 +56,13 @@ type Campaign struct { Usecase string `json:"usecase,omitempty"` SubSsecase string `json:"sub_usecase,omitempty"` RegistrationStatus string `json:"registration_status,omitempty"` + MessageFlow string `json:"message_flow,omitempty"` + HelpMessage string `json:"help_message,omitempty"` + OptinKeywords string `json:"optin_keywords,omitempty"` + OptinMessage string `json:"optin_message,omitempty"` + OptoutKeywords string `json:"optout_keywords,omitempty"` + OptoutMessage string `json:"optout_message,omitempty"` + HelpKeywords string `json:"help_keywords,omitempty"` } type MnoMetadata struct { ATandT OperatorDetail `json:"AT&T,omitempty"` diff --git a/campaign_test.go b/campaign_test.go index b993abaf..ac0f83d0 100644 --- a/campaign_test.go +++ b/campaign_test.go @@ -104,6 +104,70 @@ func TestCampaign_Create(t *testing.T) { assertRequest(t, "POST", "10dlc/Campaign") } +func TestCampaign_Create_WithMoreAttribute(t *testing.T) { + expectResponse("campaignCreationResponse.json", 200) + assert := require.New(t) + campaignAlias := "campaign name sssample" + embeddedLink := false + embeddedPhone := false + ageGated := false + directLending := false + subUsecases := []string{"CUSTOMER_CARE", "2FA"} + sample1 := "sample 1 should be minimum 20 character" + sample2 := "sample 2 should be minimum 20 character" + + resp, err := client.Campaign.Create(CampaignCreationParams{ + BrandID: "B8OD95Z", + CampaignAlias: &campaignAlias, + Vertical: "INSURANCE", + Usecase: "MIXED", + SubUsecases: &subUsecases, + Description: "sample description text should be minimum 40 character, should be minimum 40 character,should be minimum 40 character", + EmbeddedLink: &embeddedLink, + EmbeddedPhone: &embeddedPhone, + AgeGated: &ageGated, + DirectLending: &directLending, + SubscriberOptin: true, + SubscriberOptout: true, + SubscriberHelp: true, + Sample1: &sample1, + Sample2: &sample2, + MessageFlow: "message_flow should be minimum 40 character,message_flow should be minimum 40 character", + OptoutMessage: "optout_message should be mandatory param", + HelpMessage: "help_message should be mandatory param", + }) + assert.NotNil(resp) + assert.Nil(err) + assert.NotEmpty(resp.ApiID) + cl := client.httpClient + client.httpClient = nil + resp, err = client.Campaign.Create(CampaignCreationParams{ + BrandID: "B8OD95Z", + CampaignAlias: &campaignAlias, + Vertical: "INSURANCE", + Usecase: "MIXED", + SubUsecases: &subUsecases, + Description: "sample description text", + EmbeddedLink: &embeddedLink, + EmbeddedPhone: &embeddedPhone, + AgeGated: &ageGated, + DirectLending: &directLending, + SubscriberOptin: true, + SubscriberOptout: true, + SubscriberHelp: true, + Sample1: &sample1, + Sample2: &sample2, + MessageFlow: "message_flow should be minimum 40 character,message_flow should be minimum 40 character", + OptoutMessage: "optout_message should be mandatory param", + HelpMessage: "help_message should be mandatory param", + }) + assert.NotNil(err) + assert.Nil(resp) + client.httpClient = cl + + assertRequest(t, "POST", "10dlc/Campaign") +} + func TestCampaign_NumberLink(t *testing.T) { expectResponse("campaignNumberLinkUnlinkResponse.json", 200) assert := require.New(t)