mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-04 08:10:00 -04:00
Add boilerplate for sending SMS via Reach
This works in conjunction with the new SMS provider stub [^1].
Local testing:
- Run the migrations to add Reach as an inactive provider.
- Activate the Reach provider locally and deactivate the others.
update provider_details set priority = 100, active = false where notification_type = 'sms';
update provider_details set active = true where identifier = 'reach';
- Tweak your local environment to point at the SMS stub.
export REACH_URL="http://host.docker.internal:6300/reach"
- Start / restart Celery to pick up the config change.
- Send a SMS via the Admin app and see the stub log it.
- Reset your environment so you can send normal SMS.
update provider_details set active = true where notification_type = 'sms';
update provider_details set active = false where identifier = 'reach';
[^1]: https://github.com/alphagov/notifications-sms-provider-stub/pull/10
This commit is contained in:
54
migrations/versions/0367_add_reach.py
Normal file
54
migrations/versions/0367_add_reach.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0367_add_reach
|
||||
Revises: 0366_letter_rates_2022
|
||||
Create Date: 2022-03-24 16:00:00
|
||||
|
||||
"""
|
||||
import itertools
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy.sql import text
|
||||
|
||||
from app.models import LetterRate
|
||||
|
||||
|
||||
revision = '0367_add_reach'
|
||||
down_revision = '0366_letter_rates_2022'
|
||||
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
conn.execute(
|
||||
"""
|
||||
INSERT INTO provider_details (
|
||||
id,
|
||||
display_name,
|
||||
identifier,
|
||||
priority,
|
||||
notification_type,
|
||||
active,
|
||||
version,
|
||||
created_by_id
|
||||
)
|
||||
VALUES (
|
||||
'{}',
|
||||
'Reach',
|
||||
'reach',
|
||||
0,
|
||||
'sms',
|
||||
false,
|
||||
1,
|
||||
null
|
||||
)
|
||||
""".format(
|
||||
str(uuid.uuid4()),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
conn = op.get_bind()
|
||||
conn.execute("DELETE FROM provider_details WHERE identifier = 'reach'")
|
||||
Reference in New Issue
Block a user