Skip to content

Commit

Permalink
resolves #1622 [WhatsApp Cloud Connector] image upload issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vsct-jburet committed Jun 11, 2024
1 parent f716578 commit b8d6beb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class WhatsAppCloudApiClient(val secretKey: String, val token: String, val phone
@POST("v$VERSION/{phoneNumberId}/media")
fun uploadMediaInWhatsAppAccount(
@Path("phoneNumberId") phoneNumberId: String,
@Header("Authorization") headerValue: String,
@Body body: RequestBody
): Call<MediaResponse>

Expand Down Expand Up @@ -86,7 +87,7 @@ class WhatsAppCloudApiClient(val secretKey: String, val token: String, val phone
val graphApi: GraphApi = retrofitBuilderWithTimeoutAndLogger(
longProperty("tock_whatsappcloud_request_timeout_ms", 30000),
logger,
requestGZipEncoding = booleanProperty("tock_whatsappcloud_request_gzip", true)
requestGZipEncoding = booleanProperty("tock_whatsappcloud_request_gzip", false)
)
.baseUrl("https://graph.facebook.com")
.addJacksonConverter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class WhatsAppCloudApiService(private val apiClient: WhatsAppCloudApiClient) {

val media = apiClient.graphApi.uploadMediaInWhatsAppAccount(
phoneNumberId,
"Bearer $token",
MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file", "fileimage", file)
.addFormDataPart("messaging_product", "whatsapp")
Expand Down

0 comments on commit b8d6beb

Please sign in to comment.