Created
August 7, 2014 00:37
-
-
Save tstachl/993d9f74e1cb0157d829 to your computer and use it in GitHub Desktop.
Example on how you can upload customers to desk.com using the desk_api gem.
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
require 'desk_api' | |
require 'csv' | |
DeskApi.configure do |config| | |
config.username = '[email protected]' | |
config.password = 'Top$ecret1' | |
config.endpoint = 'https://example.desk.com' | |
end | |
CSV.foreach('./customers.csv', headers: true) do |csv| | |
DeskApi.customers.create({ | |
first_name: csv['first_name'], | |
last_name: csv['last_name'], | |
emails: [{ type: 'home', value: csv['email'] }], | |
phone_numbers: [{ type: 'home', value: csv['phone'] }], | |
custom_fields: { | |
id: csv['id'] | |
} | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment