Module: ActiveCampaign::API::Groups

Defined in:
lib/active_campaign/api/groups.rb

Overview

Interface to group endpoints

Author:

Instance Method Summary collapse

Instance Method Details

#bulk_delete_groups(ids) ⇒ Hash

Deletes a group with given ids

Parameters:

  • ids (Array<String>)

    a collection of ids to delete

Returns:

  • (Hash)


193
194
195
# File 'lib/active_campaign/api/groups.rb', line 193

def bulk_delete_groups(ids)
  delete('groups/bulk_delete', ids: ids)
end

#create_group(params) ⇒ Hash

Create a new group

Parameters:

  • params (Hash)

    create a new group with this data

Options Hash (params):

  • :title (String)

    Title of the group to be created

  • :descript (String)

    Group description

  • :pg_message_add (true, false)

    Permission for adding messages

  • :unsubscribelink (true, false)

    Whether or not to force unsubscribe links

  • :optinconfirm (true, false)

    Whether or not to force optin confirm for this group

  • :pg_list_add (true, false)

    Permission for adding lists

  • :pg_list_edit (true, false)

    Permission for editing lists

  • :pg_list_delete (true, false)

    Permission for deleting lists

  • :pg_list_headers (true, false)

    Permission for managing custom email headers

  • :pg_list_emailaccount (true, false)

    Permission for managing Unsubscribe By Email

  • :pg_list_bounce (true, false)

    Permission for accessing list bounce settings

  • :pg_message_edit (true, false)

    Permission for editing messages

  • :pg_message_delete (true, false)

    Permission for deleting messages

  • :pg_message_send (true, false)

    Permission for sending messages

  • :pg_contact_add (true, false)

    Permission for adding contacts

  • :pg_contact_edit (true, false)

    Permission for editing contacts

  • :pg_contact_delete (true, false)

    Permission for deleting contacts

  • :pg_contact_merge (true, false)

    Permission for merging contacts

  • :pg_contact_import (true, false)

    Permission for importing contacts

  • :pg_contact_approve (true, false)

    Permission for approving contacts

  • :pg_contact_export (true, false)

    Permission for exporting contacts

  • :pg_contact_sync (true, false)

    Permission for syncing contacts

  • :pg_contact_filters (true, false)

    Permission for managing contact list segments

  • :pg_contact_actions (true, false)

    Permission for managing contact actions

  • :pg_contact_fields (true, false)

    Permission for managing contact custom fields

  • :pg_user_add (true, false)

    Permission for adding users

  • :pg_user_edit (true, false)

    Permission for editing users

  • :pg_user_delete (true, false)

    Permission for deleting users

  • :pg_group_add (true, false)

    Permission for adding groups

  • :pg_group_edit (true, false)

    Permission for editing groups

  • :pg_group_delete (true, false)

    Permission for deleting groups

  • :pg_template_add (true, false)

    Permission for adding templates

  • :pg_template_edit (true, false)

    Permission for editing templates

  • :pg_template_delete (true, false)

    Permission for deleting templates

  • :pg_personalization_add (true, false)

    Permission for adding personalization tags

  • :pg_personalization_edit (true, false)

    Permission for editing personalization tags

  • :pg_personalization_delete (true, false)

    Permission for deleting personalization tags

  • :pg_automation_manage (true, false)
  • :pg_form_edit (true, false)

    Permission for editing subscription forms

  • :pg_reports_campaign (true, false)

    Permission for viewing campaign reports

  • :pg_reports_list (true, false)

    Permission for viewing list reports

  • :pg_reports_user (true, false)

    Permission for viewing user reports

  • :pg_startup_reports (true, false)

    Campaign ID of last campaign report viewed to decide whether to show link on startup

  • :pg_reports_trend (true, false)

    Permission for viewing trend reports

  • :pg_startup_gettingstarted (true, false)

    Whether or not to show the "getting started" tutorial on overview page

  • :pg_deal (true, false)

    Permission for viewing deals

  • :pg_deal_delete (true, false)

    Permission for deleting deals

  • :pg_deal_reassign (true, false)

    Permission for reassigning deals

  • :pg_deal_group_add (true, false)

    Permission for adding deal groups

  • :pg_deal_group_edit (true, false)

    Permission for editing deal groups

  • :pg_deal_group_delete (true, false)

    Permission for deleting deals groups

  • :pg_saved_responses_manage (true, false)

    Permission for managing saved responses

  • :req_approval (true, false)

    Whether or not this group requires all campaigns to be approved

  • :req_approval1st (true, false)

    Whether or not this group requires first campaign to be approved

  • :req_approval_notify (String)

    Who to notify for approval related issues (email)

  • :socialdata (true, false)

    Whether or not to show social links in campaigns sent from this group

Returns:

  • (Hash)

    a hash with information about the newly created group



76
77
78
# File 'lib/active_campaign/api/groups.rb', line 76

def create_group(params)
  post('groups', group: params)
end

#delete_group(id) ⇒ Hash

Deletes a group with given id

Parameters:

  • id (String)

    the id of a group to delete

Returns:

  • (Hash)


182
183
184
# File 'lib/active_campaign/api/groups.rb', line 182

