diff --git a/runtime/config.go b/runtime/config.go index e2a716a68..9fae37a50 100644 --- a/runtime/config.go +++ b/runtime/config.go @@ -49,14 +49,15 @@ type Config struct { MaxValueLength int `help:"the maximum size in characters for contact field values and run result values"` SessionStorage string `validate:"omitempty,session_storage" help:"where to store session output (s3|db)"` - S3Endpoint string `help:"the S3 endpoint we will write attachments to"` - S3Region string `help:"the S3 region we will write attachments to"` - S3MediaBucket string `help:"the S3 bucket we will write attachments to"` - S3MediaPrefix string `help:"the prefix that will be added to attachment filenames"` - S3SessionBucket string `help:"the S3 bucket we will write attachments to"` - S3SessionPrefix string `help:"the prefix that will be added to attachment filenames"` - S3DisableSSL bool `help:"whether we disable SSL when accessing S3. Should always be set to False unless you're hosting an S3 compatible service within a secure internal network"` - S3ForcePathStyle bool `help:"whether we force S3 path style. Should generally need to default to False unless you're hosting an S3 compatible service"` + S3Endpoint string `help:"the S3 endpoint we will write attachments to"` + S3Region string `help:"the S3 region we will write attachments to"` + S3MediaBucket string `help:"the S3 bucket we will write attachments to"` + S3MediaPrefix string `help:"the prefix that will be added to attachment filenames"` + S3MediaPrefixZendesk string `help:"the prefix that will be added to file attachment names for Zendesk tickets"` + S3SessionBucket string `help:"the S3 bucket we will write attachments to"` + S3SessionPrefix string `help:"the prefix that will be added to attachment filenames"` + S3DisableSSL bool `help:"whether we disable SSL when accessing S3. Should always be set to False unless you're hosting an S3 compatible service within a secure internal network"` + S3ForcePathStyle bool `help:"whether we force S3 path style. Should generally need to default to False unless you're hosting an S3 compatible service"` AWSAccessKeyID string `help:"the access key id to use when authenticating S3"` AWSSecretAccessKey string `help:"the secret access key id to use when authenticating S3"` diff --git a/services/tickets/zendesk/service.go b/services/tickets/zendesk/service.go index d52c63bdc..0ec8420f8 100644 --- a/services/tickets/zendesk/service.go +++ b/services/tickets/zendesk/service.go @@ -318,7 +318,9 @@ func (s *service) convertAttachments(attachments []utils.Attachment) ([]string, path := strings.TrimPrefix(u.Path, prefix) path = strings.TrimPrefix(path, "/") - fileURLs[i] = "api/v2/file/" + path + domain := s.rtConfig.S3MediaPrefixZendesk + + fileURLs[i] = "https://" + domain + "/api/v2/file/" + path } return fileURLs, nil } diff --git a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap index a7bff213c..b527ce41a 100644 --- a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap +++ b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap @@ -6,4 +6,4 @@ Authorization: Bearer **************** Content-Type: application/json Accept-Encoding: gzip -{"instance_push_id":"1234-abcd","request_id":"sesame:1570461700000000000","external_resources":[{"external_id":"ca5607f0-cba8-4c94-9cd5-c4fbc24aa767","message":"It's urgent","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:39Z","author":{"external_id":"6393abc0-283d-4c9b-a1b3-641a035c34bf","name":"Cathy"},"allow_channelback":true,"file_urls":["api/v2/file/0123/attachment1.jpg"]}]} \ No newline at end of file +{"instance_push_id":"1234-abcd","request_id":"sesame:1570461700000000000","external_resources":[{"external_id":"ca5607f0-cba8-4c94-9cd5-c4fbc24aa767","message":"It's urgent","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:39Z","author":{"external_id":"6393abc0-283d-4c9b-a1b3-641a035c34bf","name":"Cathy"},"allow_channelback":true,"file_urls":["https://flows.weni.ai/api/v2/file/0123/attachment1.jpg"]}]} \ No newline at end of file