{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/customers","auth":"required","examples":{"codes":[{"language":"curl","code":"curl 'https://www.sendsonar.com/api/v1/customers' \\\n  -X POST \\\n  -H 'X-Token:XXXXXXXXXXXXXXXXXXXXX' \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"phone_number\": \"+13105551234\", \"email\": \"matt:::at:::sendsonar.com\", \"first_name\": \"Matthew\", \"last_name\": \"Berman\", \"picture_url\": \"http://where_the_pics_live.com/the_bermanator.png\", \"properties\": {\"great_customer\": \"true\"}}'","name":""}]},"method":"post","params":[{"name":"phone_number","type":"string","default":"+13105551234","desc":"The phone number of the customer you want to add. This is the unique identifier for a customer.","required":true,"in":"body","ref":"","_id":"55497409cd09b317005f8f89"},{"name":"email","type":"string","default":"","desc":"Email address of the customer.","required":false,"in":"body","ref":"","_id":"55497409cd09b317005f8f88"},{"name":"first_name","type":"string","default":"","desc":"First name of the customer.","required":false,"in":"body","ref":"","_id":"554975b4a5ecbc19003216ab"},{"name":"last_name","type":"string","default":"","desc":"Last name of the customer.","required":false,"in":"body","ref":"","_id":"554975b4a5ecbc19003216aa"},{"name":"properties","type":"object","default":"{\"great_customer\": \"true\"}","desc":"Add as many properties as you want for each customer, in hash format.","required":false,"in":"body","ref":"","_id":"554975b4a5ecbc19003216a9"},{"name":"picture_url","type":"string","default":"http://where_the_pics_live.com/the_bermanator.png","desc":"Link to the customer's picture so you can see their picture whe replying to them","required":false,"in":"body","ref":"","_id":"55b955dab42b610d00c9b26b"},{"name":"subscribed","type":"boolean","default":"null","desc":"Whether the customer will receive API Messages and Mass Messages.","required":false,"in":"body","ref":"","_id":"55d65976250d7d0d004273ef"},{"name":"assign","type":"object","default":"{\"user_email\": \"[email protected]\"}","desc":"Assign the customer to the team member (user) specified by their email.","required":false,"in":"body","ref":"","_id":"55fc77eaaf72eb0d0007e06e"},{"name":"zipcode","type":"string","default":"90210","desc":"Specific Zipcode of the contact","required":false,"in":"body","ref":"","_id":"5da9e6eb0db8980051aa7800"},{"name":"timezone","type":"string","default":"America/Los_Angeles","desc":"State the timezone your contact is in","required":false,"in":"body","ref":"","_id":"5da9e7657854dc00268af97a"}],"results":{"codes":[{"language":"json","status":201,"name":"","code":"{\n  \"phone_number\": \"+13105551234\",\n  \"email\": \"[email protected]\",\n  \"first_name\": \"Matthew\",\n  \"last_name\": \"Berman\",\n  \"picture_url\": \"http://where_the_pics_live.com/the_bermanator.png\",\n  \"subscribed\": true,\n  \"properties\": {\n    \"great_customer\": \"true\"\n  }\n}"}]},"settings":""},"next":{"description":"","pages":[]},"title":"Add/Update Customer","type":"endpoint","slug":"addupdate-customer","excerpt":"","body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Timezones\",\n  \"body\": \"Acceptable timezones come in the form of TZ database values. You can find a full list of timezones on this page: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\"\n}\n[/block]\n## **Updating Customers**\n\nUpdating a customer is done the same way adding a Customer is done. When you send us a POST request to this endpoint using a Phone Number we recognize, we automatically update any values that are transferred to us in the request.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Note\",\n  \"body\": \"Phone Number is the unique identifier for each Customer and cannot currently be changed. All other Customer properties can be updated via this endpoint.\"\n}\n[/block]\nFor example, if you add a Customer with the following properties:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\\"phone_number\\\": \\\"+13105551234\\\", \\n\\\"email\\\": \\\"[email protected]\\\", \\n\\\"first_name\\\": \\\"Matthew\\\", \\n\\\"last_name\\\": \\\"Berman\\\",\\n\\\"picture_url\\\": \\\"http://where_the_pics_live.com/the_bermanator.png\\\",\\n\\\"properties\\\": {\\\"great_customer\\\": \\\"true\\\"}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nand then send us another POST to this endpoint with the following properties:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\\"phone_number\\\": \\\"+13105551234\\\", \\n\\\"email\\\": \\\"[email protected]\\\", \\n\\\"first_name\\\": \\\"John\\\", \\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nthe result will be a customer that looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\\"phone_number\\\": \\\"+13105551234\\\", \\n\\\"email\\\": \\\"[email protected]\\\", \\n\\\"first_name\\\": \\\"John\\\", \\n\\\"last_name\\\": \\\"Berman\\\", \\n\\\"properties\\\": {\\\"great_customer\\\": \\\"true\\\"}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"What Changed?\",\n  \"body\": \"Notice the only changes to the customer were the fields that were provided other than phone_number (first_name and email).\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Country Code\",\n  \"body\": \"Please always include a country code (such as +1 for US) in all API calls to us.\"\n}\n[/block]","updates":["55ad69f1f302af23000abf38"],"order":4,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"55494b11ee219b0d001743bf","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["55208138623ff50d009b2bf0","55494a226a82a10d00817ae5","55494ba7ee219b0d001743c8","55494bc1ee219b0d001743cc","56ead8c1df765617008bccaf","573a2073dd007d1700cf288f","579695b1f64c9f0e007cd76c","57969e3dfa1ff60e006a1274","579a4592fd9f3c0e008e4f4a","57ab9afe54fa780e006c5430","57b784f5b7ebd60e009cb4a6","58f686818193090f008cec76","59e79fbd4cf31900341d50c6","5b2436973fd93f0003dcf99d","5d824fb2ce98a801366098a2"],"_id":"55208137623ff50d009b2bef","createdAt":"2015-04-05T00:26:31.564Z","releaseDate":"2015-04-05T00:26:31.563Z","__v":15,"project":"55208137623ff50d009b2bec"},"__v":15,"category":{"sync":{"isSync":false,"url":""},"pages":["55494ad0ee219b0d001743bb","55494b05f452670d00ec0c29","55494b11ee219b0d001743bf","55494b20ee219b0d001743c1","55494b2bee219b0d001743c3","55494b4a6a82a10d00817af5","55494b686a82a10d00817af9","5549651ccd09b317005f8f50","55497273cd09b317005f8f86","554977f0c634cf2d001250a7","55b970eab42b610d00c9b2e3","5696f3688560a60d00e2c216","5696f91c59a6692d003fad50","5696f92c24490c3700170a2d","5696f9700b09a41900b24422"],"title":"Public API","slug":"public-api","order":3,"from_sync":false,"reference":true,"_id":"55494a226a82a10d00817ae5","createdAt":"2015-05-05T22:54:26.925Z","project":"55208137623ff50d009b2bec","version":"55208137623ff50d009b2bef","__v":15},"parentDoc":null,"githubsync":"","project":"55208137623ff50d009b2bec","createdAt":"2015-05-05T22:58:25.573Z","editedParams":true,"user":"55208129504fd6230022ae20","editedParams2":true}

