error sending slack notifications
bsushmith opened this issue · comments
sushmith commented
Description
With the new way of slack notifications being sent supporting enhanced message support - there can be failures in sending notifications if the notification message has special characters.
For example,
Scenario1:
Using the below as expiration reminder template, causes json parsing failures
[
{
"type":"section",
"text":{
"type":"mrkdwn",
"text":"Access to {{.resource_name}} with role {{.role}} for account `{{.account_id}}` will *expire* at {{.expiration_date.Format \"Jan 02, 2006 15:04:05 UTC\"}}. Go to this link https://console.data.gtfdata.io/dataaccess/resources to reapply"
}
}
]
Error:
time="2023-04-10T09:00:27Z" level=error msg="failed to send notifications" error="template: notification_messages:6: unexpected \"\\\\\" in operand"
Scenario 2:
If the user supplied reason to a given appeal question contains \n
characters like below -
{
"questions": {
"What is the purpose of accessing this data?": "This dataset is essential for our use cases.\nThe access to this dataset is important to granted at the latest\n"
}
}
Error:
ERRO[46578] failed to send notifications error="error in parsing message block invalid character '\\n' in string literal"