From 083f7a1c08d65c3c14ff0875e1daa376ca4e99e6 Mon Sep 17 00:00:00 2001 From: Caio Teixeira Date: Thu, 22 Feb 2024 15:01:05 -0300 Subject: [PATCH] SDP: add how to update the SMS messages template (#244) * feat: add how to update the SMS messages template * feat: add SMS templates on the endpoint response * chore: improve example * chore: improve description and example --- .../resources/get-organization-info.api.mdx | 4 ++-- .../resources/update-organization-profile.api.mdx | 4 ++-- openapi/stellar-disbursement-platform/bundled.yml | 10 +++++++++- openapi/stellar-disbursement-platform/main.yml | 12 +++++++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/api/stellar-disbursement-platform/resources/get-organization-info.api.mdx b/api/stellar-disbursement-platform/resources/get-organization-info.api.mdx index fcbc24c13..4839ebe81 100644 --- a/api/stellar-disbursement-platform/resources/get-organization-info.api.mdx +++ b/api/stellar-disbursement-platform/resources/get-organization-info.api.mdx @@ -5,7 +5,7 @@ description: "This endpoint returns the organization's info. It is used in many sidebar_label: "Get Organization Info" hide_title: true hide_table_of_contents: true -api: {"responses":{"200":{"description":"Returns organization details","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"Stellar Aid"},"logo_url":{"type":"string","example":"https://stellar-disbursement-platform-backend-dev.stellar.org/organization/logo"},"distribution_account_public_key":{"type":"string","example":"GCXAJ3XJ3VK3JFH3QMDFOSKM2NMMZBSO3VIT6EUPQWSDW2J74M23RRSL"},"timezone_utc_offset":{"type":"string","example":"+00:00"},"is_approval_required":{"description":"Enables multi-user approval workflow for disbursements","type":"boolean","example":true}}}}}},"401":{"description":"Unauthorized","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"extras":{"type":"object","properties":{"status":{"type":"number"},"message":{"type":"string"}}}},"example":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}},"examples":{"response":{"value":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}}}}}}},"operationId":"Get Organization Info","description":"This endpoint returns the organization's info. It is used in many places across the UI. It returns the name in the navbar and the public key of the organization’s distribution account.","tags":["Organization"],"security":[{"BearerAuth":[]}],"method":"get","path":"/organization","securitySchemes":{"BearerAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"JWT used for authentication, signed with an ES256 private key."}},"info":{"title":"Stellar Disbursement Platform API","version":"","description":"The Stellar Disbursement Platform (SDP) is a tool built for organizations to make bulk payments to a group of recipients over the Stellar network. You can read more about using the SDP [here](https://developers.stellar.org/docs/category/use-the-stellar-disbursement-platform)."},"postman":{"name":"Get Organization Info","description":{"content":"This endpoint returns the organization's info. It is used in many places across the UI. It returns the name in the navbar and the public key of the organization’s distribution account.","type":"text/plain"},"url":{"path":["organization"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Accept","value":"application/json"}],"method":"GET","auth":{"type":"apikey","apikey":[{"type":"any","value":"Authorization","key":"key"},{"type":"any","value":"","key":"value"},{"type":"any","value":"header","key":"in"}]}}} +api: {"responses":{"200":{"description":"Returns organization details","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"Stellar Aid"},"logo_url":{"type":"string","example":"https://stellar-disbursement-platform-backend-dev.stellar.org/organization/logo"},"distribution_account_public_key":{"type":"string","example":"GCXAJ3XJ3VK3JFH3QMDFOSKM2NMMZBSO3VIT6EUPQWSDW2J74M23RRSL"},"timezone_utc_offset":{"type":"string","example":"+00:00"},"is_approval_required":{"description":"Enables multi-user approval workflow for disbursements","type":"boolean","example":true},"sms_registration_message_template":{"description":"The custom SMS message template set for the registration invite. The `default` message isn't returned. In the message's content it's possible to add the following template variables: {{.OrganizationName}} which is the Organization Name configured and {{.RegistrationLink}} which is the link generated by SDP to send to the receiver (in case this is not present in the message, it's automatically appended at the end).","type":"string","example":"You have a payment waiting for you from {{.OrganizationName}}. Click {{.RegistrationLink}} to register."},"otp_message_template":{"description":"The custom OTP message template set to send OTP code to the receiver complete the registration flow. The `default` message isn't returned. In the message's content it's possible to add the following template variables: {{.OrganizationName}} which is the Organization Name configured and {{.OTP}} which is the OTP code to send to the receiver complete the registration flow (in case this is not present in the message, it's automatically appended at the end).","type":"string","example":"{{.OTP}} is your {{.OrganizationName}} phone verification code."}}}}}},"401":{"description":"Unauthorized","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"extras":{"type":"object","properties":{"status":{"type":"number"},"message":{"type":"string"}}}},"example":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}},"examples":{"response":{"value":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}}}}}}},"operationId":"Get Organization Info","description":"This endpoint returns the organization's info. It is used in many places across the UI. It returns the name in the navbar and the public key of the organization’s distribution account.","tags":["Organization"],"security":[{"BearerAuth":[]}],"method":"get","path":"/organization","securitySchemes":{"BearerAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"JWT used for authentication, signed with an ES256 private key."}},"info":{"title":"Stellar Disbursement Platform API","version":"","description":"The Stellar Disbursement Platform (SDP) is a tool built for organizations to make bulk payments to a group of recipients over the Stellar network. You can read more about using the SDP [here](https://developers.stellar.org/docs/category/use-the-stellar-disbursement-platform)."},"postman":{"name":"Get Organization Info","description":{"content":"This endpoint returns the organization's info. It is used in many places across the UI. It returns the name in the navbar and the public key of the organization’s distribution account.","type":"text/plain"},"url":{"path":["organization"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Accept","value":"application/json"}],"method":"GET","auth":{"type":"apikey","apikey":[{"type":"any","value":"Authorization","key":"key"},{"type":"any","value":"","key":"value"},{"type":"any","value":"header","key":"in"}]}}} sidebar_class_name: "get api-method" info_path: api/stellar-disbursement-platform/resources/stellar-disbursement-platform-api custom_edit_url: null @@ -34,7 +34,7 @@ This endpoint returns the organization's info. It is used in many places across Returns organization details -
Schema
+
Schema
Unauthorized diff --git a/api/stellar-disbursement-platform/resources/update-organization-profile.api.mdx b/api/stellar-disbursement-platform/resources/update-organization-profile.api.mdx index 20c5efdb2..dae55efd7 100644 --- a/api/stellar-disbursement-platform/resources/update-organization-profile.api.mdx +++ b/api/stellar-disbursement-platform/resources/update-organization-profile.api.mdx @@ -5,7 +5,7 @@ description: "Updates the organization profile details. Only account owners have sidebar_label: "Update Organization Profile" hide_title: true hide_table_of_contents: true -api: {"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"examples":{"response":{"value":{"message":"organization profile updated successfully"}}}}}},"401":{"description":"Unauthorized","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"extras":{"type":"object","properties":{"status":{"type":"number"},"message":{"type":"string"}}}},"example":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}},"examples":{"response":{"value":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}}}}}},"403":{"description":"Forbidden","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"example":{"error":"Forbidden"}},"examples":{"response":{"value":{"error":"Forbidden"}}}}}}},"operationId":"Update Organization Profile","description":"Updates the organization profile details. Only account owners have permission to do this. Note: both fields are optional but at least one should be sent in the request. It is not necessary to set the header Content-Type for this request. It is set automatically by the HTTP client.","tags":["Organization"],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"logo":{"description":"The logo of the organization, file type must be png or jpeg.","type":"string","format":"binary"},"data":{"description":"A JSON string that contains the details to update. Contains the following keys: `organization_name` (string): the new name of the organization, `timezone_utc_offset` (string): the new timezone offset of the organization, `is_approval_required` (boolean): whether the approval workflow is enabled or not. For example: '{\"organization_name\": \"NewOrgName\", \"timezone_utc_offset\": \"+02:00\", \"is_approval_required\": true}'\n","type":"string","format":"json"}}}}}},"security":[{"BearerAuth":[]}],"method":"patch","path":"/organization","securitySchemes":{"BearerAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"JWT used for authentication, signed with an ES256 private key."}},"info":{"title":"Stellar Disbursement Platform API","version":"","description":"The Stellar Disbursement Platform (SDP) is a tool built for organizations to make bulk payments to a group of recipients over the Stellar network. You can read more about using the SDP [here](https://developers.stellar.org/docs/category/use-the-stellar-disbursement-platform)."},"postman":{"name":"Update Organization Profile","description":{"content":"Updates the organization profile details. Only account owners have permission to do this. Note: both fields are optional but at least one should be sent in the request. It is not necessary to set the header Content-Type for this request. It is set automatically by the HTTP client.","type":"text/plain"},"url":{"path":["organization"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"multipart/form-data"},{"key":"Accept","value":"application/json"}],"method":"PATCH","body":{"mode":"formdata","formdata":[]},"auth":{"type":"apikey","apikey":[{"type":"any","value":"Authorization","key":"key"},{"type":"any","value":"","key":"value"},{"type":"any","value":"header","key":"in"}]}}} +api: {"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"examples":{"response":{"value":{"message":"organization profile updated successfully"}}}}}},"401":{"description":"Unauthorized","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"extras":{"type":"object","properties":{"status":{"type":"number"},"message":{"type":"string"}}}},"example":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}},"examples":{"response":{"value":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}}}}}},"403":{"description":"Forbidden","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"example":{"error":"Forbidden"}},"examples":{"response":{"value":{"error":"Forbidden"}}}}}}},"operationId":"Update Organization Profile","description":"Updates the organization profile details. Only account owners have permission to do this. Note: both fields are optional but at least one should be sent in the request. It is not necessary to set the header Content-Type for this request. It is set automatically by the HTTP client.","tags":["Organization"],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"logo":{"description":"The logo of the organization, file type must be png or jpeg.","type":"string","format":"binary"},"data":{"description":"A JSON string that contains the details to update. Contains the following keys: `organization_name` (string): the new name of the organization, `timezone_utc_offset` (string): the new timezone offset of the organization, `is_approval_required` (boolean): whether the approval workflow is enabled or not. `sms_registration_message_template` (string): the SMS message template sent to the receivers inviting them to registration. Sending this field empty sets the `default` value for it. `otp_message_template` (string): the SMS message template sent to the receivers sending the OTP to complete the registration flow. Sending this field empty sets the `default` value for it. For example: '{\"organization_name\": \"NewOrgName\", \"timezone_utc_offset\": \"+02:00\", \"is_approval_required\": true, \"sms_registration_message_template\": \"You have a payment waiting for you from {{.OrganizationName}}. Click {{.RegistrationLink}} to register.\", \"otp_message_template\": \"{{.OTP}} is your {{.OrganizationName}} phone verification code.\"}'\n","type":"string","format":"json"}}}}}},"security":[{"BearerAuth":[]}],"method":"patch","path":"/organization","securitySchemes":{"BearerAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"JWT used for authentication, signed with an ES256 private key."}},"info":{"title":"Stellar Disbursement Platform API","version":"","description":"The Stellar Disbursement Platform (SDP) is a tool built for organizations to make bulk payments to a group of recipients over the Stellar network. You can read more about using the SDP [here](https://developers.stellar.org/docs/category/use-the-stellar-disbursement-platform)."},"postman":{"name":"Update Organization Profile","description":{"content":"Updates the organization profile details. Only account owners have permission to do this. Note: both fields are optional but at least one should be sent in the request. It is not necessary to set the header Content-Type for this request. It is set automatically by the HTTP client.","type":"text/plain"},"url":{"path":["organization"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"multipart/form-data"},{"key":"Accept","value":"application/json"}],"method":"PATCH","body":{"mode":"formdata","formdata":[]},"auth":{"type":"apikey","apikey":[{"type":"any","value":"Authorization","key":"key"},{"type":"any","value":"","key":"value"},{"type":"any","value":"header","key":"in"}]}}} sidebar_class_name: "patch api-method" info_path: api/stellar-disbursement-platform/resources/stellar-disbursement-platform-api custom_edit_url: null @@ -30,7 +30,7 @@ import TabItem from "@theme/TabItem"; Updates the organization profile details. Only account owners have permission to do this. Note: both fields are optional but at least one should be sent in the request. It is not necessary to set the header Content-Type for this request. It is set automatically by the HTTP client. -
Request Body
+
Request Body
OK diff --git a/openapi/stellar-disbursement-platform/bundled.yml b/openapi/stellar-disbursement-platform/bundled.yml index 6a1f9ab33..880fc67a1 100644 --- a/openapi/stellar-disbursement-platform/bundled.yml +++ b/openapi/stellar-disbursement-platform/bundled.yml @@ -1439,7 +1439,7 @@ paths: type: string format: json description: | - A JSON string that contains the details to update. Contains the following keys: `organization_name` (string): the new name of the organization, `timezone_utc_offset` (string): the new timezone offset of the organization, `is_approval_required` (boolean): whether the approval workflow is enabled or not. For example: '{"organization_name": "NewOrgName", "timezone_utc_offset": "+02:00", "is_approval_required": true}' + A JSON string that contains the details to update. Contains the following keys: `organization_name` (string): the new name of the organization, `timezone_utc_offset` (string): the new timezone offset of the organization, `is_approval_required` (boolean): whether the approval workflow is enabled or not. `sms_registration_message_template` (string): the SMS message template sent to the receivers inviting them to registration. Sending this field empty sets the `default` value for it. `otp_message_template` (string): the SMS message template sent to the receivers sending the OTP to complete the registration flow. Sending this field empty sets the `default` value for it. For example: '{"organization_name": "NewOrgName", "timezone_utc_offset": "+02:00", "is_approval_required": true, "sms_registration_message_template": "You have a payment waiting for you from {{.OrganizationName}}. Click {{.RegistrationLink}} to register.", "otp_message_template": "{{.OTP}} is your {{.OrganizationName}} phone verification code."}' security: - BearerAuth: [] /organization/logo: @@ -2080,6 +2080,14 @@ definitions: description: Enables multi-user approval workflow for disbursements type: boolean example: true + sms_registration_message_template: + description: 'The custom SMS message template set for the registration invite. The `default` message isn''t returned. In the message''s content it''s possible to add the following template variables: {{.OrganizationName}} which is the Organization Name configured and {{.RegistrationLink}} which is the link generated by SDP to send to the receiver (in case this is not present in the message, it''s automatically appended at the end).' + type: string + example: You have a payment waiting for you from {{.OrganizationName}}. Click {{.RegistrationLink}} to register. + otp_message_template: + description: 'The custom OTP message template set to send OTP code to the receiver complete the registration flow. The `default` message isn''t returned. In the message''s content it''s possible to add the following template variables: {{.OrganizationName}} which is the Organization Name configured and {{.OTP}} which is the OTP code to send to the receiver complete the registration flow (in case this is not present in the message, it''s automatically appended at the end).' + type: string + example: '{{.OTP}} is your {{.OrganizationName}} phone verification code.' Pagination: type: object properties: diff --git a/openapi/stellar-disbursement-platform/main.yml b/openapi/stellar-disbursement-platform/main.yml index cb12af9ae..76373cb25 100644 --- a/openapi/stellar-disbursement-platform/main.yml +++ b/openapi/stellar-disbursement-platform/main.yml @@ -1508,7 +1508,9 @@ paths: `organization_name` (string): the new name of the organization, `timezone_utc_offset` (string): the new timezone offset of the organization, `is_approval_required` (boolean): whether the approval workflow is enabled or not. - For example: '{"organization_name": "NewOrgName", "timezone_utc_offset": "+02:00", "is_approval_required": true}' + `sms_registration_message_template` (string): the SMS message template sent to the receivers inviting them to registration. Sending this field empty sets the `default` value for it. + `otp_message_template` (string): the SMS message template sent to the receivers sending the OTP to complete the registration flow. Sending this field empty sets the `default` value for it. + For example: '{"organization_name": "NewOrgName", "timezone_utc_offset": "+02:00", "is_approval_required": true, "sms_registration_message_template": "You have a payment waiting for you from {{.OrganizationName}}. Click {{.RegistrationLink}} to register.", "otp_message_template": "{{.OTP}} is your {{.OrganizationName}} phone verification code."}' security: - BearerAuth: [] /organization/logo: @@ -2166,6 +2168,14 @@ definitions: description: 'Enables multi-user approval workflow for disbursements' type: boolean example: true + sms_registration_message_template: + description: "The custom SMS message template set for the registration invite. The `default` message isn't returned. In the message's content it's possible to add the following template variables: {{.OrganizationName}} which is the Organization Name configured and {{.RegistrationLink}} which is the link generated by SDP to send to the receiver (in case this is not present in the message, it's automatically appended at the end)." + type: string + example: "You have a payment waiting for you from {{.OrganizationName}}. Click {{.RegistrationLink}} to register." + otp_message_template: + description: "The custom OTP message template set to send OTP code to the receiver complete the registration flow. The `default` message isn't returned. In the message's content it's possible to add the following template variables: {{.OrganizationName}} which is the Organization Name configured and {{.OTP}} which is the OTP code to send to the receiver complete the registration flow (in case this is not present in the message, it's automatically appended at the end)." + type: string + example: "{{.OTP}} is your {{.OrganizationName}} phone verification code." Pagination: type: "object"