Telegram Bot API
🌐 Español

setMyProfilePhoto

Categoría: Info del bot · Bot API 10.3 · Documentación oficial

Establece la foto de perfil del bot.

Devuelve: Si la llamada tiene éxito, devuelve True.

Parámetros

ParámetroTipoObligatorioDescripción
photoInputProfilePhotoSíURL o file_id de la foto de perfil

Las descripciones de los parámetros son resúmenes breves; consulta la documentación oficial para ver el texto completo.

Ejemplo de solicitud

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/setMyProfilePhoto" \
  -H "Content-Type: application/json" \
  -d '{"photo":{"type":"static","photo":"attach://photo"}}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/setMyProfilePhoto",
    json={
        "photo": {
            "type": "static",
            "photo": "attach://photo"
        }
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setMyProfilePhoto`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "photo": {
      "type": "static",
      "photo": "attach://photo"
    }
  }),
});
console.log(await res.json());

Guía paso a paso: Cómo crear un bot en Telegram paso a paso: de BotFather a tu primer mensaje