Skip to content

Commit

Permalink
change kaleyra media base form to caption
Browse files Browse the repository at this point in the history
  • Loading branch information
Caio Almeida committed Dec 16, 2020
1 parent 3563a9c commit 3595292
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions handlers/kaleyra/kaleyra.go
Expand Up @@ -4,19 +4,20 @@ import (
"bytes"
"context"
"fmt"
"github.com/buger/jsonparser"
"github.com/nyaruka/courier"
"github.com/nyaruka/courier/handlers"
"github.com/nyaruka/courier/utils"
"github.com/nyaruka/gocommon/urns"
"github.com/pkg/errors"
"io"
"mime/multipart"
"net/http"
"net/url"
"strconv"
"strings"
"time"

"github.com/buger/jsonparser"
"github.com/nyaruka/courier"
"github.com/nyaruka/courier/handlers"
"github.com/nyaruka/courier/utils"
"github.com/nyaruka/gocommon/urns"
"github.com/pkg/errors"
)

const (
Expand Down Expand Up @@ -151,7 +152,7 @@ func (h *handler) SendMsg(ctx context.Context, msg courier.Msg) (courier.MsgStat

// make multipart form requests if we have attachments, the kaleyra api doesn't supports media url nor media upload before send
if len(msg.Attachments()) > 0 {
attachmentsLoop:
attachmentsLoop:
for i, attachment := range msg.Attachments() {
_, attachmentURL := handlers.SplitAttachment(attachment)

Expand Down Expand Up @@ -183,7 +184,7 @@ func (h *handler) SendMsg(ctx context.Context, msg courier.Msg) (courier.MsgStat
// fill base values
baseForm := h.newSendForm(msg.Channel(), "media", msg.URN().Path())
if i == 0 {
baseForm["body"] = msg.Text()
baseForm["caption"] = msg.Text()
}
for k, v := range baseForm {
part, err := writer.CreateFormField(k)
Expand Down

0 comments on commit 3595292

Please sign in to comment.