Skip to content

MetaData doesn't work with PostMessage #1343

@nivzx

Description

@nivzx

What happened

Assigning metadata with client.PostMessage, it didn't work.

Expected behavior

Assigning MetaData using MsgOptionPostMessageParameters() (like in here) should include given key-value pair in the message metadata.

Steps to reproduce

  • Post a message to a channel with MetaData defined, and log the received message event. In the posted message event, the event_type and event_payload of MetaData are empty.
...
"metadata": {
    "event_type": "",
    "event_payload": null
},
...

reproducible code

package handlers

import (
	"github.com/slack-go/slack"
)

func main {
	api = slack.New("xoxb-xxx")

	// Define PostMessageParameters
	messageParameters := slack.PostMessageParameters{
		MetaData: slack.SlackMetadata{
			EventType: "reaction_added",
			EventPayload: map[string]interface{}{
				"event_id": "123",
			},
		},
	}

	// Post a message to a channel with the created messageParameters
	_, _, err := api.PostMessage(
		"channel-name",
		slack.MsgOptionText("Hello", false),
		slack.MsgOptionPostMessageParameters(messageParameters),
	)
}

Versions

  • Go: 1.23
  • slack-go/slack: 0.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions