Skip to content

dataflows-au/auth0-sms-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

DataFlows SMS Provider for Auth0

Send MFA and passwordless OTP messages via DataFlows SMS instead of Twilio. Perfect for Australian businesses looking for competitive SMS pricing.

Features

  • SMS Multi-Factor Authentication (MFA)
  • Passwordless SMS login
  • Customizable message templates
  • Support for Australian and international numbers

Prerequisites

  1. A DataFlows account
  2. An Auth0 account

Quick Setup

1. Get Your DataFlows Credentials

  1. Log in to your DataFlows dashboard
  2. Navigate to Developer > Settings
  3. Copy your API Token
  4. Note your Sender ID (alphanumeric name or virtual number)

2. Create the Auth0 Action

  1. Log in to your Auth0 Dashboard
  2. Go to Actions > Flows
  3. Click Send Phone Message
  4. Click + (Add Action) > Build Custom
  5. Name it: DataFlows SMS Provider
  6. Set Trigger: Send Phone Message
  7. Set Runtime: Node 18
  8. Click Create

3. Add the Action Code

Copy the contents of dataflows-sms-action.js into the Auth0 Action editor.

4. Configure Secrets

In the Auth0 Action editor, click Secrets (key icon) and add:

Secret Name Value
DATAFLOWS_API_KEY Your DataFlows API token
DATAFLOWS_SENDER_ID Your Sender ID (e.g., DataFlows or 61412345678)
MESSAGE_TEMPLATE (Optional) Custom message, e.g., Your MyApp code is: {{code}}

5. Deploy the Action

  1. Click Deploy in the Action editor
  2. Go back to Actions > Flows > Send Phone Message
  3. Drag your DataFlows SMS Provider action into the flow
  4. Click Apply

6. Enable Phone MFA

  1. Go to Security > Multi-factor Auth
  2. Click Phone Message
  3. Enable it and select Custom as the delivery provider
  4. Choose SMS as the delivery method
  5. Save your changes

Testing

Test via Auth0 Dashboard

  1. Go to User Management > Users
  2. Select a test user
  3. Click Send Verification SMS (if available)

Test via Application

import { WebAuth } from 'auth0-js';

const auth0 = new WebAuth({
  domain: 'YOUR_DOMAIN.auth0.com',
  clientID: 'YOUR_CLIENT_ID'
});

// Start passwordless login
auth0.passwordlessStart({
  connection: 'sms',
  send: 'code',
  phoneNumber: '+61412345678'
}, (err, res) => {
  if (err) console.error(err);
  console.log('OTP sent!');
});

Custom Message Templates

Use {{code}} as the placeholder for the verification code:

Your MyApp verification code is: {{code}}
{{code}} is your login code. It expires in 5 minutes.

Troubleshooting

OTP not received

  1. Check Auth0 Logs: Monitoring > Logs
  2. Look for SendPhoneMessage events
  3. Verify your DataFlows API key is correct
  4. Ensure phone number includes country code (e.g., +61412345678)
  5. Check your DataFlows SMS credit balance

Action errors

  1. In the Action editor, check the Test tab
  2. Run a test with sample data:
{
  "message_options": {
    "recipient": "+61412345678",
    "text": "123456"
  },
  "secrets": {
    "DATAFLOWS_API_KEY": "your_api_key",
    "DATAFLOWS_SENDER_ID": "DataFlows"
  }
}

Support

License

MIT License - Feel free to use and modify for your projects.

About

Send MFA/OTP messages via DataFlows SMS API for Auth0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors