{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/messages.json","auth":"required","settings":"","try":true,"examples":{"codes":[]},"method":"post","params":[{"name":"body","type":"string","default":"","desc":"The text of the message body.","required":false,"in":"body","ref":"","_id":"54bfff6c77d8030d0065c0f0"},{"name":"replied_to_id","type":"int","default":"JSON","desc":"The message ID this message is in reply to.  If this is set then `group_id` and `network_id` are inferred from it.","required":false,"in":"body","ref":"","_id":"58136aecb9661c0f0058a0f8"},{"name":"direct_to_user_ids","type":"array_int","default":"JSON","desc":"Send a private message to one or more users, specified by ID.","required":false,"in":"body","ref":"","_id":"58137a2b22a26a19004afba0"},{"name":"group_id","type":"int","default":"JSON","desc":"Post the message to this group, specified by ID. If this is set then the network_id is inferred from it.  If your 'All Company' group does not have a numeric 'feed_id' then a post without `direct_to_user_ids`, `replied_to_id` or `group_id` will default to All Company group","required":false,"in":"body","ref":"","_id":"54bfff6c77d8030d0065c0ef"},{"name":"yammer-capabilities","type":"string","default":"","desc":"Set this header to \"external-messaging,external-groups\" to be able post to external threads and groups.  If you are doing this then your app should make it clear to users that their message can be seen by people outside their organisation when it includes external participants.  See https://support.office.com/en-gb/article/External-messaging-FAQ-Yammer-35b59d6c-bb1c-4541-bf19-9f67d2f2b199","required":false,"in":"header","ref":"","_id":"581369068f8e031900a9d50e"},{"name":"network_id","type":"int","default":"JSON","desc":"If your 'All Company' does not have a numeric 'feed_id' then you can post a message in the 'All Company' feed if `replied_to_id`, `direct_to_user_ids` and `group_id` are all omitted.","required":false,"in":"body","ref":"","_id":"58137a2b22a26a19004afb9f"}],"basic_auth":false,"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"/messages.json","type":"endpoint","slug":"messages-json-post","excerpt":"","body":"* Create a new message. The response body will include the new message formatted the same way as message polling above. This allows your app to immediately display the newly-posted message back to the user.\n\nPOST messages are form encoded.\n\nTo post in an existing Yammer conversation, set the `replied_to_id` to the ID of the message that you're replying to.  \n\nTo start a new Yammer conversation, specify where the message should be posted using one of `direct_to_user_ids`, `group_id`, or `network_id`.\n·       Specify  `direct_to_user_ids` to send a private message to just those users.  They will see the message in their Yammer Inbox, but not in a group on Yammer.\n·       To post in group, specify the `group_id` parameter. \n·       If only the 'network_id' is specified, then the message will be posted in the 'All Company' feed in Yammer for networks that have the 'All Company' group feed id as 'company'. For networks that have a numeric feed id for their 'All Company' group, use the 'feed_id' as a 'group_id' in the request body to post to the 'All Company' group.\n\n##Announcements\n\nTo send an announcement, set the following parameters, and use HTML to format the message body. \n\nis_rich_text:true\nmessage_type:announcement\ntitle: your text here. \n\n## Applying topics\n\nTo apply topics to the message provide the topic name(s) in parameters `topic1` through `topic20`.\n\n## Attaching Files\n\nYammer provides the uploadSmallFile API for attachments with a message. There is a file size upload limit of 4MB. On success each small file upload response body includes an id. Let's assume you have a file with the id=123456. In order to upload that file with the message, in the body parameters of the message.json API, you can add: *attached_objects[]: uploaded_file: 123456*. If you need to attach multiple files, then you can add one line per file in the body parameters of the API.\n\nHere is an example:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/d9d7ff8-file_attachment_in_messages.png\",\n        \"file_attachment_in_messages.png\",\n        1772,\n        702,\n        \"#f2f2f2\"\n      ]\n    }\n  ]\n}\n[/block]\n## Attaching Open Graph Objects\n\nA message may contain an Open Graph (OG) object as an attachment. The `og_url` parameter is required, the other parameters are optional.\n\n`og_url` - (required) The canonical URL of the OG object that will be used as its permanent ID in the graph.\n\n`og_fetch` - unless set to false, this flag will ask the Yammer server will fetch the page at the given URL and attempt to populate the other OG parameters automatically. For this to work, the page must be publicly accessible over the Internet from Yammer’s servers.\n\n`og_title` - The title of your object as it should appear within the graph.\n\n`og_image` - A thumbnail image URL which represents your object in the graph.\n\n`og_description` - A one to two sentence description of your object.\n\n`og_object_type` - The type of your object, e.g., “employee”. Must be a supported type, [please check out the OpenGraph documentation](https://developer.yammer.com/v1.0/docs/schema).\n\n`og_site_name` – An identifier to relate objects from a common domain, e.g., “Yammer Blog”.\n\n`og_meta` – Structured metadata about this object that can be used by clients for custom rendering.\n\n`og_private` - Mark the OpenGraph object as \"private\". For messages posted in private groups or private conversations, all viewers of those groups and conversations will be able to see the object, but it will not be viewable to any other users in the network. If this flag is set to \"true\" and the message is posted into a public group, the flag will take no effect.","updates":["54c754afd0d3360d0081c48b","553f413623c53c0d00cccc58","555639bb150ba30d00f4e0c1","578818cde516ba0e00304798","5818a207beb0c20f000d4414"],"order":12,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"547fab89b7c1e40800dcf511","__v":24,"createdAt":"2014-12-04T00:32:09.397Z","category":{"sync":{"isSync":false,"url":""},"pages":["546fdf54a179880800187e8b","54738e24007eb108007e03ff","54738e7d1a20c70800e189b0","54738e8a007eb108007e0404","54738e9b1a20c70800e189b2","54738ec0007eb108007e0407","54738ed21a20c70800e189b5","54738ee2007eb108007e0414","54738f05007eb108007e0416","54738f23007eb108007e0418","54738f31007eb108007e041a","547f80f9b7c1e40800dcf46f","547f9758b7c1e40800dcf4c2","547f9a3f3031bc0800e5fec4","547fa5f63031bc0800e5fef3","547fa632b7c1e40800dcf4e9","547fa696b7c1e40800dcf4ec","547fa6cc3031bc0800e5fef6","547fab89b7c1e40800dcf511","547facedb7c1e40800dcf51f","547faeef3031bc0800e5ff2d","547fafb03031bc0800e5ff31","547fb05ab7c1e40800dcf52a","547fb07a3031bc0800e5ff38","547fb0c4b7c1e40800dcf531","547fb100b7c1e40800dcf535","547fb18c3031bc0800e5ff41","547fb2433031bc0800e5ff44","547fb2feb7c1e40800dcf539","547fb335b7c1e40800dcf53b","547fb4aa3031bc0800e5ff49","547fb4f4b7c1e40800dcf541","547fb553b7c1e40800dcf544","54809ecd5f83dd0800c38fd3","54809f715f83dd0800c38fd6","54809fa8a3e4ea22000976b7","54809fd3a3e4ea22000976ba","5480a00ba3e4ea22000976bc","5480f44dea7fd40b00cd7c06","5480f4fb0e664d0b00be35f9","5480f5a5ea7fd40b00cd7c0b","5480f607ea7fd40b00cd7c10","5480f657ea7fd40b00cd7c12","5480f69a0e664d0b00be35ff","5480f77aea7fd40b00cd7c14","5480f7e7ea7fd40b00cd7c18","5480f83dea7fd40b00cd7c1b","5480f950ea7fd40b00cd7c1e","5480f9a6ab84321d00eaf538","5480faa8ea7fd40b00cd7c22","5480fb0aea7fd40b00cd7c25","5480fbd8ea7fd40b00cd7c27","5480fc64ab84321d00eaf53c","54c01ec89290010d00934956","55581594e54fe019002a4f2c","556e8b29fc3aa80d00e1a953"],"title":"REST API","slug":"rest-api","order":2,"from_sync":false,"reference":true,"_id":"546b909462515a14007ebc43","project":"545137a814af501a00b50cf9","version":"545137a814af501a00b50cfc","__v":56,"createdAt":"2014-11-18T18:31:48.943Z"},"user":"5433099f9a2b451a00ad4531","editedParams":true,"editedParams2":true,"parentDoc":null,"version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["545137a814af501a00b50cfd","545138eaa66f020800dbab4a","546b9072b47b5d1400109edf","546b9082b47b5d1400109ee0","546b9088b47b5d1400109ee1","546b909462515a14007ebc43","546b90a0b47b5d1400109ee2","546ced235884600e007a92f6","5481008eea7fd40b00cd7c2b","573b9d83ee2b3b220042291f","57be1efa15efc70e006a5f99","5ee004f52c97b4004c7a5876"],"_id":"545137a814af501a00b50cfc","project":"545137a814af501a00b50cf9","__v":12,"createdAt":"2014-10-29T18:53:28.525Z","releaseDate":"2014-10-29T18:53:28.525Z"},"githubsync":"","project":"545137a814af501a00b50cf9"}

