How do I post a message to Yammer with a specific topic using the API?

StackOverflow https://stackoverflow.com/questions/10550299

  •  07-06-2021
  •  | 
  •  

Вопрос

I've got an application using the Yammer API, and I have a specific topic that I'd like to apply to a message (I know it by topicid).

The API is incredibly unclear: https://developer.yammer.com/api/#messages-manipulating

>*topicn*
>
>Topics to apply to the message. Can use topic1 through topic20.

If I send a message with

topic1:1234567

Where the number is a topicid. I get a message with a topic entitled the topic number.

Any idea what the syntax is to get the topic to match that topicid instead of creating a new one?

Это было полезно?

Решение

I struggled with the documentation as well - for me, the following worked: "body=A message with topics #foo #bar". In other words, the topics are the actual tags. Note that depending on the media type you set, certain characters (such as ";") may be problematic in the string.

Другие советы

You can both :

  • add the tag in the message Body.

Exemple if your topic is "Software" and you add in the message Body #Software you will see that the topic Software has been added to your post but you will also see #Software as a link in the message body. Not fantastic...

  • pass the topic in parameter

This is the correct syntax :

yam.platform.request(
   { 
      url: "https://api.yammer.com/api/v1/messages.json"
      , method: "POST"
      , data: {
       "body" :  msg_value
      ,"group_id" : groupID
      ,topic1 : "Software"
     }

...

Doing it that way, you won't see the topic name in the post...This is much better :-)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top