copyright | link | is |
---|---|---|
Copyright IBM Corp. 2018 |
add-a-reaction |
published |
The addReaction mutation allows the API caller to add a reaction to a message. The mutation accepts a Message ID (targetId) and a reaction as arguments, and makes the request on behalf of the caller, adding the specified reaction to the message. The result will reflect the current count of users that reacted with the same reaction (string/emoji), and viewerHasReacted as to whether the caller has reacted (true).
type MutationRoot {
...
addReaction(input: AddReactionInput!): AddReactionMutation
}
type Reaction {
reaction: String!
count: Int
viewerHasReacted: Boolean!
}
type AddReactionMutation {
reaction: Reaction!
}
type AddReactionInput {
targetId: String!
reaction: String!
}
Method: POST
URL: https://api.watsonwork.ibm.com/graphql
Headers: 'Content-Type: application/graphql' , 'x-graphql-view: PUBLIC'
Body:
{
mutation {
addReaction(input: {targetId: "5a209f74e4b0faa757ac1afd", reaction: ":-)"}) {
reaction {
reaction
count
viewerHasReacted
}
}
}
{
"data": {
"addReaction": {
"reaction": {
"reaction": ":-)",
"count": 1,
"viewerHasReacted": true
}
}
}
}