Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information about Contributing Regional SMS Provider (via Send SMS HTTP Hook) #1582

Open
J0 opened this issue May 14, 2024 · 0 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@J0
Copy link
Contributor

J0 commented May 14, 2024

Regional SMS Senders

We're accepting contributions for regional SMS providers via the Send SMS Hook.

Contributors for select SMS providers (e.g. msg91 (@MeetChaudhari) and Africa's Talking (@mutumbakato) ) can add the following lines to your config.toml on the latest version of the CLI to enable the hook locally. If you are interested in contributing a regional provider for a hook which is not msg91 or Africa's Talking please make a comment with the provider name below.

Note that this feature is only available for use with the CLI locally - it will be available on Supabase projects once we merge the frontend

[auth.hook.send_sms]
enabled = true
uri = "http://host.docker.internal:54321/functions/v1/sms_sender"
secret = "env(SEND_SMS_HOOK_SECRET)"

This configuration assumes we're using a Supabase Edge Function which is called sms_sender though in practice you can use any HTTP endpoint of your choosing. With respect to the secret, it should take the form v1,whsec_<standard-base64-string>. You can use a generic base64 encoding tool to help generate the base64 string.

You can view the wip docs and example README for details about HTTP Hooks. You can use the JSON Schema Faker Tool in tandem with the Send SMS JSON Schema provided in order to generate a fake payload to test the function with.

Let us know if there's anything unclear or if there are any further questions or concerns. Thanks!

Details About Contributing

Contributing Format

We may feature some of the functions on our Edge Function Guides - if you wish for your regional sender to be considered, please paste a link to a Github repository containing a README.md, an .env.local file, and an index.ts file containing the function content. We will then check with the appropriate team to see whether it would fit into the guides.

Here's the README outline:

Your-edge-function-name

  • What does this edge function do?
  • When would I want to use it?

Example:

Use this Hook with the Send SMS Extension Point to send a message with an AppHash via Twilio Programmable Messaging. The App Hash identifies a mobile application and is embedded it an SMS to allow an Android application to determine that the message was intended for the Application. In turn, this allows for the App to fetch specific information, such as OTP codes, to perform autofill so that the user does not have to exit the application to retrieve information from a message.

Configuration

  • What env vars do I need to add to .env.local?
  • Where do I find these env vars?

Example:

Copy the following environment variables from the Twilio Console into your .env.local file:

TWILIO_ACCOUNT_SID=""
TWILIO_AUTH_TOKEN=""
TWILIO_PHONE_NUMBER=""

Testing

  • Include an example cURL function with which we can test the edge function

Any other points of note?

  • As needed.
@J0 J0 added the documentation Improvements or additions to documentation label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant