Skip to content
V2 (Legacy) API ReferenceGet started

Add or remove a reaction to a message

client.Messages.AddReaction(ctx, messageID, body) (*MessageAddReactionResponse, error)
POST/v3/messages/{messageId}/reactions

Add or remove emoji reactions to messages. Reactions let users express their response to a message without sending a new message.

Supported Reactions:

  • love ❤️
  • like 👍
  • dislike 👎
  • laugh 😂
  • emphasize ‼️
  • question ❓
  • custom - any emoji (use custom_emoji field to specify)
ParametersExpand Collapse
messageID string
formatuuid
body MessageAddReactionParams
Operation param.Field[MessageAddReactionParamsOperation]

Whether to add or remove the reaction

const MessageAddReactionParamsOperationAdd MessageAddReactionParamsOperation = "add"
const MessageAddReactionParamsOperationRemove MessageAddReactionParamsOperation = "remove"
Type param.Field[ReactionType]

Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh, emphasize, question. Custom emoji reactions have type “custom” with the actual emoji in the custom_emoji field. Sticker reactions have type “sticker” with sticker attachment details in the sticker field.

CustomEmoji param.Field[string]Optional

Custom emoji string. Required when type is “custom”.

PartIndex param.Field[int64]Optional

Optional index of the message part to react to. If not provided, reacts to the entire message (part 0).

ReturnsExpand Collapse
type MessageAddReactionResponse struct{…}
Message stringOptional
Status stringOptional
TraceID stringOptional

Add or remove a reaction to a message

package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
  "github.com/linq-team/linq-go/shared"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Messages.AddReaction(
    context.TODO(),
    "69a37c7d-af4f-4b5e-af42-e28e98ce873a",
    linqgo.MessageAddReactionParams{
      Operation: linqgo.MessageAddReactionParamsOperationAdd,
      Type: shared.ReactionTypeLove,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.TraceID)
}
{
  "message": "Reaction processed",
  "status": "accepted",
  "trace_id": "trace_id"
}
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format"
  },
  "success": false
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error"
  },
  "success": false
}
Returns Examples
{
  "message": "Reaction processed",
  "status": "accepted",
  "trace_id": "trace_id"
}
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format"
  },
  "success": false
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error"
  },
  "success": false
}