Drop files here
or click to upload
import streamlit as st
import requests
import json
# Streamlit app title
st.title("CRM Chatbot")
# Input field for user's question
user_question = st.text_input("Ask a question about CRM opportunities:")
# API endpoint and headers
api_url = "https://emea.snaplogic.com/api/1/rest/slsched/feed/ConnectFasterInc/snapLogic4snapLogic/Bootcamp_EMEA_August_2025/CRM_Retriever_August_TIRU_Task"
headers = {
"Authorization": "Bearer 1234",
"Content-Type": "application/json"
}
# Submit button
if st.button("Submit"):
if user_question:
# Prepare the payload
payload = [{"Question": user_question}]
# Send POST request to the API
response = requests.post(api_url, headers=headers, data=json.dumps(payload))
# Display the response
if response.status_code == 200:
response_data = response.json()
st.markdown("### Response:")
st.write(response_data[0]["Response"])
else:
st.error(f"Failed to retrieve response. Status code: {response.status_code}")
else:
st.warning("Please enter a question before submitting.")
streamlit run crm_chatbot.py
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?