You are not logged in.
Hi,
I have a Slack bot that opens a ticket based on the user input, I added a button to upload a document to a specific folder in Google Drive, and I want to attach that file to the ticket, how do I go about doing this? (the code already have access to that specific folder and have authorization. that folder always holds one file, the one that's uploaded by the user which opened this specific ticket)
Here is my ticket opening code:
email = app.client.users_info(user=body['user']['id'])['user']['profile']['email']
slack_user_id = body['user']['id']
glpi_user_id = glpi_user_id_by_email(email)
# Extract submitted data from the dialog submission
glpi_url = "https://qitt-help.qwilt.com/apirest.php/Ticket"
glpi_ticket_priority = body['view']['state']['values']['priority']['static_select-action']['selected_option']['value']
glpi_ticket_type = body['view']['state']['values']['tickettype']['type_static_select-action']['selected_option']['value']
glpi_ticket_subject = body['view']['state']['values']['subject']['subject_input']['value']
glpi_ticket_description = body['view']['state']['values']['description']['description_input']['value']
headers = {
"Content-type": "application/json",
"App-Token": API_KEY,
"Session-Token": get_token(),
}
data = {
"input": {
"name": glpi_ticket_subject,
"content": f"{glpi_ticket_description}"
f'<br>'
f'<br>'
f'<p style="color:#636363; font-size:14px; background-color:lightgray;">Ticket was opened by {email}</p>',
"priority": glpi_ticket_priority,
"impact": "4",
"urgency": "3",
"type": glpi_ticket_type,
"_users_id_requester": glpi_user_id,
"_users_id_recipient": glpi_user_id,
}
}
response = requests.post(glpi_url, headers=headers, json=data)
print_with_timestamp(f"GLPI request Success: {response.text}")
ticket_id = response.json()['id']
print_with_timestamp(ticket_id)
Offline