<@U04UQ68083H> I configured one sms provider using...
# ory-copilot
a
@chilly-king-10285 I configured one sms provider using the webhook.site option but when I submit a login the url never gets hit, why?
b
A message from kapa.ai
There could be several reasons why your webhook isn't being triggered when you submit a login. Based on the knowledge sources, here are the most likely causes: ### 1. Session Hook Order Issue The most common reason webhooks fail to trigger is related to the order of hooks. If you have the "session" hook (which enables "Sign in after registration") configured before your webhook, it will prevent your webhook from executing. The session hook modifies the HTTP response, and no other hooks are executed after it. To fix this: - Make sure your webhook is configured to run before the session hook - Check your configuration to ensure proper hook ordering [Troubleshoot Ory Actions Webhook issues](https://www.ory.sh/docs/troubleshooting/troubleshoot-actions) explains this issue in detail. ### 2. Flow Method Configuration Your webhook might be configured for a specific authentication method (password, OIDC, etc.) but not for the method you're using. If you selected "All" methods instead of specific ones, this could cause issues. As one user reported in a GitHub issue, configuring webhooks for specific methods (like "Password" or "OIDC") individually worked, while selecting "All" did not. ### 3. API vs Browser Flow If you're using the native API flow (
/self-service/registration/api
) instead of the browser flow (
/self-service/registration/browser
), webhooks might not trigger as expected. ### 4. SMS Configuration Issues For SMS specifically, ensure you've properly configured: - The SMS channel in your courier configuration - The correct URL and method for your webhook.site endpoint - The proper body template for the SMS message [Sending SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) provides detailed configuration instructions. ### Troubleshooting Steps 1. Export your configuration using the Ory CLI to check the hook order 2. Verify that your webhook is configured for the correct authentication method 3. Check if your SMS provider configuration is correct 4. Consider the security implications of using SMS (it's considered less secure than other methods) If you need more specific help, you might want to share your configuration (with sensitive information redacted) for a more targeted diagnosis.
b
A message from kapa.ai
I see your SMS channel configuration. There are a few issues with your current setup that might explain why your webhook isn't being triggered: 1. HTTP Method: You're using
PUT
instead of the more commonly used
POST
method for SMS providers. Most SMS services (like Twilio) expect a
POST
request. 2. Missing Authentication: Your configuration doesn't include any authentication parameters. Most SMS services require authentication, and even for webhook.site testing, it's a good practice to include it. 3. Content-Type Header: There's no Content-Type header specified. By default, it will use
application/json
, but depending on your SMS provider, you might need
application/x-www-form-urlencoded
. Here's an improved configuration example:
Copy code
yaml courier:   channels:   - id: sms     type: http     request_config:       url: <https://webhook.site/0757f9a2-106a-4938-bb50-9e8ec65177d3>       method: POST       body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgVG86IGN0eC5yZWNpcGllbnQsCiAgQm9keTogY3R4LmJvZHksCn0>=       headers:         Content-Type: application/json
The base64 encoded body above decodes to a simple Jsonnet template:
Copy code
function(ctx) {   To: ctx.recipient,   Body: ctx.body, }
Additionally, make sure: 1. You've configured the SMS templates correctly for verification_code and/or login_code 2. Your identity schema has a phone trait marked for verification via SMS 3. You're actually triggering a flow that would send an SMS (like verification or passwordless login) For more detailed configuration guidance, check the [Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) documentation. If you're still having issues, I'd recommend checking the Ory logs for any error messages related to the SMS delivery.