def delete_group(id)
  delete("groups/#{id}")
end

#show_group(id) ⇒ Hash

Get a single group

Parameters:

  • id (Integer)

    the id of a group to show

Returns:

  • (Hash)


87
88
89
# File 'lib/active_campaign/api/groups.rb', line 87

def show_group(id)
  get("groups/#{id}")
end

#show_groups(search = nil) ⇒ Array<Hash>

Get a list of groups

Parameters:

  • search (String) (defaults to: nil)

    Filter groups that match the given value in the group attributes

Returns:

  • (Array<Hash>)


98
99
100
# File 'lib/active_campaign/api/groups.rb', line 98

def show_groups(search = nil)
  get('groups', search: search)
end

#update_group(id, params) ⇒ Hash

Update an existing group with given id

Parameters:

  • id (String)

    the id of a group to update

  • params (Hash)

    update an existing group with this data

Options Hash (params):

  • :title (String)

    Title of the group to be created

  • :descript (String)

    Group description

  • :pg_message_add (true, false)

    Permission for adding messages

  • :unsubscribelink (true, false)

    Whether or not to force unsubscribe links

  • :optinconfirm (true, false)

    Whether or not to force optin confirm for this group

  • :pg_list_add (true, false)

    Permission for adding lists

  • :pg_list_edit (true, false)

    Permission for editing lists

  • :pg_list_delete (true, false)

    Permission for deleting lists

  • :pg_list_headers (true, false)

    Permission for managing custom email headers

  • :pg_list_emailaccount (true, false)

    Permission for managing Unsubscribe By Email

  • :pg_list_bounce (true, false)

    Permission for accessing list bounce settings

  • :pg_message_edit (true, false)

    Permission for editing messages

  • :pg_message_delete (true, false)

    Permission for deleting messages

  • :pg_message_send (true, false)

    Permission for sending messages

  • :pg_contact_add (true, false)

    Permission for adding contacts

  • :pg_contact_edit (true, false)

    Permission for editing contacts

  • :pg_contact_delete (true, false)

    Permission for deleting contacts

  • :pg_contact_merge (true, false)

    Permission for merging contacts

  • :pg_contact_import (true, false)

    Permission for importing contacts

  • :pg_contact_approve (true, false)

    Permission for approving contacts

  • :pg_contact_export (true, false)

    Permission for exporting contacts

  • :pg_contact_sync (true, false)

    Permission for syncing contacts

  • :pg_contact_filters (true, false)

    Permission for managing contact list segments

  • :pg_contact_actions (true, false)

    Permission for managing contact actions

  • :pg_contact_fields (true, false)

    Permission for managing contact custom fields

  • :pg_user_add (true, false)

    Permission for adding users

  • :pg_user_edit (true, false)

    Permission for editing users

  • :pg_user_delete (true, false)

    Permission for deleting users

  • :pg_group_add (true, false)

    Permission for adding groups

  • :pg_group_edit (true, false)

    Permission for editing groups

  • :pg_group_delete (true, false)

    Permission for deleting groups

  • :pg_template_add (true, false)

    Permission for adding templates

  • :pg_template_edit (true, false)

    Permission for editing templates

  • :pg_template_delete (true, false)

    Permission for deleting templates

  • :pg_personalization_add (true, false)

    Permission for adding personalization tags

  • :pg_personalization_edit (true, false)

    Permission for editing personalization tags

  • :pg_personalization_delete (true, false)

    Permission for deleting personalization tags

  • :pg_automation_manage (true, false)
  • :pg_form_edit (true, false)

    Permission for editing subscription forms

  • :pg_reports_campaign (true, false)

    Permission for viewing campaign reports

  • :pg_reports_list (true, false)

    Permission for viewing list reports

  • :pg_reports_user (true, false)

    Permission for viewing user reports

  • :pg_startup_reports (true, false)

    Campaign ID of last campaign report viewed to decide whether to show link on startup

  • :pg_reports_trend (true, false)

    Permission for viewing trend reports

  • :pg_startup_gettingstarted (true, false)

    Whether or not to show the "getting started" tutorial on overview page

  • :pg_deal (true, false)

    Permission for viewing deals

  • :pg_deal_delete (true, false)

    Permission for deleting deals

  • :pg_deal_reassign (true, false)

    Permission for reassigning deals

  • :pg_deal_group_add (true, false)

    Permission for adding deal groups

  • :pg_deal_group_edit (true, false)

    Permission for editing deal groups

  • :pg_deal_group_delete (true, false)

    Permission for deleting deals groups

  • :pg_saved_responses_manage (true, false)

    Permission for managing saved responses

  • :req_approval (true, false)

    Whether or not this group requires all campaigns to be approved

  • :req_approval1st (true, false)

    Whether or not this group requires first campaign to be approved

  • :req_approval_notify (String)

    Who to notify for approval related issues (email)

  • :socialdata (true, false)

    Whether or not to show social links in campaigns sent from this group

Returns:

  • (Hash)

    a hash with information about the newly created group

  • (Hash)

    a hash with information about the newly created group



171
172
173
# File 'lib/active_campaign/api/groups.rb', line 171

def update_group(id, params)
  put("groups/#{id}", group: params)
end