Jul 07 2018 04:43 AM
How to send announcement in yammer through api i tried below but its not working.Giving some security state:0 error.Even though i selected log in before posting.
url: "messages.json"
,headers: {'Authorization': 'Bearer GGFFBBB-88966333' }
, method: "POST"
, data: {
"body": "Msg",
"log_data[publisher_type]": "yam.ui.publisher.global.AnnouncementPublisher",
"log_data[publisher_source]": "group",
"log_data[number_of_recipients]": "1",
"invited_user_ids": "",
"skip_body_notifications": "true",
"group_id":"44556699",
"is_rich_text": "true",
"message_type": "announcement",
"title": "Title"
}
, success: function (msg) { alert("Post was Successful!"); }
, error: function (msg) { alert("Error"+JSON.stringify(msg)); }
Jul 09 2018 07:38 AM - edited Jul 09 2018 07:46 AM
Couple of things to check:
The POST will look something like (for speed I've used the Flow so its added in a couple of extras):
[
{
"id": 1120667167,
"sender_id": 1512434534,
"replied_to_id": null,
"created_at": "2018/07/09 14:41:44 +0000",
"network_id": 41253,
"message_type": "announcement",
"sender_type": "user",
"url": "https://www.yammer.com/api/v1/messages/1120667167",
"web_url": "https://www.yammer.com/tenantname/messages/1120667167",
"group_id": 4191007,
"title": "Testing (ignore)",
"body": {
"parsed": "Testing posting from Flow with some html\n",
"plain": "Testing posting from Flow with some html",
"rich": "Testing posting from Flow <p>with some html</p>"
},
"thread_id": 1120667167,
"client_type": "Microsoft PowerApps and Flow (Europe)",
"client_url": "http://www.powerapps.com",
"system_message": false,
"direct_message": false,
"chat_client_sequence": null,
"language": null,
"notified_user_ids": [],
"privacy": "public",
"attachments": [],
"liked_by": {
"count": 0,
"names": []
},
"content_excerpt": "Testing posting from Flow with some html",
"group_created_id": 4191007
}
]