postAdd/Update Customer


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

phone_number:
required
string+13105551234
The phone number of the customer you want to add. This is the unique identifier for a customer.
email:
string
Email address of the customer.
first_name:
string
First name of the customer.
last_name:
string
Last name of the customer.
properties:
object{"great_customer": "true"}
Add as many properties as you want for each customer, in hash format.
picture_url:
stringhttp://where_the_pics_live.com/the_bermanator.png
Link to the customer's picture so you can see their picture whe replying to them
subscribed:
booleannull
Whether the customer will receive API Messages and Mass Messages.
assign:
object{"user_email": "[email protected]"}
Assign the customer to the team member (user) specified by their email.
zipcode:
string90210
Specific Zipcode of the contact
timezone:
stringAmerica/Los_Angeles
State the timezone your contact is in

Examples


Result Format


Documentation

[block:callout] { "type": "info", "title": "Timezones", "body": "Acceptable timezones come in the form of TZ database values. You can find a full list of timezones on this page: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" } [/block] ## **Updating Customers** Updating a customer is done the same way adding a Customer is done. When you send us a POST request to this endpoint using a Phone Number we recognize, we automatically update any values that are transferred to us in the request. [block:callout] { "type": "warning", "title": "Note", "body": "Phone Number is the unique identifier for each Customer and cannot currently be changed. All other Customer properties can be updated via this endpoint." } [/block] For example, if you add a Customer with the following properties: [block:code] { "codes": [ { "code": "{\n\"phone_number\": \"+13105551234\", \n\"email\": \"[email protected]\", \n\"first_name\": \"Matthew\", \n\"last_name\": \"Berman\",\n\"picture_url\": \"http://where_the_pics_live.com/the_bermanator.png\",\n\"properties\": {\"great_customer\": \"true\"}\n}", "language": "json" } ] } [/block] and then send us another POST to this endpoint with the following properties: [block:code] { "codes": [ { "code": "{\n\"phone_number\": \"+13105551234\", \n\"email\": \"[email protected]\", \n\"first_name\": \"John\", \n}", "language": "json" } ] } [/block] the result will be a customer that looks like: [block:code] { "codes": [ { "code": "{\n\"phone_number\": \"+13105551234\", \n\"email\": \"[email protected]\", \n\"first_name\": \"John\", \n\"last_name\": \"Berman\", \n\"properties\": {\"great_customer\": \"true\"}\n}", "language": "json" } ] } [/block] [block:callout] { "type": "info", "title": "What Changed?", "body": "Notice the only changes to the customer were the fields that were provided other than phone_number (first_name and email)." } [/block] [block:callout] { "type": "info", "title": "Country Code", "body": "Please always include a country code (such as +1 for US) in all API calls to us." } [/block]