3.4 KiB
End-to-end Local Phone Development
Relay uses inteliquent HTTP APIs for phone numbers, texts, and calls. So, a full local end-to-end phone setup works like this:
sequenceDiagram
555-555-5555->>inteliqent: SMS
inteliquent->>your-domain.loca.lt (127.0.0.1): POST /api/v1/inbound_sms_iq
your-domain.loca.lt (127.0.0.1)->>inteliqent: POST /msgbroker/rest/publishMessages
inteliqent->>999-999-9999: SMS
Requirements
- inteliquent access (ping @groovecoder)
localtunnel
Overview
To make your local Relay SEND messages you will:
- Add the inteliquent API key to your environment variables
To make your local Relay RECEIVE messages you will also:
- Use
localtunnel
to publish your local app at a public domain - Set up inbound message webhook in inteliquent (ping @groovecoder)
- Receive a test message
Send messages
Configure local to enable inteliquent
- Add
PHONES_ENABLED=True
- Add
IQ_ENABLED=True
- Add
IQ_OUTBOUND_API_KEY=
(ping @groovecoder for this) - Add
IQ_INBOUND_API_KEY=
(ping @groovecoder for this)
Send a test message (Pending)
Now you're ready to send a test message to make sure inteliquent is configured correctly. The first message in the Relay phone flow is the verification code:
- Use http://127.0.0.1:8000/admin/waffle/flag/ to give the
phones
waffle flag to a user - Sign in as that user at http://127.0.0.1:8000/
- Go to the staging "Relay Email & Phone Protection (127.0.0.1)" purchase page and buy a phone
subscription for the user. (Use a Stripe testing card like
4242424242424242
) - (PENDING) Go to http://127.0.0.1:8000/phone/ and verify your real phone: it will (soon) send an SMS via inteliquent
Receive messages
Use localtunnel
to publish your local app at a public domain
Relay receives webhook requests from inteliquent, so your local Relay app needs to
be accessible at a public domain. localutnnel
is a great tool to
make this easier.
- Follow the instructions on the
localtunnel
. - Add
your-subdomain.loca.lt
to your.env
DJANGO_ALLOWED_HOST
- Set your
.env
SITE_ORIGIN
toyour-subdomain.loca.lt
- Run
lt --port 8000 --subdomain your-subdomain
- Hit https://your-subdomain.loca.lt/api/v1/docs/ to check that it's working.
Set up a local Relay number to receive and forward messages
With localtunnel
and inteliquent set up, you're now ready to set up a local Relay
number to receive and forward messages to your real phone.
Until the UI flow is done, you'll need to use the admin UI to do this:
- Go to http://127.0.0.1:8000/admin/phones/realphone/add/
- Number: your real phone number
- Verified: checked
- Click "Save"
- Get an inteliquent number (tell @groovecoder your-subdomain.loca.lt)
- Go to http://127.0.0.1:8000/admin/phones/relaynumber/add/
- Number: inteliquent number
- Vendor: inteliquent
- Location: US
- Click "Save"
- Send a text message to your relay number.
- (Note) Replies are not working yet; will be handled in a future PR
- You should see the inteliquent webhook request in your local runserver and you should receive the text message to your real phone!