Skip to content

Commit

Permalink
campaign_creation adding more attributes like message_flow, help_mess…
Browse files Browse the repository at this point in the history
…age (#148)

* campaign_creation adding more attributes like message_flow, help_message

* updated the date to current date

Co-authored-by: Renold Jose Thomas <renold@Renolds-MacBook-Pro.local>
  • Loading branch information
narayana-plivo and Renold Jose Thomas authored Sep 28, 2022
1 parent 3c09059 commit 87b28d7
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion baseclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
14 changes: 14 additions & 0 deletions campaign.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"`
Expand Down
64 changes: 64 additions & 0 deletions campaign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 87b28d7

Please sign in to comment.