DOCUMENTATION.md in notifications-ruby-client-5.1.2 vs DOCUMENTATION.md in notifications-ruby-client-5.2.0

- old
+ new

@@ -125,24 +125,24 @@ |`smsresponse.template`|Contains the `id`, `version` and `uri` of the template|Hash| |`smsresponse.uri`|Notification URL|String| If you are using the [test API key](#test), all your messages come back with a `delivered` status. -All messages sent using the [team and whitelist](#team-and-whitelist) or [live](#live) keys appear on your GOV.UK Notify dashboard. +All messages sent using the [team and guest list](#team-and-guest-list) or [live](#live) keys appear on your GOV.UK Notify dashboard. ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`BadRequestError: Can't send to this recipient using a team-only API key`|`BadRequestError`|Use the correct type of [API key](#api-keys)| |`400`|`BadRequestError: Can't send to this recipient when service is in trial mode - see https://www.notifications.service.gov.uk/trial-mode`|`BadRequestError`|Your service cannot send this notification in [trial mode](https://www.notifications.service.gov.uk/features/using-notify#trial-mode)| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| -|`429`|`RateLimitError: Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds`|`RateLimitError`|Refer to [API rate limits](#api-rate-limits) for more information| -|`429`|`TooManyRequestsError: Exceeded send limits (LIMIT NUMBER) for today`|`ClientError`|Refer to [service limits](#service-limits) for the limit number| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`429`|`RateLimitError: Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds`|`RateLimitError`|Refer to [API rate limits](#rate-limits) for more information| +|`429`|`TooManyRequestsError: Exceeded send limits (LIMIT NUMBER) for today`|`ClientError`|Refer to [service limits](#daily-limits) for the limit number| |`500`|`Exception: Internal server error`|`ServerError`|Notify was unable to process the request, resend your notification| ## Send an email ### Method @@ -221,30 +221,33 @@ You can leave out this argument if your service only has one email reply-to address, or you want to use the default email address. ## Send a file by email -Send files without the need for email attachments. +To send a file by email, add a placeholder to the template then upload a file. The placeholder will contain a secure link to download the file. -This is an invitation-only feature. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) to enable this function for your service. +The links are unique and unguessable. GOV.UK Notify cannot access or decrypt your file. -To send a file by email, add a placeholder field to the template then upload a file. The placeholder field will contain a secure link to download the file. +### Add contact details to the file download page -The links are unique and unguessable. GOV.UK Notify cannot access or decrypt your file. +1. [Sign in to GOV.UK Notify](https://www.notifications.service.gov.uk/sign-in). +1. Go to the __Settings__ page. +1. In the __Email__ section, select __Manage__ on the __Send files by email__ row. +1. Enter the contact details you want to use, and select __Save__. -### Add a placeholder field to the template +### Add a placeholder to the template 1. [Sign in to GOV.UK Notify](https://www.notifications.service.gov.uk/sign-in). 1. Go to the __Templates__ page and select the relevant email template. 1. Select __Edit__. -1. Add a placeholder field to the email template using double brackets. For example: +1. Add a placeholder to the email template using double brackets. For example: "Download your file at: ((link_to_file))" ### Upload your file -The file you upload must be a PDF, CSV, text file or Microsoft Word document smaller than 2MB. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) if you need to send other file types. +You can upload PDF, CSV, .odt, .txt and MS Word Document files. Your file must be smaller than 2MB. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) if you need to send other file types. 1. Pass the file object as an argument to the `Notifications.prepare_upload` helper method. 1. Pass the result into the personalisation argument. For example: @@ -258,10 +261,25 @@ link_to_file: Notifications.prepare_upload(f), } end ``` +#### CSV Files + +Uploads for CSV files should use the `is_csv` parameter on the `prepare_upload()` helper method. For example: + +```ruby +File.open("file.csv", "rb") do |f| + ... + personalisation: { + first_name: "Amala", + application_date: "2018-01-01", + link_to_file: Notifications.prepare_upload(f, is_csv=true), + } +end +``` + ### Response If the request to the client is successful, the client returns a `Notifications::Client:ResponseNotification` object. In the example shown in the [Method section](#send-an-email-method), the object is named `emailresponse`. You can then call different methods on this object to return the requested information. @@ -274,23 +292,23 @@ |`emailresponse.template`|Contains the `id`, `version` and `uri` of the template|Hash| |`emailresponse.uri`|Notification URL|String| ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:--- |:---|:---|:---| |`400`|`BadRequestError: Can't send to this recipient using a team-only API key`|`BadRequestError`|Use the correct type of [API key](#api-keys)| |`400`|`BadRequestError: Can't send to this recipient when service is in trial mode - see https://www.notifications.service.gov.uk/trial-mode`|`BadRequestError`|Your service cannot send this notification in [trial mode](https://www.notifications.service.gov.uk/features/using-notify#trial-mode)| -|`400`|`BadRequestError: Unsupported file type '(FILE TYPE)'. Supported types are: '(ALLOWED TYPES)'`|`BadRequestError`|Wrong file type. You can only upload .pdf, .csv, .txt, .doc or .docx files| +|`400`|`BadRequestError: Unsupported file type '(FILE TYPE)'. Supported types are: '(ALLOWED TYPES)'`|`BadRequestError`|Wrong file type. You can only upload .pdf, .csv, .txt, .doc, .docx or .odt files| |`400`|`BadRequestError: File did not pass the virus scan`|`BadRequestError`|The file contains a virus| -|`400`|`BadRequestError: Service is not allowed to send documents`|`BadRequestError`|Contact the GOV.UK Notify team| +|`400`|`BadRequestError: Send files by email has not been set up - add contact details for your service at https://www.notifications.service.gov.uk/services/(SERVICE ID)/service-settings/send-files-by-email`|`BadRequestError`|See how to [add contact details to the file download page](#add-contact-details-to-the-file-download-page)| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| -|`429`|`RateLimitError: Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds`|`RateLimitError`|Refer to [API rate limits](#api-rate-limits) for more information| -|`429`|`TooManyRequestsError: Exceeded send limits (LIMIT NUMBER) for today`|`RateLimitError`|Refer to [service limits](#service-limits) for the limit number| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`429`|`RateLimitError: Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds`|`RateLimitError`|Refer to [API rate limits](#rate-limits) for more information| +|`429`|`TooManyRequestsError: Exceeded send limits (LIMIT NUMBER) for today`|`RateLimitError`|Refer to [service limits](#daily-limits) for the limit number| |`500`|`Exception: Internal server error`|`ServerError`|Notify was unable to process the request, resend your notification| |-|`ArgumentError: File is larger than 2MB")`|-|The file is too big. Files must be smaller than 2MB| ## Send a letter @@ -335,11 +353,11 @@ The personalisation argument always contains the following parameters for the letter recipient’s address: - `address_line_1` - `address_line_2` -- `postcode` +- `postcode` (this needs to be a real UK postcode) Any other placeholder fields included in the letter template also count as required parameters. You must provide their values in a hash. For example: ```ruby @@ -388,21 +406,22 @@ |`letterresponse.uri`|Notification URL|String| ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:--- |:---|:---|:---| |`400`|`BadRequestError: Cannot send letters with a team api key`|`BadRequestError`|Use the correct type of [API key](#api-keys)| |`400`|`BadRequestError: Cannot send letters when service is in trial mode - see https://www.notifications.service.gov.uk/trial-mode`|`BadRequestError`|Your service cannot send this notification in [trial mode](https://www.notifications.service.gov.uk/features/using-notify#trial-mode)| |`400`|`ValidationError: personalisation address_line_1 is a required property`|`BadRequestError`|Ensure that your template has a field for the first line of the address, refer to [personalisation](#personalisation-required) for more information| +|`400`|`ValidationError: Must be a real UK postcode`|`BadRequestError`|Ensure that the value for the postcode field in your letter is a real UK postcode| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| -|`429`|`RateLimitError: Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds`|`RateLimitError`|Refer to [API rate limits](#api-rate-limits) for more information| -|`429`|`TooManyRequestsError: Exceeded send limits (LIMIT NUMBER) for today`|`RateLimitError`|Refer to [service limits](#service-limits) for the limit number| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`429`|`RateLimitError: Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds`|`RateLimitError`|Refer to [API rate limits](#rate-limits) for more information| +|`429`|`TooManyRequestsError: Exceeded send limits (LIMIT NUMBER) for today`|`RateLimitError`|Refer to [service limits](#daily-limits) for the limit number| |`500`|`Exception: Internal server error`|`ServerError`|Notify was unable to process the request, resend your notification| ## Send a precompiled letter ### Method @@ -443,43 +462,47 @@ |`precompiled_letter.postage`|`postage` argument|String| ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.status_code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`BadRequestError: Cannot send letters with a team api key`|`BadRequestError`|Use the correct type of [API key](#api-keys)| |`400`|`BadRequestError: Letter content is not a valid PDF`|`BadRequestError`|PDF file format is required| |`400`|`BadRequestError: Cannot send letters when service is in trial mode - see https://www.notifications.service.gov.uk/trial-mode`|`BadRequestError`|Your service cannot send this notification in [trial mode](https://www.notifications.service.gov.uk/features/using-notify#trial-mode)| |`400`|`ValidationError: reference is a required property`|`BadRequestError`|Add a `reference` argument to the method call| |`400`|`ValidationError: postage invalid. It must be either first or second.`|`BadRequestError`|Change the value of `postage` argument in the method call to either 'first' or 'second'| |`429`|`RateLimitError: Exceeded rate limit for key type live of 10 requests per 20 seconds`|`RateLimitError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| -|`429`|`TooManyRequestsError: Exceeded send limits (50) for today`|`RateLimitError`|Refer to [service limits](#service-limits) for the limit number| +|`429`|`TooManyRequestsError: Exceeded send limits (50) for today`|`RateLimitError`|Refer to [service limits](#daily-limits) for the limit number| # Get message status Message status depends on the type of message you have sent. You can only get the status of messages that are 7 days old or newer. -## Status - text and email +## Status - email |Status|Information| |:---|:---| |Created|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.| -|Sending|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient. GOV.UK Notify is waiting for delivery information.| +|Sending|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.| |Delivered|The message was successfully delivered.| -|Failed|This covers all failure statuses:<br>- `permanent-failure` - "The provider could not deliver the message because the email address or phone number was wrong. You should remove these email addresses or phone numbers from your database. You’ll still be charged for text messages to numbers that do not exist."<br>- `temporary-failure` - "The provider could not deliver the message after trying for 72 hours. This can happen when the recipient's inbox is full or their phone is off. You can try to send the message again. You’ll still be charged for text messages to phones that are not accepting messages."<br>- `technical-failure` - "Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again. You will not be charged for text messages that are affected by a technical failure."| +|Failed|This covers all failure statuses:<br>- `permanent-failure` - "The provider could not deliver the message because the email address was wrong. You should remove these email addresses from your database."<br>- `temporary-failure` - "The provider could not deliver the message. This can happen when the recipient’s inbox is full. You can try to send the message again."<br>- `technical-failure` - "Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again."| -## Status - text only +## Status - text message |Status|Information| |:---|:---| -|Pending|GOV.UK Notify is waiting for more delivery information.<br>GOV.UK Notify received a callback from the provider but the recipient's device has not yet responded. Another callback from the provider determines the final status of the notification.| +|Created|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.| +|Sending|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.| +|Pending|GOV.UK Notify is waiting for more delivery information.<br>GOV.UK Notify received a callback from the provider but the recipient’s device has not yet responded. Another callback from the provider determines the final status of the notification.| |Sent / Sent internationally|The message was sent to an international number. The mobile networks in some countries do not provide any more delivery information. The GOV.UK Notify client API returns this status as `sent`. The GOV.UK Notify client app returns this status as `Sent internationally`.| +|Delivered|The message was successfully delivered.| +|Failed|This covers all failure statuses:<br>- `permanent-failure` - "The provider could not deliver the message. This can happen if the phone number was wrong or if the network operator rejects the message. If you’re sure that these phone numbers are correct, you should [contact GOV.UK Notify support](https://www.notifications.service.gov.uk/support). If not, you should remove them from your database. You’ll still be charged for text messages that cannot be delivered."<br>- `temporary-failure` - "The provider could not deliver the message. This can happen when the recipient’s phone is off, has no signal, or their text message inbox is full. You can try to send the message again. You’ll still be charged for text messages to phones that are not accepting messages."<br>- `technical-failure` - "Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again. You will not be charged for text messages that are affected by a technical failure."| ## Status - letter |Status|information| |:---|:---| @@ -543,17 +566,17 @@ |`response.completed_at`|Date and time notification delivered or failed|String| |`response.created_by_name`|Name of sender if notification sent manually|String| ### Error codes -If the request is not successful, the client returns a `Notification::Client::RequestError` and an error code: +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`ValidationError: id is not a valid UUID`|`BadRequestError`|Check the notification ID| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| |`404`|`NoResultFound: No result found`|`NotFoundError`|Check the notification ID. This error occurs if the notification is more than 7 days old.| ## Get the status of multiple messages This API call returns one page of up to 250 messages and statuses. You can get either the most recent messages, or get older messages by specifying a particular notification ID in the `older_than` argument. @@ -580,27 +603,19 @@ You can leave out these arguments to ignore these filters. #### status (optional) -| status | description | text | email | letter |Precompiled letter| -|:--- |:--- |:--- |:--- |:--- |:--- | -|created|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.|Yes|Yes||| -|sending|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient. GOV.UK Notify is waiting for delivery information.|Yes|Yes||| -|delivered|The message was successfully delivered|Yes|Yes||| -|sent / sent internationally|The message was sent to an international number. The mobile networks in some countries do not provide any more delivery information.|Yes|||| -|pending|GOV.UK Notify is waiting for more delivery information.<br>GOV.UK Notify received a callback from the provider but the recipient's device has not yet responded. Another callback from the provider determines the final status of the notification.|Yes|||| -|failed|This returns all failure statuses:<br>- permanent-failure<br>- temporary-failure<br>- technical-failure|Yes|Yes||| -|permanent-failure|The provider could not deliver the message because the email address or phone number was wrong. You should remove these email addresses or phone numbers from your database. You’ll still be charged for text messages to numbers that do not exist.|Yes|Yes||| -|temporary-failure|The provider could not deliver the message after trying for 72 hours. This can happen when the recipient's inbox is full or their phone is off. You can try to send the message again. You’ll still be charged for text messages to phones that are not accepting messages.|Yes|Yes||| -|technical-failure|Email / Text: Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again. You will not be charged for text messages that are affected by a technical failure. <br><br>Letter: Notify had an unexpected error while sending to our printing provider. <br><br>You can leave out this argument to ignore this filter.|Yes|Yes||| -|accepted|GOV.UK Notify has sent the letter to the provider to be printed.|||Yes|| -|received|The provider has printed and dispatched the letter.|||Yes|| -|pending-virus-check|GOV.UK Notify is scanning the precompiled letter file for viruses.||||Yes| -|virus-scan-failed|GOV.UK Notify found a potential virus in the precompiled letter file.||||Yes| -|validation-failed|Content in the precompiled letter file is outside the printable area.||||Yes| +You can filter by each: +* [email status](#status-email) +* [text message status](#status-text-message) +* [letter status](#status-letter) +* [precompiled letter status](#status-precompiled-letter) + +You can leave out this argument to ignore this filter. + #### templateType (optional) You can filter by: * `email` @@ -665,18 +680,18 @@ If the notification specified in the `older_than` argument is older than 7 days, the client returns an empty `collection` response. ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`ValidationError: bad status is not one of [created, sending, sent, delivered, pending, failed, technical-failure, temporary-failure, permanent-failure, accepted, received]`|`BadRequestError`|Contact the GOV.UK Notify team| |`400`|`ValidationError: Template type is not one of [sms, email, letter]`|`BadRequestError`|Contact the GOV.UK Notify team| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| ## Get a PDF for a letter notification ### Method @@ -700,21 +715,21 @@ If the request to the client is successful, the client will return a `string` containing the raw PDF data. ### Error codes -If the request is not successful, the client throws a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`ValidationError: id is not a valid UUID`|`BadRequestError`|Check the notification ID| |`400`|`PDFNotReadyError: PDF not available yet, try again later`|`BadRequestError`|Wait for the notification to finish processing. This usually takes a few seconds| |`400`|`BadRequestError: File did not pass the virus scan`|`BadRequestError`|You cannot retrieve the contents of a letter notification that contains a virus| |`400`|`BadRequestError: PDF not available for letters in technical-failure`|`BadRequestError`|You cannot retrieve the contents of a letter notification in technical-failure| |`400`|`ValidationError: Notification is not a letter`|`BadRequestError`|Check that you are looking up the correct notification| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`BadRequestError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`BadRequestError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`BadRequestError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| |`404`|`NoResultFound: No result found`|`BadRequestError`|Check the notification ID| # Get a template @@ -756,17 +771,17 @@ |`response.body`|Template content|String| |`response.subject`|Template subject (email and letter)|String| ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code: +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`ValidationError: id is not a valid UUID`|`BadRequestError`|Check the notification ID| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| |`404`|`NoResultFound: No Result Found`|`NotFoundError`|Check your [template ID](#get-a-template-by-id-arguments-id-required)| ## Get a template by ID and version ### Method @@ -807,17 +822,17 @@ |`response.body`|Template content|String| |`response.subject`|Template subject (email and letter)|String| ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code: +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`ValidationError: id is not a valid UUID`|`BadRequestError`|Check the notification ID| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| |`404`|`NoResultFound: No Result Found`|`NotFoundError`|Check your [template ID](#get-a-template-by-id-and-version-arguments-id-required) and [version](#version-required)| ## Get all templates ### Method @@ -863,11 +878,11 @@ If no templates exist for a template type or there no templates for a service, the templates array will be empty. ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code: +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`ValidationError: Template type is not one of [sms, email, letter]`|`BadRequestError`|Contact the Notify team| @@ -921,18 +936,18 @@ |`response.type`|Template type (sms/email/letter)|String| |`response.html`|Body as rendered HTML (email only)|String| ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code: +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`400`|`BadRequestError: Missing personalisation: [PERSONALISATION FIELD]`|`BadRequestError`|Check that the personalisation arguments in the method match the placeholder fields in the template| |`400`|`NoResultFound: No result found`|`BadRequestError`|Check the [template ID](#generate-a-preview-template-arguments-id-required)| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| # Get received text messages This API call returns one page of up to 250 received text messages. You can get either the most recent messages, or get older messages by specifying a particular notification ID in the `older_than` argument. @@ -997,11 +1012,11 @@ If the notification specified in the `older_than` argument is older than 7 days, the client returns an empty `collection` response. ### Error codes -If the request is not successful, the client returns a `Notifications::Client::RequestError` and an error code. +If the request is not successful, the client raises a `Notifications::Client::RequestError` exception (or a subclass), which contains a code: |error.code|error.message|class|How to fix| |:---|:---|:---|:---| |`403`|`AuthError: Error: Your system clock must be accurate to within 30 seconds`|`AuthError`|Check your system clock| -|`403`|`AuthError: Invalid token: signature, api token not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information| +|`403`|`AuthError: Invalid token: API key not found`|`AuthError`|Use the correct API key. Refer to [API keys](#api-keys) for more information|