@@ -127,6 +127,14 @@ type wacMedia struct {
127
127
Mimetype string `json:"mime_type"`
128
128
SHA256 string `json:"sha256"`
129
129
}
130
+
131
+ type wacSticker struct {
132
+ Animated bool `json:"animated"`
133
+ ID string `json:"id"`
134
+ Mimetype string `json:"mime_type"`
135
+ SHA256 string `json:"sha256"`
136
+ }
137
+
130
138
type moPayload struct {
131
139
Object string `json:"object"`
132
140
Entry []struct {
@@ -160,11 +168,12 @@ type moPayload struct {
160
168
Text struct {
161
169
Body string `json:"body"`
162
170
} `json:"text"`
163
- Image * wacMedia `json:"image"`
164
- Audio * wacMedia `json:"audio"`
165
- Video * wacMedia `json:"video"`
166
- Document * wacMedia `json:"document"`
167
- Voice * wacMedia `json:"voice"`
171
+ Image * wacMedia `json:"image"`
172
+ Audio * wacMedia `json:"audio"`
173
+ Video * wacMedia `json:"video"`
174
+ Document * wacMedia `json:"document"`
175
+ Voice * wacMedia `json:"voice"`
176
+ Sticker * wacSticker `json:"sticker"`
168
177
Location * struct {
169
178
Latitude float64 `json:"latitude"`
170
179
Longitude float64 `json:"longitude"`
@@ -469,6 +478,8 @@ func (h *handler) processCloudWhatsAppPayload(ctx context.Context, channel couri
469
478
} else if msg .Type == "image" && msg .Image != nil {
470
479
text = msg .Image .Caption
471
480
mediaURL , err = resolveMediaURL (msg .Image .ID , token , clog )
481
+ } else if msg .Type == "sticker" && msg .Sticker != nil {
482
+ mediaURL , err = resolveMediaURL (msg .Sticker .ID , token , clog )
472
483
} else if msg .Type == "video" && msg .Video != nil {
473
484
text = msg .Video .Caption
474
485
mediaURL , err = resolveMediaURL (msg .Video .ID , token , clog )
@@ -1082,6 +1093,7 @@ type wacMTPayload struct {
1082
1093
Image * wacMTMedia `json:"image,omitempty"`
1083
1094
Audio * wacMTMedia `json:"audio,omitempty"`
1084
1095
Video * wacMTMedia `json:"video,omitempty"`
1096
+ Sticker * wacMTMedia `json:"sticker,omitempty"`
1085
1097
1086
1098
Interactive * wacInteractive `json:"interactive,omitempty"`
1087
1099
@@ -1217,7 +1229,10 @@ func (h *handler) sendCloudAPIWhatsappMsg(ctx context.Context, msg courier.Msg,
1217
1229
1218
1230
} else if i < len (msg .Attachments ()) && (len (qrs ) == 0 || len (qrs ) > 3 ) {
1219
1231
attType , attURL := handlers .SplitAttachment (msg .Attachments ()[i ])
1220
- attType = strings .Split (attType , "/" )[0 ]
1232
+ splitedAttType := strings .Split (attType , "/" )
1233
+ attType = splitedAttType [0 ]
1234
+ attFormat := splitedAttType [1 ]
1235
+
1221
1236
if attType == "application" {
1222
1237
attType = "document"
1223
1238
}
@@ -1230,7 +1245,12 @@ func (h *handler) sendCloudAPIWhatsappMsg(ctx context.Context, msg courier.Msg,
1230
1245
}
1231
1246
1232
1247
if attType == "image" {
1233
- payload .Image = & media
1248
+ if attFormat == "webp" {
1249
+ payload .Type = "sticker"
1250
+ payload .Sticker = & media
1251
+ } else {
1252
+ payload .Image = & media
1253
+ }
1234
1254
} else if attType == "audio" {
1235
1255
payload .Audio = & media
1236
1256
} else if attType == "video" {
0 commit comments