Reputation: 393
Hello every one i have right now go for the my app to sync with telegram bot.and i need to send some messages on group on the telegram bot.for ex. i have create one one group on the telegram bot like group name is "Rock" and my bot name is like "ABC". now i need to from my c# side need some create api and send message using group name. i have find many links but all link give idea with chat id. but i want work with group name.here i have create one api for the send message but it's working with chat id and not work for the group.
Here this is my api =>
[System.Web.Http.AcceptVerbs("GET", "POST")]
public void sendMessage(string destID, string text)
{
try
{
Bot.SendTextMessageAsync(destID, text);
}
catch (Exception e)
{
Console.WriteLine("err");
}
}
any one know how can do that please let me know. using group name i want to send message on telegram bot.
Upvotes: 2
Views: 7413
Reputation: 3490
The group name isn't unique and telegram can't use that for sending a message. Because a name may be used for several groups. Which one should be selected?
You have no another option but if you want to simplify your code, you can store group-id as const variable:
public const double Rock= '164865465465';
and use like this:
SendMessage(Rock, text);
Upvotes: 0
Reputation: 7995
You can't use title as parameter to send message, think about two group have same name? :)
If you don't want to send via Chat ID, try group username.
Unique identifier for the target chat or username of the target channel (in the format @channelusername)
Upvotes: 1