{"_id":"56c41d423d30210d00ea851d","user":"56b98db7bb36440d0001f492","githubsync":"","project":"56bc8e679afb8b0d00d62dcf","category":{"_id":"56c4184754b6030d00ec29a1","__v":5,"version":"56bc8e689afb8b0d00d62dd2","pages":["56c41d423d30210d00ea851d","56c41d4954b6030d00ec29ae","56c41d602e75e0170098605c","56c41d684040602b0064ceaa","56c41d6f106c12170020dba8"],"project":"56bc8e679afb8b0d00d62dcf","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-02-17T06:50:47.963Z","from_sync":false,"order":5,"slug":"messages","title":"Messages"},"parentDoc":null,"version":{"_id":"56bc8e689afb8b0d00d62dd2","project":"56bc8e679afb8b0d00d62dcf","__v":18,"createdAt":"2016-02-11T13:36:40.146Z","releaseDate":"2016-02-11T13:36:40.146Z","categories":["56bc8e689afb8b0d00d62dd3","56c3c837bc41330d009f25ed","56c3c83e521f350d00d348eb","56c3c8452d97560d00e23cd8","56c3c85234df460d00c2beb8","56c4180d70187b17005f43b4","56c418162d97560d00e23cf6","56c4181cc4796b0d007ef039","56c4182370187b17005f43b5","56c418292e75e01700986052","56c4183328bd680d005e7ac6","56c4183bbb64720d00552b88","56c418414040602b0064cea0","56c4184754b6030d00ec29a1","56c4184c28bd680d005e7ac7","56c4185370187b17005f43b6","56c4185b6063071700500cfc","582a98b6f8c0a0190053d7a5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":5,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-17T07:12:02.323Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"/messages\"\n}\n[/block]\nSends a message from one user to one or more users.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var options = {\\n\\tto: \\\"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\\\",\\n\\tsubject: \\\"Reset Your Password\\\",\\n\\tbody: \\\"It looks like your password needs to be reset! Use this code to reset your password: :::at:::ResetCode\\\",\\n\\tinResponseTo: \\\"gb.FkwjNrLdlpBfc\\\",\\n\\tthread: \\\"Thread Title\\\",\\n\\tlocation: \\\"47.1, -121.292\\\"\\n};\\n\\nBuddy.post('/messages',\\n\\t\\toptions,\\n\\t\\tfunction(err, result) {\\n\\t\\t\\t \\n\\t\\t\\tif (result.success) {\\n\\t\\t\\t\\t// Do something with the result!\\n\\t\\t\\t} else { \\n\\t\\t\\t\\t// Otherwise log the error\\n\\t\\t\\t\\tconsole.log(err); \\n\\t\\t\\t} \\n\\t\\t}\\n\\t);\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"NSDictionary *params = @{\\n\\t\\t\\[email protected]\\\"to\\\": @\\\"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\\\",\\n\\t\\t\\[email protected]\\\"subject\\\": @\\\"Reset Your Password\\\",\\n\\t\\t\\[email protected]\\\"body\\\": @\\\"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\\\",\\n\\t\\t\\[email protected]\\\"inResponseTo\\\": @\\\"This Other Thread\\\",\\n\\t\\t\\[email protected]\\\"thread\\\": @\\\"Thread Title\\\",\\n\\t\\t\\[email protected]\\\"location\\\": BPCoordinateMake(47.1, -121.292)\\n\\t\\t};\\n\\n[Buddy POST:@\\\"/messages\\\" parameters:params class:[BPMessage class] callback:^(id obj, NSError *error) {\\n\\t// Your callback code here\\n}];\",\n      \"language\": \"objectivec\",\n      \"name\": \"iOS\"\n    },\n    {\n      \"code\": \"Map<String, Object> parameters = new HashMap<String, Object>();\\nparameters.put(\\\"to\\\", \\\"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\\\");\\nparameters.put(\\\"subject\\\", \\\"Reset Your Password\\\");\\nparameters.put(\\\"body\\\", \\\"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\\\");\\nparameters.put(\\\"inResponseTo\\\", \\\"This Other Thread\\\");\\nparameters.put(\\\"thread\\\", \\\"Thread Title\\\");\\nparameters.put(\\\"location\\\", myLocation);\\n\\nBuddy.<Message>post(\\\"/messages\\\", parameters, new BuddyCallback<Message>(Message.class) {\\n\\[email protected]\\n\\tpublic void completed(BuddyResult<Message> result) {\\n\\t\\t// Your callback code here\\n\\t}\\n});\",\n      \"language\": \"java\",\n      \"name\": \"Android\"\n    },\n    {\n      \"code\": \"var options = new {\\n\\t\\t\\tto = \\\"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\\\",\\n\\t\\t\\tsubject = \\\"Reset Your Password\\\",\\n\\t\\t\\tbody = \\\"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\\\",\\n\\t\\t\\tinResponseTo = \\\"This Other Thread\\\",\\n\\t\\t\\tthread = \\\"Thread Title\\\",\\n\\t\\t\\tlocation = new BuddyGeoLocation(47.1, -122.3)\\n\\t\\t};\\n\\nvar result = await Buddy.PostAsync<Message>(\\\"/messages\\\", options);\",\n      \"language\": \"csharp\",\n      \"name\": \".NET\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n###Body Parameters\n\nThese parameters should be specified as part of the request body.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"to\",\n    \"1-0\": \"subject\",\n    \"2-0\": \"body\",\n    \"3-0\": \"inResponseTo\",\n    \"4-0\": \"thread\",\n    \"5-0\": \"location\",\n    \"0-1\": \"An array of user IDs to send the message to.\",\n    \"1-1\": \"The subject line of the message.\",\n    \"2-1\": \"The body of the message.\",\n    \"3-1\": \"The ID of the message to respond to.\",\n    \"4-1\": \"Searches for messages belonging to a continuous message series.\",\n    \"5-1\": \"A location value, passed as a string in the format \\\"{latitude},{longitude}\\\" (e.g. \\\"47.1,-121.292\\\").\",\n    \"0-2\": \"JSON\",\n    \"1-2\": \"string\",\n    \"2-2\": \"string\",\n    \"4-2\": \"string\",\n    \"5-2\": \"string\",\n    \"3-2\": \"buddyId\",\n    \"0-3\": \"Required\",\n    \"1-3\": \"Required\",\n    \"2-3\": \"Optional\",\n    \"3-3\": \"Optional\",\n    \"4-3\": \"Optional\",\n    \"5-3\": \"Optional\"\n  },\n  \"cols\": 4,\n  \"rows\": 6\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"status\\\": 201,\\n  \\\"result\\\": {\\n    \\\"subject\\\": \\\"Test Message\\\",\\n    \\\"type\\\": \\\"Sent\\\",\\n    \\\"recipients\\\": [\\n      \\\"bv.kChbvshdHnDn\\\"\\n    ],\\n    \\\"isNew\\\": true,\\n    \\\"sent\\\": \\\"2014-07-15T20:05:36.867Z\\\",\\n    \\\"thread\\\": \\\"My Thread\\\",\\n    \\\"from\\\": \\\"bv.kChbvshdHnDn\\\",\\n    \\\"fromName\\\": \\\"\\\",\\n    \\\"toName\\\": \\\"\\\",\\n    \\\"to\\\": \\\"bv.kChbvshdHnDn\\\",\\n    \\\"warnings\\\": [],\\n    \\\"id\\\": \\\"gb.FHhbbzkMvxxp\\\",\\n    \\\"created\\\": \\\"2014-07-15T20:05:36.867Z\\\",\\n    \\\"lastModified\\\": \\\"2014-07-15T20:05:36.867Z\\\"\\n  },\\n  \\\"request_id\\\": \\\"53c58991b32fad0f9cb8e07b\\\",\\n  \\\"success\\\": true\\n} \",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"","slug":"send-message","type":"basic","title":"Send Message"}
[block:api-header] { "type": "post", "title": "/messages" } [/block] Sends a message from one user to one or more users. [block:code] { "codes": [ { "code": "var options = {\n\tto: \"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\",\n\tsubject: \"Reset Your Password\",\n\tbody: \"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\",\n\tinResponseTo: \"gb.FkwjNrLdlpBfc\",\n\tthread: \"Thread Title\",\n\tlocation: \"47.1, -121.292\"\n};\n\nBuddy.post('/messages',\n\t\toptions,\n\t\tfunction(err, result) {\n\t\t\t \n\t\t\tif (result.success) {\n\t\t\t\t// Do something with the result!\n\t\t\t} else { \n\t\t\t\t// Otherwise log the error\n\t\t\t\tconsole.log(err); \n\t\t\t} \n\t\t}\n\t);", "language": "javascript" }, { "code": "NSDictionary *params = @{\n\t\t\[email protected]\"to\": @\"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\",\n\t\t\[email protected]\"subject\": @\"Reset Your Password\",\n\t\t\[email protected]\"body\": @\"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\",\n\t\t\[email protected]\"inResponseTo\": @\"This Other Thread\",\n\t\t\[email protected]\"thread\": @\"Thread Title\",\n\t\t\[email protected]\"location\": BPCoordinateMake(47.1, -121.292)\n\t\t};\n\n[Buddy POST:@\"/messages\" parameters:params class:[BPMessage class] callback:^(id obj, NSError *error) {\n\t// Your callback code here\n}];", "language": "objectivec", "name": "iOS" }, { "code": "Map<String, Object> parameters = new HashMap<String, Object>();\nparameters.put(\"to\", \"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\");\nparameters.put(\"subject\", \"Reset Your Password\");\nparameters.put(\"body\", \"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\");\nparameters.put(\"inResponseTo\", \"This Other Thread\");\nparameters.put(\"thread\", \"Thread Title\");\nparameters.put(\"location\", myLocation);\n\nBuddy.<Message>post(\"/messages\", parameters, new BuddyCallback<Message>(Message.class) {\n\[email protected]\n\tpublic void completed(BuddyResult<Message> result) {\n\t\t// Your callback code here\n\t}\n});", "language": "java", "name": "Android" }, { "code": "var options = new {\n\t\t\tto = \"['bv.LNjbvtMsLCrq','bv.wPjbbctlLGrq','bv.dCkbvvdLqbvq']\",\n\t\t\tsubject = \"Reset Your Password\",\n\t\t\tbody = \"It looks like your password needs to be reset! Use this code to reset your password: @ResetCode\",\n\t\t\tinResponseTo = \"This Other Thread\",\n\t\t\tthread = \"Thread Title\",\n\t\t\tlocation = new BuddyGeoLocation(47.1, -122.3)\n\t\t};\n\nvar result = await Buddy.PostAsync<Message>(\"/messages\", options);", "language": "csharp", "name": ".NET" } ], "sidebar": true } [/block] ###Body Parameters These parameters should be specified as part of the request body. [block:parameters] { "data": { "0-0": "to", "1-0": "subject", "2-0": "body", "3-0": "inResponseTo", "4-0": "thread", "5-0": "location", "0-1": "An array of user IDs to send the message to.", "1-1": "The subject line of the message.", "2-1": "The body of the message.", "3-1": "The ID of the message to respond to.", "4-1": "Searches for messages belonging to a continuous message series.", "5-1": "A location value, passed as a string in the format \"{latitude},{longitude}\" (e.g. \"47.1,-121.292\").", "0-2": "JSON", "1-2": "string", "2-2": "string", "4-2": "string", "5-2": "string", "3-2": "buddyId", "0-3": "Required", "1-3": "Required", "2-3": "Optional", "3-3": "Optional", "4-3": "Optional", "5-3": "Optional" }, "cols": 4, "rows": 6 } [/block] [block:code] { "codes": [ { "code": "{\n \"status\": 201,\n \"result\": {\n \"subject\": \"Test Message\",\n \"type\": \"Sent\",\n \"recipients\": [\n \"bv.kChbvshdHnDn\"\n ],\n \"isNew\": true,\n \"sent\": \"2014-07-15T20:05:36.867Z\",\n \"thread\": \"My Thread\",\n \"from\": \"bv.kChbvshdHnDn\",\n \"fromName\": \"\",\n \"toName\": \"\",\n \"to\": \"bv.kChbvshdHnDn\",\n \"warnings\": [],\n \"id\": \"gb.FHhbbzkMvxxp\",\n \"created\": \"2014-07-15T20:05:36.867Z\",\n \"lastModified\": \"2014-07-15T20:05:36.867Z\"\n },\n \"request_id\": \"53c58991b32fad0f9cb8e07b\",\n \"success\": true\n} ", "language": "json", "name": "Response" } ], "sidebar": true } [/block]