Skip to content

Commit

Permalink
resolves theopenconversationkit#1630 [Whatsapp cloud Connector] fix o…
Browse files Browse the repository at this point in the history
…n Load profile + handleInteractiveMessage
  • Loading branch information
charles_moulhaud committed Jun 14, 2024
1 parent 0d92962 commit 4acd3bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,4 @@ class WhatsAppConnectorCloudConnector internal constructor(
}
}
}

override fun loadProfile(callback: ConnectorCallback, userId: PlayerId): UserPreferences = UserPreferences()
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,21 @@ class WhatsAppCloudApiService(private val apiClient: WhatsAppCloudApiClient) {
token: String,
messageRequest: WhatsAppCloudSendBotInteractiveMessage
) {
messageRequest.interactive.action?.buttons?.let { buttons ->
val updateButtons = buttons.map { button ->
updateButton(button)
messageRequest.interactive.action?.let { action ->
if (!action.buttons.isNullOrEmpty()) {
val updateButtons = action.buttons.map { button ->
updateButton(button)
}
sendUpdatedInteractiveMessage(phoneNumberId, token, messageRequest, updateButtons)
} else {
send(messageRequest) {
apiClient.graphApi.sendMessage(
phoneNumberId,
token,
messageRequest
).execute()
}
}
sendUpdatedInteractiveMessage(phoneNumberId, token, messageRequest, updateButtons)
}
}

Expand Down Expand Up @@ -348,4 +358,4 @@ class WhatsAppCloudApiService(private val apiClient: WhatsAppCloudApiClient) {
}
}

private const val IMAGE_ID_CACHE = "whatsapp_image_id_cache"
private const val IMAGE_ID_CACHE = "whatsapp_image_id_cache"

0 comments on commit 4acd3bb

Please sign in to comment.