This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from urllib.parse import urlencode | |
import gspread | |
from oauth2client.service_account import ServiceAccountCredentials | |
# Define your API credentials | |
client_id = "YOUR_CLIENT_ID" | |
client_secret = "YOUR_CLIENT_SECRET" | |
redirect_uri = "YOUR_REDIRECT_URI" # You set this when registering your app | |
access_token = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _send_message(bot, message_to_send): | |
attachments = _format_attachments(bot, message_to_send) | |
print(attachments) | |
response = requests.post( | |
f"{GROUPME_URL}/bots/post", | |
params={"token": GROUPME_TOKEN}, | |
data = { | |
"bot_id": bot.get("bot_id"), | |
"text": message_to_send, | |
"attachments": attachments |