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

send message type image #1690

Conversation

SNCFamiraBenkaci
Copy link
Contributor

@@ -302,6 +313,27 @@ class WhatsAppCloudApiService(private val apiClient: WhatsAppCloudApiClient) {
}
}

private fun replaceWithRealMassageImageId(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private fun replaceWithRealMassageImageId(
private fun replaceWithRealMessageImageId(

@@ -328,7 +340,7 @@ fun <T : Bus<T>> T.whatsAppCloudTextParameterTemplate(
typeParameter: CharSequence?,
textButton: CharSequence?
): TextParameter = TextParameter(
type = ParameterType.valueOf(translate(typeParameter).toString()),
type = ParameterType.valueOf((typeParameter).toString()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change is a duplicate of #1683


data class WhatsAppCloudSendBotImageMessage(
data class WhatsAppCloudSendBotImageMessage (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this extra space intended?

val image: WhatsAppCloudBotImage,
override val recipientType: WhatsAppCloudBotRecipientType,
override val to: String,
) : WhatsAppCloudSendBotMessage(WhatsAppCoudBotMessageType.image)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semi-related to this PR: this class name has a typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je ne pense pas

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WhatsAppCoudBotMessageType instead of WhatsAppCloudBotMessageType?


override fun toGenericMessage(): GenericMessage =
GenericMessage(
texts = mapOf(GenericMessage.TEXT_PARAM to "image"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GenericMessage class has a dedicated attachments field for this purpose, you can refer to WebModels#WebImage.toGenericMessage for an example:

fun WebImage.toGenericMessage(): GenericMessage {
return GenericMessage(
texts = mapNotNullValues(
GenericMessage.TITLE_PARAM to title.toString(),
),
attachments = listOf(Attachment(file.url, attachmentType(file.url)))
)
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this can be done in a future PR

fun BotBus.whatsAppCloudImage(
id: String,
link: String? = null,
caption: String? = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a CharSequence, so that we can translate it?

@SNCFamiraBenkaci SNCFamiraBenkaci force-pushed the 1689-add-send-message-image branch 2 times, most recently from d530156 to 667c11f Compare July 19, 2024 09:21
@vsct-jburet vsct-jburet self-requested a review August 20, 2024 16:58
@vsct-jburet vsct-jburet added this to the 24.3.5 milestone Aug 20, 2024
@vsct-jburet vsct-jburet merged commit e5f360c into theopenconversationkit:master Aug 20, 2024
morgandiverrez pushed a commit that referenced this pull request Aug 26, 2024
* send message type image

* send message type image

---------

Co-authored-by: BENKACI Amira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants