{"_id":"547fab89b7c1e40800dcf511","__v":17,"category":{"_id":"546b909462515a14007ebc43","project":"545137a814af501a00b50cf9","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"],"version":"545137a814af501a00b50cfc","__v":56,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2014-11-18T18:31:48.943Z","from_sync":false,"order":2,"slug":"rest-api","title":"REST API"},"user":"5433099f9a2b451a00ad4531","editedParams":true,"editedParams2":true,"parentDoc":null,"version":{"_id":"545137a814af501a00b50cfc","project":"545137a814af501a00b50cf9","__v":11,"createdAt":"2014-10-29T18:53:28.525Z","releaseDate":"2014-10-29T18:53:28.525Z","categories":["545137a814af501a00b50cfd","545138eaa66f020800dbab4a","546b9072b47b5d1400109edf","546b9082b47b5d1400109ee0","546b9088b47b5d1400109ee1","546b909462515a14007ebc43","546b90a0b47b5d1400109ee2","546ced235884600e007a92f6","5481008eea7fd40b00cd7c2b","573b9d83ee2b3b220042291f","57be1efa15efc70e006a5f99"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"project":"545137a814af501a00b50cf9","updates":["54c754afd0d3360d0081c48b","553f413623c53c0d00cccc58","555639bb150ba30d00f4e0c1","578818cde516ba0e00304798","5818a207beb0c20f000d4414"],"next":{"pages":[],"description":""},"createdAt":"2014-12-04T00:32:09.397Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","try":true,"examples":{"codes":[]},"method":"post","basic_auth":false,"results":{"codes":[]},"auth":"required","params":[{"_id":"54bfff6c77d8030d0065c0f0","ref":"","in":"body","required":false,"desc":"The text of the message body.","default":"","type":"string","name":"body"},{"_id":"58136aecb9661c0f0058a0f8","ref":"","in":"body","required":false,"desc":"The message ID this message is in reply to.  If this is set then `group_id` and `network_id` are inferred from it.","default":"","type":"int","name":"replied_to_id"},{"_id":"58137a2b22a26a19004afba0","ref":"","in":"body","required":false,"desc":"Send a private message to one or more users, specified by ID.","default":"","type":"array_int","name":"direct_to_user_ids"},{"_id":"54bfff6c77d8030d0065c0ef","ref":"","in":"body","required":false,"desc":"Post the message to this group, specified by ID.  If this is set then the network_id is inferred from it.  A post without `direct_to_user_ids`, `replied_to_id` or `group_id` will default to All Company group","default":"","type":"int","name":"group_id"},{"_id":"581369068f8e031900a9d50e","ref":"","in":"header","required":false,"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","default":"","type":"string","name":"yammer-capabilities"},{"_id":"58137a2b22a26a19004afb9f","ref":"","in":"body","required":false,"desc":"Post a message in the 'All Company' feed of this network, if `replied_to_id`, `direct_to_user_ids` and `group_id` are all omitted.","default":"","type":"int","name":"network_id"}],"url":"/messages.json"},"isReference":true,"order":11,"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.\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 two methods to associate attachments with a message. Both make use of multi-part HTTP upload (see RFC1867) and both have a file size upload limit of 25MB.\n\nThe first method is the easiest, simply use file form elements with names `attachment1` through `attachment20`. If there are a several attachments or the attachments are large it may take some time for a message to POST causing your application to appear to hang.\n\nAn alternative way is to use the Pending Attachments resource (see below for details) allowing attachments to be uploaded in parallel. Apps that support HTTP chunked transfer encoding can monitor the progress of each upload. On success each pending attachment’s response body includes an id. These pending attachment ids are to be submitted with the message using form elements `pending_attachment1` through `pending_attachment20`. Finally, if form elements for both `attachmentN` and `pending_attachmentN` are present only the `pending_attachmentN` elements will be honored.\n\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.\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"WARNING!\",\n  \"body\": \"The API Explorer (\\\"Try It\\\") will POST to your home Yammer network.\"\n}\n[/block]","excerpt":"","slug":"messages-json-post","type":"endpoint","title":"/messages.json"}

post/messages.json


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

body:
string
The text of the message body.
replied_to_id:
integer
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 integers
Send a private message to one or more users, specified by ID.
group_id:
integer
Post the message to this group, specified by ID. If this is set then the network_id is inferred from it. A post without `direct_to_user_ids`, `replied_to_id` or `group_id` will default to All Company group
network_id:
integer
Post a message in the 'All Company' feed of this network, 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. ##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 two methods to associate attachments with a message. Both make use of multi-part HTTP upload (see RFC1867) and both have a file size upload limit of 25MB. The first method is the easiest, simply use file form elements with names `attachment1` through `attachment20`. If there are a several attachments or the attachments are large it may take some time for a message to POST causing your application to appear to hang. An alternative way is to use the Pending Attachments resource (see below for details) allowing attachments to be uploaded in parallel. Apps that support HTTP chunked transfer encoding can monitor the progress of each upload. On success each pending attachment’s response body includes an id. These pending attachment ids are to be submitted with the message using form elements `pending_attachment1` through `pending_attachment20`. Finally, if form elements for both `attachmentN` and `pending_attachmentN` are present only the `pending_attachmentN` elements will be honored. ## 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. [block:callout] { "type": "danger", "title": "WARNING!", "body": "The API Explorer (\"Try It\") will POST to your home Yammer network." } [/block]

User Information

Note: Do not use this token in your app; you'll need to get the OAuth token yourself.

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}