Skip to content

Commit

Permalink
Merge pull request #105 from Ilhasoft/fix/url-zendesk
Browse files Browse the repository at this point in the history
Add Domain to File URL for Zendesk
  • Loading branch information
Robi9 authored Dec 28, 2022
2 parents f70c6c4 + 3020267 commit 9272878
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
17 changes: 9 additions & 8 deletions runtime/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
4 changes: 3 additions & 1 deletion services/tickets/zendesk/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}]}
{"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"]}]}

0 comments on commit 9272878

Please sign in to comment.