- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
New Components - doppler_marketing_automation #14243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            5 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            60 changes: 0 additions & 60 deletions
          
          60 
        
  components/doppler_marketing_automation/actions/add-subscriber/add-subscriber.mjs
  
  
      
      
   
        
      
      
    This file was deleted.
      
      Oops, something went wrong.
      
    
  
        
          
          
            93 changes: 93 additions & 0 deletions
          
          93 
        
  ...ents/doppler_marketing_automation/actions/add-update-subscriber/add-update-subscriber.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import { | ||
| COUNTRY_OPTIONS, GENDER_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import app from "../../doppler_marketing_automation.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "doppler_marketing_automation-add-update-subscriber", | ||
| name: "Add or Update Subscriber", | ||
| description: "Adds a new subscriber or updates an existing one. [See the documentation](https://restapi.fromdoppler.com/docs/resources#!/Subscribers/AccountsByAccountNameListsByListIdSubscribersPost)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| listId: { | ||
| propDefinition: [ | ||
| app, | ||
| "listId", | ||
| ], | ||
| }, | ||
| subscriberEmail: { | ||
| type: "string", | ||
| label: "Subscriber Email", | ||
| description: "The email of the subscriber to add or update.", | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "Subscriber first name", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "Subscriber last name", | ||
| optional: true, | ||
| }, | ||
| birthDate: { | ||
| type: "string", | ||
| label: "Birth Date", | ||
| description: "The birth date of the subscriber", | ||
| optional: true, | ||
| }, | ||
| country: { | ||
| type: "string", | ||
| label: "Country", | ||
| description: "Optional country of the subscriber", | ||
| options: COUNTRY_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| gender: { | ||
| type: "string", | ||
| label: "Gender", | ||
| description: "The gender of the subscriber", | ||
| options: GENDER_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const fields = []; | ||
| if (this.firstName) fields.push({ | ||
| name: "FIRSTNAME", | ||
| value: this.firstName, | ||
| }); | ||
| if (this.lastName) fields.push({ | ||
| name: "LASTNAME", | ||
| value: this.lastName, | ||
| }); | ||
| if (this.birthDate) fields.push({ | ||
| name: "BIRTHDAY", | ||
| value: this.birthDate, | ||
| }); | ||
| if (this.country) fields.push({ | ||
| name: "COUNTRY", | ||
| value: this.country, | ||
| }); | ||
| if (this.gender) fields.push({ | ||
| name: "GENDER", | ||
| value: this.gender, | ||
| }); | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| const response = await this.app.addOrUpdateSubscriber({ | ||
| $, | ||
| listId: this.listId, | ||
| data: { | ||
| email: this.subscriberEmail, | ||
| fields, | ||
| }, | ||
| }); | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| $.export("$summary", `Successfully added or updated subscriber with email: ${this.subscriberEmail}`); | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| return response; | ||
| }, | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            31 changes: 31 additions & 0 deletions
          
          31 
        
  components/doppler_marketing_automation/actions/unsubscribe-email/unsubscribe-email.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import app from "../../doppler_marketing_automation.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "doppler_marketing_automation-unsubscribe-email", | ||
| name: "Unsubscribe Email", | ||
| description: "Unsubscribe an email address from the account. Once unsubscribed, the user will not receive any more communication. [See the documentation](https://restapi.fromdoppler.com/docs/resources#!/Subscribers/AccountsByAccountNameUnsubscribedPost)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| email: { | ||
| propDefinition: [ | ||
| app, | ||
| "subscriberEmail", | ||
| () => ({ | ||
| filter: ({ status }) => status != "unsubscribed", | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.unsubscribeSubscriber({ | ||
| $, | ||
| data: { | ||
| email: this.email, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully unsubscribed email: ${this.email}`); | ||
| return response; | ||
| }, | ||
| }; | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.