Skip to content

Make default messaging configurations consistent #3564

@cilliankieran

Description

@cilliankieran

Setting different messaging providers as default has inconsistent response

Problem

Fides provides the endpoint api/v1/messaging/default to set the default messaging provider.
Currently supported options are for service_type are: mailgun, twilio_email, twilio_sms which generates a configuration with a unique key.

For mailgun the request body looks like:

{
    "service_type": "mailgun",
    "details": {
        "domain": "{{MAILGUN_DOMAIN}}"
    }
}

and the response is

{
    "service_type": "mailgun",
    "details": {
        "is_eu_domain": false,
        "api_version": "v3",
        "domain": "{{MAILGUN_DOMAIN}}"
    },
    "name": "string",
    "key": "TNSm_8GTfvMqHPr4K6je4ei"
}

however, when you do this for Twilio the response looks like:

{
    "service_type": "twilio_email",
    "details": {
        "twilio_email_from": "joe@joe.com"
    },
    "name": "Default Messaging Config [twilio_email]",
    "key": "default_messaging_config_twilio_email"
}

Note in these two examples, for Mailgun, name is a blank string and key is a random string where in Twilio, name is a fixed string and key is a fixed string.
In addition to this this, name cannot be passed to set this as part of the configuration.

Solution

For each service_type of mailgun, twilio_email and twilio_sms (or any other future service configuration), these values should be consistent:

  • key should be a unique identifier in a consistent format for all services, something like: {service_type}_randomstring, for example: mailgun_TNSm_8GTfvMqHPr4K6je4ei
  • name should be an optional accepted request parameter to set the name of the service and if it is not passed, set the name to a default similar to the key value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions