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

Oye contact sms preferences sync #647

Open
DeeTheDev opened this issue May 24, 2024 · 0 comments · May be fixed by #660
Open

Oye contact sms preferences sync #647

DeeTheDev opened this issue May 24, 2024 · 0 comments · May be fixed by #660
Labels
backend Involves changes to the backend API webapp Public frontend changes

Comments

@DeeTheDev
Copy link
Collaborator

DeeTheDev commented May 24, 2024

Oye has created an API requests that provides contact information and update their SMS subscription preferences. The
requests require an authorization bearer token to access the contacts (secret provided by the Oye team).

GET https://app.oyetext.org/api/v1/contacts
Response example:

{
    "id": 1,
    "number": "+15555555551",
    "first_name": "Barbra",
    "last_name": "Jean",
    "created_at": "2023-09-29T18:30:36.119-04:00",
    "updated_at": "2024-04-01T10:16:41.867-04:00",
    "organization_id": 1,
    "status": "active",
    "state": null,
    "aasm_state": null,
    "state_metadata": null,
    "language": "English",
    "eid": ""
}

PUT request https://app.oyetext.org/api/v1/contacts/bulk_update
Request body example:

{ "contacts": [{"id": "1", "status": "active" }]}

Response example:

{ updated_contacts: [
    {
        "id": 1,
        "status": "active"
    },
]}

We need an async method that periodically syncs Oye contact sms preferences with the suma member sms preferences. It will find members through their phone number and then sync their sms preferences status. We sync preferences this direction because members main way to opt out is through sending an Oye sms message "STOP" to any marketing message.

Going the other direction, when a suma member updates their marketing preferences on the app, a PATCH request will be sent to the Oye API to sync the contact status.

This keeps sms preferences in sync between suma members and their matching Oye contact.

Changes required:

  • Create async method to sync every x amount of time
    • use both oye fetch/update api endpoints to sync contact sms preferences between both apps/orgs
    • Create stub requests to test above endpoints
    • Update member sms preferences
    • review, and try to improve/refactor when at a good stopping point
  • Update preferences page to allow marketing SubscriptionGroup to editable_state: "on"
  • Production: update existing member sms marketing SubscriptionGroup to editable_state: "on"
@DeeTheDev DeeTheDev added backend Involves changes to the backend API webapp Public frontend changes labels May 24, 2024
@DeeTheDev DeeTheDev added this to the 2024 Sprint 6 milestone May 24, 2024
@DeeTheDev DeeTheDev linked a pull request Jun 13, 2024 that will close this issue
@DeeTheDev DeeTheDev assigned DeeTheDev and unassigned DeeTheDev Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Involves changes to the backend API webapp Public frontend changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants