Skip to main content

messages.startBot

Start a conversation with a bot using a deep linking parameter

func (c *Client) MessagesStartBot(ctx context.Context, request *MessagesStartBotRequest) (UpdatesClass, error)

Calling this method

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

res, err := api.MessagesStartBot(ctx, &tg.MessagesStartBotRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
BotInputUserClassyesThe bot
PeerInputPeerClassyesThe chat where to start the bot, can be the bot's private chat or a group
RandomIDint64yesRandom ID to avoid resending the same message
StartParamstringyesDeep linking parameter

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400BOT_INVALIDThis is not a valid bot.
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
400PEER_ID_INVALIDThe provided peer id is invalid.
500RANDOM_ID_DUPLICATEYou provided a random ID that was already used.
400START_PARAM_EMPTYThe start parameter is empty.
400START_PARAM_INVALIDStart parameter invalid.
400START_PARAM_TOO_LONGStart parameter is too long.

References