<@U04UQ68083H>, How to get registration code sent ...
# ory-copilot
c
@chilly-king-10285, How to get registration code sent to sms when register new identity on Kratos?
b
A message from kapa.ai
To get a registration code sent to SMS when registering a new identity on Kratos, you need to follow these steps: 1. Enable SMS one-time-code (OTP) by patching the identity configuration. You can use the Ory CLI command as shown below:
Copy code
bash ory patch identity-config --project ${project_id} --add '/courier/channels=[{"id":"sms","request_config":{"method":"PUT","body":"<base64://ZnVuY3Rpb24oY3R4KSB7DQpjdHg6IGN0eCwNCn0>=","url":"<https://webhook.site/#!/view/859c1c2c-c4d5-4058-aec4-53f37929c5c1>"}}]'
[Source](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp) 2. Customize your identity schema to specify that the field is used as the "ID" when using passwordless one-time code login via SMS:
Copy code
json {     "<http://ory.sh/kratos|ory.sh/kratos>": {       "credentials": {         "code": {           "identifier": true,           "via": "sms",         }       }     }   }
[Source](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier) 3. Configure the SMS template for the
registration_code
in your Ory Identities configuration:
Copy code
yaml courier:     templates:       registration_code:         valid:           sms:             body:               plaintext: "<base64://WW91ciByZWdpc3RyYXRpb24gY29kZSBpczoge3sgLlJlZ2lzdHJhdGlvbkNvZGUgfX0>="
[Source](https://www.ory.sh/docs/kratos/emails-sms/sending-sms#templates) 4. Update the Ory Identities configuration using the file you worked with:
Copy code
bash ory update identity-config --project <project-id> --workspace <workspace-id> --file updated_config.yaml
[Source](https://www.ory.sh/docs/kratos/emails-sms/sending-sms#templates) 5. After the UI shows you that a code has been sent, check out the webhook target which will now show in response to the SMS being sent. [Source](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp) Please note that the base64 strings in the examples are placeholders and should be replaced with your actual content.