post/messages.json


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

body:
string
The text of the message body.
replied_to_id:
integerJSON
The message ID this message is in reply to. If this is set then `group_id` and `network_id` are inferred from it.
direct_to_user_ids:
array of integersJSON
Send a private message to one or more users, specified by ID.
group_id:
integerJSON
Post the message to this group, specified by ID. If this is set then the network_id is inferred from it. If your 'All Company' group does not have a numeric 'feed_id' then a post without `direct_to_user_ids`, `replied_to_id` or `group_id` will default to All Company group
network_id:
integerJSON
If your 'All Company' does not have a numeric 'feed_id' then you can post a message in the 'All Company' feed if `replied_to_id`, `direct_to_user_ids` and `group_id` are all omitted.

Headers

yammer-capabilities:
string
Set this header to "external-messaging,external-groups" to be able post to external threads and groups. If you are doing this then your app should make it clear to users that their message can be seen by people outside their organisation when it includes external participants. See https://support.office.com/en-gb/article/External-messaging-FAQ-Yammer-35b59d6c-bb1c-4541-bf19-9f67d2f2b199

Documentation

* Create a new message. The response body will include the new message formatted the same way as message polling above. This allows your app to immediately display the newly-posted message back to the user. POST messages are form encoded. To post in an existing Yammer conversation, set the `replied_to_id` to the ID of the message that you're replying to. To start a new Yammer conversation, specify where the message should be posted using one of `direct_to_user_ids`, `group_id`, or `network_id`. · Specify `direct_to_user_ids` to send a private message to just those users. They will see the message in their Yammer Inbox, but not in a group on Yammer. · To post in group, specify the `group_id` parameter. · If only the 'network_id' is specified, then the message will be posted in the 'All Company' feed in Yammer for networks that have the 'All Company' group feed id as 'company'. For networks that have a numeric feed id for their 'All Company' group, use the 'feed_id' as a 'group_id' in the request body to post to the 'All Company' group. ##Announcements To send an announcement, set the following parameters, and use HTML to format the message body. is_rich_text:true message_type:announcement title: your text here. ## Applying topics To apply topics to the message provide the topic name(s) in parameters `topic1` through `topic20`. ## Attaching Files Yammer provides the uploadSmallFile API for attachments with a message. There is a file size upload limit of 4MB. On success each small file upload response body includes an id. Let's assume you have a file with the id=123456. In order to upload that file with the message, in the body parameters of the message.json API, you can add: *attached_objects[]: uploaded_file: 123456*. If you need to attach multiple files, then you can add one line per file in the body parameters of the API. Here is an example: [block:image] { "images": [ { "image": [ "https://files.readme.io/d9d7ff8-file_attachment_in_messages.png", "file_attachment_in_messages.png", 1772, 702, "#f2f2f2" ] } ] } [/block] ## Attaching Open Graph Objects A message may contain an Open Graph (OG) object as an attachment. The `og_url` parameter is required, the other parameters are optional. `og_url` - (required) The canonical URL of the OG object that will be used as its permanent ID in the graph. `og_fetch` - unless set to false, this flag will ask the Yammer server will fetch the page at the given URL and attempt to populate the other OG parameters automatically. For this to work, the page must be publicly accessible over the Internet from Yammer’s servers. `og_title` - The title of your object as it should appear within the graph. `og_image` - A thumbnail image URL which represents your object in the graph. `og_description` - A one to two sentence description of your object. `og_object_type` - The type of your object, e.g., “employee”. Must be a supported type, [please check out the OpenGraph documentation](https://developer.yammer.com/v1.0/docs/schema). `og_site_name` – An identifier to relate objects from a common domain, e.g., “Yammer Blog”. `og_meta` – Structured metadata about this object that can be used by clients for custom rendering. `og_private` - Mark the OpenGraph object as "private". For messages posted in private groups or private conversations, all viewers of those groups and conversations will be able to see the object, but it will not be viewable to any other users in the network. If this flag is set to "true" and the message is posted into a public group, the flag will take no effect.