- Node.js 22.X
- A Callr account
- A Callr API key
Please create an .env
file with the following content:
CALLR_API_KEY=your-callr-api-key
You may create API keys from https://app.callr.com/api/keys.
Then run:
npm install
npm run build
npm run ping
It should output something like this:
$ npm run build && npm run ping
> [email protected] build
> tsc
> [email protected] ping
> node dist/ping.js
PING OK, timestamp: 1735562976
This will list your first 50 numbers, with their assigned scenarios:
npm run list-numbers
npm run list-scenarios
npm run delete-scenario [scenario-id]
npm run remove-number [number-id]
This will create a new Actions scenario that forwards calls to a target phone number,
specified as a command line argument. The "template" scenario is available in
src/scenarios/forwarding-record.yaml
.
# npm run create-scenario-target [phone-target]
npm run create-scenario-target +1234567890
This will output the scenario ID:
> [email protected] build
> rm -fr dist/* && tsc
> [email protected] create-scenario-target
> node dist/create-scenario-target.js +1234567890
┌─────────┬────────────┬──────────────────────────────────┬───────────────────────┐
│ (index) │ id │ name │ created │
├─────────┼────────────┼──────────────────────────────────┼───────────────────────┤
│ 0 │ '3TXTPS65' │ 'Call Forwarding to +1234567890' │ '2024-12-30 15:24:22' │
└─────────┴────────────┴──────────────────────────────────┴───────────────────────┘
Take note of the scenario ID, it will be required later.
npm run buy-number [area-code-id]
You may use the API method did/areacode.get_list
to get the area code IDs.
This will buy a French +331 phone number:
npm run buy-number 1
> [email protected] build
> rm -fr dist/* && tsc
> [email protected] buy-number
> node dist/buy-number.js 1
┌─────────┬────────────────────────────────────────────┬────────────┬────────────────┐
│ (index) │ token │ id │ number │
├─────────┼────────────────────────────────────────────┼────────────┼────────────────┤
│ 0 │ '1DRXUfFGXfHiriY0hWBmsq6QKMk8mwmahNQOyYqM' │ 'LXLGRVDT' │ '+33186611221' │
└─────────┴────────────────────────────────────────────┴────────────┴────────────────┘
You may now run attach-number-to-scenario.js
# npm run attach-number-to-scenario [number-id] [scenario-id]
npm run attach-number-to-scenario LXLGRVDT 3TXTPS65
^^^^^^^^ ^^^^^^^^
number scenario
Now, you may call the new number, and it will forward the call to the target phone number. You can access the Actions logs from the Callr dashboard: https://app.callr.com/logs/actions.