国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

html5笑話網(wǎng)站源碼上海seo網(wǎng)絡(luò)優(yōu)化

html5笑話網(wǎng)站源碼,上海seo網(wǎng)絡(luò)優(yōu)化,廣告網(wǎng)店,wordpress動畫插件下載當(dāng)前飛書webhook機器人還不支持發(fā)送文件類型的群消息,可以申請創(chuàng)建一個機器人應(yīng)用來實現(xiàn)群發(fā)送文件消息。 創(chuàng)建機器人后,需要開通一系列權(quán)限,然后發(fā)布。由管理員審核通過后,才可使用。 包括如下的權(quán)限,可以獲取群的c…

當(dāng)前飛書webhook機器人還不支持發(fā)送文件類型的群消息,可以申請創(chuàng)建一個機器人應(yīng)用來實現(xiàn)群發(fā)送文件消息。
在這里插入圖片描述

在這里插入圖片描述

創(chuàng)建機器人后,需要開通一系列權(quán)限,然后發(fā)布。由管理員審核通過后,才可使用。

包括如下的權(quán)限,可以獲取群的chat_id。
在這里插入圖片描述

開通權(quán)限發(fā)布應(yīng)用后,可以取到兩個重要的參數(shù):

app_id
app_secret

使用兩個參數(shù)可以生成密鑰tenant_access_token,

headers = {‘Authorization’: f’Bearer {get_token()}', ## 獲取tenant_access_token, 需要替換為實際的token

def get_token():# 獲取tenant_access_token,供上傳圖片接口使用url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"headers = {"Content-Type": "application/json; charset=utf-8",}payload_data = {"app_id": "cli_xxx","app_secret": "xxx",}response = requests.post(url=url, data=json.dumps(payload_data), headers=headers).json()print(response)token = response['tenant_access_token']return token```

上傳文件

def upload_file(file_path):try:file_name = file_path.split(',')[0]url = "https://open.feishu.cn/open-apis/im/v1/files"form = {'file_type': 'stream','file_name': file_name,'file': (file_name, open(file_path, 'rb'),'text/plain')}  # 需要替換具體的path  具體的格式參考  https://www.w3school.com.cn/media/media_mimeref.aspmulti_form = MultipartEncoder(form)headers = {'Authorization': f'Bearer {get_token()}',  ## 獲取tenant_access_token, 需要替換為實際的token}headers['Content-Type'] = multi_form.content_typer = requests.request("POST", url, headers=headers, data=multi_form)print(r.json())# print(response.headers['X-Tt-Logid'])  # for debug or oncall# print(response.content)  # Print Responseif r.json().get("code") == 0 and r.json().get("msg") == "success":logger.info(f"上傳文件到飛書成功,msg={r.json()},{file_path=}")media_id = r.json().get('data').get('file_key')return media_idelse:logger.warning(f"上傳文件到飛書異常,{r.json()=},{file_path=}")# Press the green button in the gutter to run the script.except Exception as e:# logger.warning("上傳文件到企業(yè)微信失敗")print("上傳文件到飛書失敗")print(e)# logger.warning(e)pass

發(fā)送文件到群

def send_file(file_path=None, media_id=""):"""機器人應(yīng)用上傳文件"""if not media_id:media_id = upload_file(file_path=file_path)time.sleep(1)url = 'https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id'msgContent = {"file_key": media_id}form = {"content": json.dumps(msgContent),"msg_type": "file","receive_id": "oc_xxx"}headers = {'Authorization': 'Bearer ' + get_token()}response = requests.post(url=url, data=json.dumps(form), headers=headers)print(response.json())

獲取群的chat_id

def get_qun_list():url = 'https://open.feishu.cn/open-apis/im/v1/chats'headers = {'Authorization': 'Bearer ' + get_token()}response = requests.get(url=url, headers=headers)print(response.json())return response.json()['data']['items']def get_ _by_name(qun_name):items = get_qun_list()for i in items:if i.get('name') == str(qun_name):print(i.get('chat_id'))return i.get('chat_id')

發(fā)送成功
在這里插入圖片描述

http://aloenet.com.cn/news/40403.html

相關(guān)文章:

  • 直銷購物網(wǎng)站開發(fā)搜狗搜索引擎優(yōu)化
  • 泰安建設(shè)企業(yè)網(wǎng)站華與華營銷策劃公司
  • 網(wǎng)站做商城網(wǎng)絡(luò)營銷策劃書結(jié)構(gòu)
  • 海南澄邁網(wǎng)站建設(shè)寧波免費建站seo排名
  • 營銷策劃方案4000字上海全國關(guān)鍵詞排名優(yōu)化
  • 網(wǎng)站首頁上的動畫是咋做的灰色詞排名接單
  • 上海 設(shè)計網(wǎng)站建設(shè)上海百度seo優(yōu)化
  • 個人站長怎么樣做網(wǎng)站才不會很累關(guān)鍵詞調(diào)詞平臺費用
  • 適合推廣的網(wǎng)站有哪些南昌網(wǎng)站優(yōu)化公司
  • 手機網(wǎng)站設(shè)計小程序色盲眼鏡
  • 網(wǎng)站全局搜索如何做如何設(shè)計與制作網(wǎng)頁
  • vue.js 做網(wǎng)站網(wǎng)站開發(fā)制作培訓(xùn)學(xué)校
  • 怎么設(shè)置網(wǎng)站亞馬遜站外推廣網(wǎng)站
  • 不用ftp做網(wǎng)站云seo關(guān)鍵詞排名優(yōu)化軟件
  • 建網(wǎng)站的公司不肯簽合同長沙網(wǎng)站制作費用
  • wordpress 技術(shù)教程seo 關(guān)鍵詞優(yōu)化
  • 做寫真網(wǎng)站的限度游戲優(yōu)化
  • 做別人的網(wǎng)站詐騙視頻下載廣州網(wǎng)站優(yōu)化排名系統(tǒng)
  • 學(xué)校網(wǎng)站建設(shè)的風(fēng)險分析微信管理系統(tǒng)登錄入口
  • 淄博網(wǎng)站制作形象培訓(xùn)網(wǎng)址
  • 建購物的網(wǎng)站需要多少錢八零云自助建站免費建站平臺
  • 購物網(wǎng)站成品淘寶推廣工具
  • 人人設(shè)計網(wǎng)官方網(wǎng)站cilimao磁力貓在線搜索
  • wap網(wǎng)站制作軟件個人免費推廣網(wǎng)站
  • 陜西網(wǎng)站制作電話網(wǎng)站代搭建維護(hù)
  • 用戶體驗比較好的網(wǎng)站太原關(guān)鍵詞優(yōu)化軟件
  • 網(wǎng)站設(shè)計介紹常用的搜索引擎
  • 江蘇專業(yè)做網(wǎng)站淘寶關(guān)鍵詞排名
  • 做網(wǎng)站界面一般用什么來做廣告公司取名字參考大全
  • wordpress廣告窗插件搜索引擎優(yōu)化怎么做的