Osada Vidath - @osadavc - Osada#9999
Medu caller is a simple way to allow people to order from a Medusa store via a call. It uses the Medusa API to interact with the Medusa instance and the Twilio API to make the calls. With this people can call the number, choose the item that they want to buy, enter their card details via twilio, stripe integration and place the order. Although this can support stores with a large number of products it is recommended and meant to be used in stores with small number of products (branded single product stores, merchandise stores)
Here is a preview of the the call function in action. I am using textnow here to call the twilio number toll-free but you could use your mobile phone to call. (watch with sound, also ignore the trial account message by twilio. That will go away when twilio account is upgraded)
medu-caller-demo.mp4
Here is the basic flow of calls, watch the above recording to understand it more clearly.
flowchart TD;
A["Calls The Store"] -->B{"Call Store Associate or Order"};
B --> |Store Associate| C[Connected to Store Associate];
B --> |Order| D{Is Shipping Given};
D --> |Yes| E["Proceed With the order \n (ask to choose the products, ask to enter the payment details)"]
D --> |No| F["Send a text message to user \n asking for address and email address"]
F --> G["Details given"]
G --> E
- Medusa store up and running (Quick Start) Store should have a database running other than SQLite
- Stripe account (Sign Up)
- Twilio Account (Sign up)
-
Setup a Medusa Store (Quick Start)
-
Create a twilio account and activate the trial. You will need to get the phone number, account SID and auth token from the dashboard.
-
Connect twilio with stripe to get the payments. (Instructions)
-
Setup a SQL Database outside of the Medusa database to store caller information. (Postgres preferred)
-
Create a medusa admin API key. (Documentation)
-
Clone the repository
git clone https://github.com/osadavc/medu-caller.git
- Change directory and install dependencies:
cd medu-caller
npm install
- Replace values in
.env.local
andsrc/config.ts
files with the real values.
-
DATABASE_URL
is the database where information about the callers and temporary information will be stored. This must be a different database than Medusa database -
CALLER_URL
in theconfig.ts
file should be the place where this project is running. This must be a SSL URL. (you can use ngrok for testing purposes) -
CUSTOMER_SERVICE_NUMBER
in theconfig.ts
is the number that the caller would be connected if they asked for customer support
- Start the server (You might want to host in a server or start a ngrok tunnel.)
npm run dev
To extend this even more, you can read the twilio documentation and the Medusa documentation.