Lists

Reading all lists

Http Method: GET

URL: /api/v1/lists/

Required Parameters:

  1. page: Page number

Display  20 lists in order of descending creation order.

Example for fetching lists

Creating a new list

Http Method: POST

URL: /api/v1/list/create/

Required Parameters:

  1. name: List Name
  2. source: List Source (Description about how contacts joined the list)
  3. opt_in_type: (‘single’,’double’)
  4. from_name: Default Sender Name for your Account
  5. from_email: Default From Email for your Account

When using APIs to add or remove a contact from a list you can easily get the list ID from the url while in a list on the Pepo Campaigns Platform. E.g. ‘https://pepocampaigns.com/list/8/’.

from_name and from_email is mandatory when opt_in_type is ‘single’.

Examples for creating a list

Adding a contact to a List

Http Method: POST

URL: /api/v1/list/<list id>/add-contact/

Required Parameters:

  1. list_id: List id as in Url
  2. email: Email to be added to the list

Optional Parameters:

  1. attributes: Custom attributes to be added to that contact. Need to be a hash. Such as attributes[First Name]=Pepo. The attributes should exist. If attribute is new should  be created using “Create Custom Attribute” API.
  2. user status:  User Statuses which can be updated. Below are possible combinations:

    double_opt_in_status => verified/pending
    subscribe_status => subscribed/unsubscribed
    blacklist_status => blacklisted/unblacklisted

Examples for adding a contact

Updating a contact to a List

Http Method: POST

URL: /api/v1/list/<list id>/update-contact/

Required Parameters:

  1. list_id: List id as in Url
  2. email: Email to be added to the list

Optional Parameters:

  1. attributes: Custom attributes to be updated to that contact. Need to be a hash. Such as attributes[First Name]=Pepo. The attributes should exist. If attribute is new should  be created using “Create Custom Attribute” API.
  2. user status:  User Statuses which can be updated. Below are possible combinations:
         double_opt_in_status => verified/pending
         subscribe_status => subscribed/unsubscribed
         blacklist_status => blacklisted/unblacklisted

Examples for updating a contact

Removing a contact from a list

Http Method: POST

URL: /api/v1/list/13/remove-contact/

Required Parameters:

  1. list_id: List id as Url Parameters
  2. email: Email to be removed from the list.

Examples for removing a contact from a list

 

Deleting a list

Http Method: POST

URL: /api/v1/list/13/delete/

Required Parameters:

  1. list_id: List id as Url Parameters

Examples for removing a list

Updated on July 11, 2017

Related Articles