Class: Five9Tools::Admin::Client

Inherits:
Object
  • Object
show all
Includes:
Five9Tools::Add, Five9Tools::AdminUtils, Create, Definitions, Delete, Get, IvrUtils, Misc, Modify, PromptUtils, Remove, Reports, Update
Defined in:
lib/five9tools/admin/admin.rb

Overview

Wrapper for the Five9 Administration Web Services API

Examples:

Create a Five9 Admin Client

c = Five9Tools::Admin::Client.new("five9_username", "five9_password")

Get all users in the system as a Savon Response -> hash

c.get_users_info.body
{:get_users_info_response=>{:return=>[{:general_info=>{:active=>true, :can_change_password=>true, :e_mail=>"[email protected]", :extension=>"000", :first_name=>"Zachary" ...}

Add a skill to a user

c.user_skill_add("[email protected]", "SD Regional Voice")

Get a list of all operations possible by the Five9 Admin Web Services API

c.operations

[:get_users_general_info, :get_report_result, :get_dialing_rules, :update_dispositions_csv, :create_call_variables_group, :get_campaign_profile_filter, :create_autodial_campaign, :stop_campaign, :create_outbound_campaign, :get_dispositions_import_result, :create_agent_group, :user_skill_add, :add_to_list_csv, :create_inbound_campaign, :get_configuration_translations, :modify_user, :delete_campaign, :get_users_info, :modify_campaign_lists, :add_skill_audio_file, :get_report_result_csv, :get_user_voicemail_greeting, :remove_dnis_from_campaign, :modify_campaign_profile_filter_order, :modify_web_connector, :run_report, :delete_prompt, :async_update_crm_records, :delete_from_list_csv, :update_contacts_csv, :get_api_versions, :get_call_variable_groups, :create_speed_dial_number, :start_campaign, :async_add_records_to_list, :get_skill_audio_files, :modify_call_variables_group, :create_reason_code, :modify_user_canned_reports, :modify_call_variable, :get_skill, :remove_lists_from_campaign, :get_campaign_strategies, :remove_skills_from_campaign, :set_locale, :get_ivr_icons, :remove_skill_audio_file, :delete_ivr_script, :set_user_voicemail_greeting, :get_campaign_profiles, :set_dialing_rules, :delete_list, :get_agent_groups, :get_contact_records, :modify_user_profile_skills, :modify_user_profile_user_list, :add_numbers_to_dnc, :modify_campaign_profile_crm_criteria, :delete_from_contacts_csv, :reset_campaign, :delete_user_profile, :get_list_import_result, :remove_ivr_script_ownership, :add_to_list, :create_campaign_profile, :user_skill_modify, :get_ivr_scripts, :add_dispositions_to_campaign, :delete_from_contacts, :get_speed_dial_numbers, :modify_ivr_script, :set_ivr_script_ownership, :delete_contact_field, :async_update_campaign_dispositions, :create_web_connector, :remove_disposition, :reset_campaign_dispositions, :is_import_running, :get_campaign_state, :remove_numbers_from_dnc, :delete_call_variable, :get_vcc_configuration, :modify_outbound_campaign, :get_prompt, :remove_ivr_icons, :get_reason_code_by_type, :modify_reason_code, :get_outbound_campaign, :remove_speed_dial_number, :get_dispositions, :get_locale, :add_prompt_wav_inline, :create_disposition, :modify_skill, :get_skill_info, :set_skill_voicemail_greeting, :user_skill_remove, :get_web_connectors, :get_prompts, :modify_disposition, :get_agent_group, :modify_prompt_tts, :get_crm_import_result, :update_dispositions, :delete_language_prompt, :get_campaign_dnis_list, :get_reason_code, :delete_agent_group, :modify_contact_field, :check_dnc_for_numbers, :modify_vcc_configuration, :rename_disposition, :update_contacts_ftp, :get_lists_for_campaign, :delete_campaign_profile, :delete_skill, :get_available_locales, :get_contact_fields, :get_skills_info, :add_dnis_to_campaign, :create_ivr_script, :get_disposition, :modify_prompt_wav, :get_user_profiles, :async_delete_records_from_list, :modify_user_profile, :get_skill_voicemail_greeting, :create_list, :force_stop_campaign, :remove_dispositions_from_campaign, :add_lists_to_campaign, :add_to_list_ftp, :update_contacts, :modify_campaign_profile_dispositions, :delete_record_from_list, :modify_inbound_campaign, :delete_reason_code, :delete_user, :delete_call_variables_group, :update_configuration_translations, :get_ivr_script_ownership, :update_crm_record, :reset_list_position, :get_user_profile, :get_campaigns, :delete_web_connector, :get_campaign_profile_dispositions, :add_skills_to_campaign, :rename_campaign, :create_contact_field, :modify_agent_group, :get_skills, :get_lists_info, :create_skill, :delete_from_list, :get_inbound_campaign, :update_dispositions_ftp, :add_record_to_list_simple, :is_report_running, :add_record_to_list, :create_call_variable, :get_autodial_campaign, :close_session, :get_call_variables, :delete_from_list_ftp, :modify_autodial_campaign, :set_default_ivr_schedule, :delete_reason_code_by_type, :create_user_profile, :get_user_general_info, :add_prompt_wav, :get_dnis_list, :set_campaign_strategies, :delete_from_contacts_ftp, :get_call_counters_state, :modify_prompt_wav_inline, :add_prompt_tts, :get_user_info, :delete_all_from_list, :modify_campaign_profile, :set_ivr_icons, :create_user]

Make any viable Five9 operation

message = {
  userGeneralInfo: {
    "EMail" => "[email protected]",
    :userName => "[email protected]",
    :password => "new_password"
    }
}
c.client.call(:modify_user, message: message)

Constant Summary

Constants included from Definitions

Definitions::SOAP_OPERATION_PARAMETERS

Instance Method Summary collapse

Methods included from Definitions

parameters

Methods included from Update

async_update_campaign_dispositions, async_update_crm_records, update_configuration_translations, update_contacts, update_contacts_csv, update_contacts_ftp, update_crm_record, update_dispositions, update_dispositions_csv, update_dispositions_ftp

Methods included from Remove

remove_disposition, remove_dispositions_from_campaign, remove_dnis_from_campaign, remove_ivr_icons, remove_ivr_script_ownership, remove_lists_from_campaign, remove_numbers_from_dnc, remove_skill_audio_file, remove_skills_from_campaign, remove_speed_dial_number, user_skill_remove

Methods included from Misc

check_dnc_for_numbers, close_session, force_stop_campaign, is_import_running, is_report_running, rename_campaign, rename_disposition, reset_campaign, reset_campaign_dispositions, reset_list_position, run_report, set_campaign_strategies, set_default_ivr_schedule, set_dialing_rules, set_ivr_icons, set_ivr_script_ownership, set_locale, set_skill_voicemail_greeting, set_user_voicemail_greeting, start_campaign, stop_campaign

Methods included from Modify

modify_agent_group, modify_autodial_campaign, modify_call_variable, modify_call_variables_group, modify_campaign_lists, modify_campaign_profile, modify_campaign_profile_crm_criteria, modify_campaign_profile_dispositions, modify_campaign_profile_filter_order, modify_contact_field, modify_disposition, modify_inbound_campaign, modify_ivr_script, modify_outbound_campaign, modify_prompt_tts, modify_prompt_wav, modify_prompt_wav_inline, modify_reason_code, modify_skill, modify_user, modify_user_canned_reports, modify_user_profile, modify_user_profile_skills, modify_user_profile_user_list, modify_vcc_configuration, modify_web_connector, user_skill_modify

Methods included from Get

get_agent_group, get_agent_groups, get_api_versions, get_autodial_campaign, get_available_locales, get_call_counters_state, get_call_variable_groups, get_call_variables, get_campaign_dnis_list, get_campaign_profile_dispositions, get_campaign_profile_filter, get_campaign_profiles, get_campaign_state, get_campaign_strategies, get_campaigns, get_configuration_translations, get_contact_fields, get_contact_records, get_crm_import_result, get_dialing_rules, get_disposition, get_dispositions, get_dispositions_import_result, get_dnis_list, get_inbound_campaign, get_ivr_icons, get_ivr_script_ownership, get_ivr_scripts, get_list_import_result, get_lists_for_campaign, get_lists_info, get_locale, get_outbound_campaign, get_prompt, get_prompts, get_reason_code, get_reason_code_by_type, get_report_result, get_report_result_csv, get_skill, get_skill_audio_files, get_skill_info, get_skill_voicemail_greeting, get_skills, get_skills_info, get_speed_dial_numbers, get_user_general_info, get_user_info, get_user_profile, get_user_profiles, get_user_voicemail_greeting, get_users_general_info, get_users_info, get_vcc_configuration, get_web_connectors

Methods included from Delete

async_delete_records_from_list, delete_agent_group, delete_all_from_list, delete_call_variable, delete_call_variables_group, delete_campaign, delete_campaign_profile, delete_contact_field, delete_from_contacts, delete_from_contacts_csv, delete_from_contacts_ftp, delete_from_list, delete_from_list_csv, delete_from_list_ftp, delete_ivr_script, delete_language_prompt, delete_list, delete_prompt, delete_reason_code, delete_reason_code_by_type, delete_record_from_list, delete_skill, delete_user, delete_user_profile, delete_web_connector

Methods included from Create

create_agent_group, create_autodial_campaign, create_call_variable, create_call_variables_group, create_campaign_profile, create_contact_field, create_disposition, create_inbound_campaign, create_ivr_script, create_list, create_outbound_campaign, create_reason_code, create_skill, create_speed_dial_number, create_user, create_user_profile, create_web_connector

Methods included from Five9Tools::Add

add_dispositions_to_campaign, add_dnis_to_campaign, add_lists_to_campaign, add_numbers_to_dnc, add_prompt_tts, add_prompt_wav, add_prompt_wav_inline, add_record_to_list, add_record_to_list_simple, add_skill_audio_file, add_skills_to_campaign, add_to_list, add_to_list_csv, add_to_list_ftp, async_add_records_to_list, user_skill_add

Methods included from Reports

generate_users_skills_map, write_csv_of_ivr_function_json_to_file

Methods included from PromptUtils

delete_prompt_language, get_lang_code_id_from_file_name, get_multilingual_prompts, get_prompts, is_multilingual_prompt?, modify_prompt, safely_modify_prompt, safely_upload_prompt, upload_multilingual_prompt, upload_prompt, upload_prompts_in_dir

Methods included from IvrUtils

convert_new_function_data_to_json, create_case_statement_child_node, create_set_variable_child_node, generate_case_statement_xml, generate_modified_xml, generate_set_variable_xml, get_first_parent_module_id, get_function_contents, get_function_json, get_hangup_module_id, get_ivr_scripts, get_ivr_update_hash, get_json_from_function, get_last_id, get_parent_node, modify_hangup_ascendants, replace_function_json, replace_ivr_script, write_ivr_to_file

Methods included from Five9Tools::AdminUtils

easy_create_campaign_profile, easy_create_outbound_campaign, start_all_campaigns_safely, write_new_skill_to_users

Constructor Details

#initialize(username = ENV["FIVE9_USERNAME"], password = ENV["FIVE9_PASSWORD"]) ⇒ Client

Savon is used to create a SOAP client that reaches out to the Five9 WSDL file

Examples:

Create a new Five9 Admin Client so you can bulk change and query Five9 systems with ease.

c = Five9Tools::Admin::Client.new("five9_username", "five9_password")

Use ENV vars instead.

`export FIVE9_USERNAME=foo`
`export FIVE9_PASSWORD=bar`
c = Five9Tools::Admin::Client.new

52
53
54
55
# File 'lib/five9tools/admin/admin.rb', line 52

def initialize(username = ENV["FIVE9_USERNAME"], password = ENV["FIVE9_PASSWORD"])
  url = "https://api.five9.com/wsadmin/v#{F9_VERSION}/AdminWebService?wsdl&user=#{ERB::Util.url_encode(username)}"
  @client = Savon.client(wsdl: url, basic_auth: [username, password])
end

Instance Method Details

#call(operation, params) ⇒ Object


68
69
70
# File 'lib/five9tools/admin/admin.rb', line 68

def call(operation, params)
  @client.call(operation, params).body
end

#clientObject

Examples:

Directly Call a Savon Client Operation

c.client.call(:get_users_info)

64
65
66
# File 'lib/five9tools/admin/admin.rb', line 64

def client
  @client
end

#operationsObject

Lists all of the Five9 API operations possible by the Five9 Webservices API


58
59
60
# File 'lib/five9tools/admin/admin.rb', line 58

def operations
  @client.operations
end

#start_campaign_safely(campaign, number) ⇒ Object


72
73
74
75
76
77
78
79
80
81
82
# File 'lib/five9tools/admin/admin.rb', line 72

def start_campaign_safely(campaign, number)
  #needs a dnis NUMBER to assign to campaign, since five9 only lets you start campaigns that have a dnis
  begin
    stop_campaign(campaign)
  rescue
    puts "Campaign was already stopped"
  end
  add_dnis_to_campaign(campaign, number)
  start_campaign(campaign)
  remove_dnis_from_campaign(campaign, number)
end