This repository shows how to accept incoming requests from Twilio and tokenize sensitive data (card number) from user input using Basis Theory Proxy.
- TwiML will make a request via Webhook:
curl "https://api.basistheory.com/proxy?bt-proxy-key={{inbound_proxy_key}}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-X "POST" \
-d 'AccountSid=....&Digits=4242424242424242&...'
- Basis Theory Proxy will tokenize the card number and call the destination URL:
curl "https://echo.basistheory.com/anything" \
-H "Content-Type: application/x-www-form-urlencoded" \
-X "POST" \
-d 'AccountSid=....&Digits=26818785-547b-4b28-b0fa-531377e99f4e&...'
- Basis Theory Proxy will return the destination URL response to Twilio.
Create a new Management Application with full application
and proxy
permissions.
Paste the API key to a new secret.tfvars
file at this repository root:
management_api_key = "key_W8wA8CmcbwXxJsomxeWHVy"
Initialize Terraform:
terraform init
And run Terraform to provision all the required resources:
terraform apply -var-file=secret.tfvars
Use the inbound_proxy_key
Terraform output to generate the TwiML Webhook URL: https://api.basistheory.com/proxy?bt-proxy-key={{inbound_proxy_key}}
.