Skip to main content

channels.searchPosts

Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. Exactly one of query and hashtag must be set.

func (c *Client) ChannelsSearchPosts(ctx context.Context, request *ChannelsSearchPostsRequest) (MessagesMessagesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.ChannelsSearchPosts(ctx, &tg.ChannelsSearchPostsRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // MessagesMessagesClass
return nil
})

Parameters

NameTypeRequiredDescription
HashtagstringThe hashtag to search, without the # character.
QuerystringThe full text query: each user has a limited amount of free full text search slots, after which payment is required, see here » for more info on the full flow.
OffsetRateintyesInitially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message.
OffsetPeerInputPeerClassyesOffsets for pagination, for more info click here
OffsetIDintyesOffsets for pagination, for more info click here
LimitintyesMaximum number of results to return, see pagination
AllowPaidStarsint64For full text post searches (query), allows payment of the specified amount of Stars for the search, see here » for more info on the full flow.

Returns

MessagesMessagesClass

Possible errors

CodeTypeDescription
420FROZEN_METHOD_INVALIDThe current account is frozen, and thus cannot execute the specified action.
403PREMIUM_ACCOUNT_REQUIREDA premium account is required to execute this action.

References