diff --git a/daras_ai_v2/bot_integration_widgets.py b/daras_ai_v2/bot_integration_widgets.py index ac1826494..c7174780e 100644 --- a/daras_ai_v2/bot_integration_widgets.py +++ b/daras_ai_v2/bot_integration_widgets.py @@ -305,8 +305,8 @@ def get_bot_test_link(bi: BotIntegration) -> str | None: integration_name=slugify(bi.name) or "untitled", ), ) - elif bi.twilio_phone_number_sid: - return f"https://console.twilio.com/us1/develop/phone-numbers/manage/incoming/{bi.twilio_phone_number_sid}/calls" + elif bi.twilio_phone_number: + return str(furl("tel:") / bi.twilio_phone_number.as_e164) else: return None diff --git a/payments/plans.py b/payments/plans.py index badfd2c1c..11908b8f8 100644 --- a/payments/plans.py +++ b/payments/plans.py @@ -6,6 +6,7 @@ from typing import Any import stripe +from furl import furl from daras_ai_v2 import paypal, settings from .utils import make_stripe_recurring_plan, make_paypal_recurring_plan @@ -192,7 +193,7 @@ class PricingPlan(PricingPlanData, Enum): """ ), - contact_us_link=f"mailto:{settings.SALES_EMAIL}", + contact_us_link=str(furl("mailto:") / settings.SALES_EMAIL), title_override="Let's talk", caption_override="", ) diff --git a/recipes/VideoBots.py b/recipes/VideoBots.py index c084aa616..e2c97feb4 100644 --- a/recipes/VideoBots.py +++ b/recipes/VideoBots.py @@ -1246,25 +1246,33 @@ def render_integrations_settings( st.write("###### Connected To") st.write(f"{icon} {bi}", unsafe_allow_html=True) with col2: - if test_link: + if not test_link: + st.write("Message quicklink not available.") + elif bi.platform == Platform.TWILIO: + copy_to_clipboard_button( + ' Copy Phone Number', + value=bi.twilio_phone_number.as_e164, + type="secondary", + ) + else: copy_to_clipboard_button( f' Copy {Platform(bi.platform).label} Link', value=test_link, type="secondary", ) - else: - st.write("Message quicklink not available.") + if bi.platform == Platform.FACEBOOK: st.anchor( ' Open Inbox', - f"https://www.facebook.com/latest/inbox", + "https://www.facebook.com/latest/inbox", unsafe_allow_html=True, new_tab=True, ) - if bi.twilio_phone_number: + elif bi.platform == Platform.WEB: + embed_code = get_web_widget_embed_code(bi) copy_to_clipboard_button( - f' Copy Phone Number', - value=bi.twilio_phone_number.as_e164, + f"{icons.code} Copy Embed Code", + value=embed_code, type="secondary", ) @@ -1273,7 +1281,9 @@ def render_integrations_settings( st.write("###### Test") st.caption(f"Send a test message via {Platform(bi.platform).label}.") with col2: - if bi.platform == Platform.FACEBOOK and test_link: + if not test_link: + st.write("Message quicklink not available.") + elif bi.platform == Platform.FACEBOOK: st.anchor( f"{icon} Open Profile", test_link, @@ -1281,48 +1291,31 @@ def render_integrations_settings( new_tab=True, ) st.anchor( - ' Open Messenger', - f"https://www.messenger.com/t/{bi.fb_page_id}", + f' Open Messenger', + str(furl("https://www.messenger.com/t/") / bi.fb_page_id), unsafe_allow_html=True, new_tab=True, ) - elif bi.platform == Platform.TWILIO and test_link: - pass - elif test_link: + elif bi.platform == Platform.TWILIO: st.anchor( - f"{icon} Message {bi.get_display_name()}", + ' Start Voice Call', test_link, unsafe_allow_html=True, new_tab=True, ) - else: - st.write("Message quicklink not available.") - - if bi.twilio_phone_number: st.anchor( - ' Start Voice Call', - f"tel:{bi.twilio_phone_number.as_e164}", + ' Send SMS', + str(furl("sms:") / bi.twilio_phone_number.as_e164), unsafe_allow_html=True, new_tab=True, ) + else: st.anchor( - ' Send SMS', - f"sms:{bi.twilio_phone_number.as_e164}", + f"{icon} Message {bi.get_display_name()}", + test_link, unsafe_allow_html=True, new_tab=True, ) - elif bi.platform == Platform.TWILIO: - st.write( - "Phone number incorrectly configured. Please re-add the integration and double check spelling. [Contact Us](support@gooey.ai) if you need help." - ) - - if bi.platform == Platform.WEB: - embed_code = get_web_widget_embed_code(bi) - copy_to_clipboard_button( - f"{icons.code} Copy Embed Code", - value=embed_code, - type="secondary", - ) col1, col2 = st.columns(2, style={"alignItems": "center"}) with col1: @@ -1344,10 +1337,16 @@ def render_integrations_settings( ), new_tab=True, ) - if bi.platform == Platform.TWILIO and test_link: + if bi.platform == Platform.TWILIO and bi.twilio_phone_number_sid: st.anchor( - f"{icon} View Calls/Messages", - test_link, + f"{icon} Open Twilio Console", + str( + furl( + "https://console.twilio.com/us1/develop/phone-numbers/manage/incoming/" + ) + / bi.twilio_phone_number_sid + / "calls" + ), unsafe_allow_html=True, new_tab=True, ) @@ -1362,12 +1361,22 @@ def render_integrations_settings( with col2: st.anchor( "Business Settings", - f"https://business.facebook.com/settings/whatsapp-business-accounts/{bi.wa_business_waba_id}", + str( + furl( + "https://business.facebook.com/settings/whatsapp-business-accounts/" + ) + / bi.wa_business_waba_id + ), new_tab=True, ) st.anchor( "WhatsApp Manager", - f"https://business.facebook.com/wa/manage/home/?waba_id={bi.wa_business_waba_id}", + str( + furl( + "https://business.facebook.com/wa/manage/home/", + query_params=dict(waba_id=bi.wa_business_waba_id), + ) + ), new_tab=True, )