{"_id":"55494b11ee219b0d001743bf","version":{"_id":"55208137623ff50d009b2bef","__v":14,"project":"55208137623ff50d009b2bec","createdAt":"2015-04-05T00:26:31.564Z","releaseDate":"2015-04-05T00:26:31.563Z","categories":["55208138623ff50d009b2bf0","55494a226a82a10d00817ae5","55494ba7ee219b0d001743c8","55494bc1ee219b0d001743cc","56ead8c1df765617008bccaf","573a2073dd007d1700cf288f","579695b1f64c9f0e007cd76c","57969e3dfa1ff60e006a1274","579a4592fd9f3c0e008e4f4a","57ab9afe54fa780e006c5430","57b784f5b7ebd60e009cb4a6","58f686818193090f008cec76","59e79fbd4cf31900341d50c6","5b2436973fd93f0003dcf99d"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":10,"category":{"_id":"55494a226a82a10d00817ae5","project":"55208137623ff50d009b2bec","version":"55208137623ff50d009b2bef","__v":15,"pages":["55494ad0ee219b0d001743bb","55494b05f452670d00ec0c29","55494b11ee219b0d001743bf","55494b20ee219b0d001743c1","55494b2bee219b0d001743c3","55494b4a6a82a10d00817af5","55494b686a82a10d00817af9","5549651ccd09b317005f8f50","55497273cd09b317005f8f86","554977f0c634cf2d001250a7","55b970eab42b610d00c9b2e3","5696f3688560a60d00e2c216","5696f91c59a6692d003fad50","5696f92c24490c3700170a2d","5696f9700b09a41900b24422"],"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-05-05T22:54:26.925Z","from_sync":false,"order":2,"slug":"public-api","title":"Public API"},"parentDoc":null,"githubsync":"","project":"55208137623ff50d009b2bec","editedParams":true,"user":"55208129504fd6230022ae20","editedParams2":true,"updates":["55ad69f1f302af23000abf38"],"next":{"pages":[],"description":""},"createdAt":"2015-05-05T22:58:25.573Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","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\"}}'","language":"curl"}]},"method":"post","results":{"codes":[{"code":"{\n  \"phone_number\": \"+13105551234\",\n  \"email\": \"matt@sendsonar.com\",\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}","name":"","status":201,"language":"json"}]},"settings":"","auth":"required","params":[{"_id":"55497409cd09b317005f8f89","ref":"","in":"body","required":true,"desc":"The phone number of the customer you want to add. This is the unique identifier for a customer.","default":"+13105551234","type":"string","name":"phone_number"},{"_id":"55497409cd09b317005f8f88","ref":"","in":"body","required":false,"desc":"Email address of the customer.","default":"","type":"string","name":"email"},{"_id":"554975b4a5ecbc19003216ab","ref":"","in":"body","required":false,"desc":"First name of the customer.","default":"","type":"string","name":"first_name"},{"_id":"554975b4a5ecbc19003216aa","ref":"","in":"body","required":false,"desc":"Last name of the customer.","default":"","type":"string","name":"last_name"},{"_id":"554975b4a5ecbc19003216a9","ref":"","in":"body","required":false,"desc":"Add as many properties as you want for each customer, in hash format.","default":"{\"great_customer\": \"true\"}","type":"object","name":"properties"},{"_id":"55b955dab42b610d00c9b26b","ref":"","in":"body","required":false,"desc":"Link to the customer's picture so you can see their picture whe replying to them","default":"http://where_the_pics_live.com/the_bermanator.png","type":"string","name":"picture_url"},{"_id":"55d65976250d7d0d004273ef","ref":"","in":"body","required":false,"desc":"Whether the customer will receive API Messages and Mass Messages.","default":"true","type":"boolean","name":"subscribed"},{"_id":"55fc77eaaf72eb0d0007e06e","ref":"","in":"body","required":false,"desc":"Assign the customer to the team member (user) specified by their email.","default":"{\"user_email\": \"matt@sendsonar.com\"}","type":"object","name":"assign"}],"url":"/customers"},"isReference":true,"order":6,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Updating Customers\"\n}\n[/block]\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\\\": \\\"matt@sendsonar.com\\\", \\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\\\": \\\"john@sendsonar.com\\\", \\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\\\": \\\"john@sendsonar.com\\\", \\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]","excerpt":"","slug":"addupdate-customer","type":"endpoint","title":"Add/Update Customer"}

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:
booleantrue
Whether the customer will receive API Messages and Mass Messages.
assign:
object{"user_email": "matt@sendsonar.com"}
Assign the customer to the team member (user) specified by their email.

Examples


Result Format


Documentation

[block:api-header] { "type": "basic", "title": "Updating Customers" } [/block] 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\": \"matt@sendsonar.com\", \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\": \"john@sendsonar.com\", \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\": \"john@sendsonar.com\", \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]