krypton-byte / neonize

whatsapp automation library, written in python
http://krypton-byte.me/neonize/
Apache License 2.0
47 stars 11 forks source link

button message #31

Closed brutalX-04 closed 1 week ago

brutalX-04 commented 1 week ago

gimana cara buat button message bang

krypton-byte commented 1 week ago

cek https://github.com/krypton-byte/neonize/blob/master/examples/basic.py#L232

client.send_message(
                message.Info.MessageSource.Chat,
                Message(
                    viewOnceMessage=FutureProofMessage(
                        message=Message(
                            messageContextInfo=MessageContextInfo(
                                deviceListMetadata=DeviceListMetadata(),
                                deviceListMetadataVersion=2,
                            ),
                            interactiveMessage=InteractiveMessage(
                                body=InteractiveMessage.Body(text="Body Message"),
                                footer=InteractiveMessage.Footer(text="@krypton-byte"),
                                header=InteractiveMessage.Header(
                                    title="Title Message",
                                    subtitle="Subtitle Message",
                                    hasMediaAttachment=False,
                                ),
                                nativeFlowMessage=InteractiveMessage.NativeFlowMessage(
                                    buttons=[
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="single_select",
                                            buttonParamsJSON='{"title":"List Buttons","sections":[{"title":"title","highlight_label":"label","rows":[{"header":"header","title":"title","description":"description","id":"select 1"},{"header":"header","title":"title","description":"description","id":"select 2"}]}]}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="quick_reply",
                                            buttonParamsJSON='{"display_text":"Quick URL","url":"https://www.google.com","merchant_url":"https://www.google.com"}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="cta_call",
                                            buttonParamsJSON='{"display_text":"Quick Call","id":"message"}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="cta_copy",
                                            buttonParamsJSON='{"display_text":"Quick Copy","id":"123456789","copy_code":"message"}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="cta_remainder",
                                            buttonParamsJSON='{"display_text":"Reminder","id":"message"}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="cta_cancel_remainder",
                                            buttonParamsJSON='{"display_text":"Cancel Reminder","id":"message"}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="address_message",
                                            buttonParamsJSON='{"display_text":"Address","id":"message"}',
                                        ),
                                        InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                                            name="send_location", buttonParamsJSON=""
                                        ),
                                    ]
                                ),
                            ),
                        )
                    )
                ),
            )
brutalX-04 commented 1 week ago

mantep bang makasih banyak

galihmrd commented 1 week ago

Kalo buat nambahin tombol ke media message gimana bang?

brutalX-04 commented 1 week ago

Kalo buat nambahin tombol ke media message gimana bang?

contoh untuk image, hasil ngulik sendiri, mungkin ada cara yang lebih bagus


client.send_message(
  message.Info.MessageSource.Chat,
  Message(
      viewOnceMessage=FutureProofMessage(
          message=Message(
              messageContextInfo=MessageContextInfo(
                  deviceListMetadata=DeviceListMetadata(),
                  deviceListMetadataVersion=2,
              ),
              interactiveMessage=InteractiveMessage(
                  body=InteractiveMessage.Body(text="Body Message"),
                  footer=InteractiveMessage.Footer(text="@brutalx-04"),
                  header=InteractiveMessage.Header(
                      title="Title Message",
                      subtitle="Subtitle Message",
                      hasMediaAttachment=True,
                      imageMessage=client.build_image_message("src/image/bg.jpg").imageMessage
                  ),
                  nativeFlowMessage=InteractiveMessage.NativeFlowMessage(
                      buttons=[
                          InteractiveMessage.NativeFlowMessage.NativeFlowButton(
                              name="cta_url",
                              buttonParamsJSON='{"display_text":"Profile","url":"https://profile.brutalx.my.id","merchant_url":"https://profile.brutalx.my.id"}',
                          )
                      ]
                  ),
              ),
          )
      )
  ),
  )
galihmrd commented 1 week ago

Makasih banyak bang