Skip to main content

How to connect openai to zapier to twilio so that you can interface with GPT3 via SMS

 I created an SMS interface to openAI's gpt3 API so that I can send an SMS prompt to openai and get an SMS response. Result looks like this:


There may be better/easier ways of doing this, but this is how I figured it out. I'm assuming some degree of familiarity w/ Zapier here:

1. Buy a phone number in Twilio to use for this. This only costs $1/mo

2. In Zapier, create a new zap where the trigger is "Webhooks by Zapier" (Premium option). Choose your event as "Catch Hook". This will generate a webhook URL that is custom for this workflow. We are doing this because when you send the SMS to the Twilio phone number, you want it to **instantly** trigger the zapier workflow and not wait the 5-15 min it takes for Twilio to trigger on its own, so for that you need the webhook:


3. Copy the webhook URL from zapier and paste it into Twilio in the "A Messages Comes In" webhook section for that phone number

4. You will then need to send a test message so that Zapier can learn what information will come from the webhook from Twilio. 
5. Afterwords, I process the phone number of the sender and add it to a google sheet I use to keep track of which of my friends and family are using my tool. I'll skip the details on these, as these are pretty basic in Zapier. Here's a high level view of the overall workflow:

6. Next I send the OpenAI prompt by extracting the prompt from the webhook and using the OpenAI zapier integration (you will need access to the OpenAI API, which is easy to set up). 
7. One thing I decided to do is to measure the OpenAI response length. If the length is very long (> 1600 characters I believe), the message will not send through Twilio. So, if the message is too long (I use the Zapier Paths function to diverge the algorithm), I send the openAI response to my dropbox account where I take the text and convert it into a text file in Dropbox. Creating that sort of file in dropbox automatically creates a share link where anybody can access the file without login. I take that share link and send the link via Twilio, instead of the overly-long text. 



7. Then I log everything in Google sheet








Comments

Popular posts from this blog

Dr. Alex Mohseni invited to speak at Brault’s Healthcare Leadership Forum about the future of Emergency Medicine services and how ED groups can adapt using telemedicine.

  Dr. Mohseni presented on the topic of how Emergency Medicine groups could expand their scope of practice to the virtual space to and how to do so in a financially viable way.

From Stethoscope to Strategy: Why I Built ClinX Academy for Physicians Ready to Lead

“I love medicine—but I don’t love the hamster wheel.” That sentence kept echoing in my head during 3 a.m. shifts and budget meetings alike. If you’re a physician feeling the same tug between clinical passion and systemic frustration, this post is for you. The Problem: Brilliant Clinicians, Limited Business Training Physicians command >80 % of U.S. healthcare spend yet hold <5 % of C-suite seats. Traditional MBAs cost $150K+, 2 years, and countless missed family dinners. Weekend “crash courses” often lack depth, CME credit, or a meaningful network. Burnout rates hover around 50 % —and much of it stems from feeling powerless in operational decisions. Keywords: physician leadership gap, physician executive training, clinician burnout, healthcare MBA alternative, non-clinical career paths My A-Ha Moment in the Hospital Corridor I was serving as a National Medical Director when a perfectly capable colleague admitted, “I have no idea how capitation works—I just sign ...