Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Domain to File URL for Zendesk #105

Merged
merged 2 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]}]}