Build message components with ease using the Wapi.go SDK
Wapi.go SDK provides a simaple and easy to use classes architecture to build message components. You can build message component of following types using the Wapi.go SDK:
In all the media messages which includes image, document, audio, video and sticker, either we will have to use the Id of media, or a publicly accessible hosted media Url.
With the rapidly changing whatsapp business platform features and offerings, we try our best to be in sync with the new features provided by the API. If you think we are missing upon any of the available type of message support. You can open a github issue here or direclty contact the maintainer of the project.
Image message is a message component that you can use to send images to a user. You can create a image message using the following code:
Copy
import { ImageMessage } from '@wapijs/Wapi.go'const imageMessage = new ImageMessage({ link: 'https://example.com/image.jpg', caption: 'This is a caption for the image.'})
Video message is a message component that you can use to send videos to a user. You can create a video message using the following code:
Copy
import { VideoMessage } from '@wapijs/Wapi.go'const videoMessage = new VideoMessage({ link: 'https://example.com/video.mp4', caption: 'This is a caption for the video.'})
Document message is a message component that you can use to send documents to a user. You can create a document message using the following code:
Copy
import { DocumentMessage } from '@wapijs/Wapi.go'const documentMessage = new DocumentMessage({ link: 'https://example.com/image.jpg', caption: 'This is a caption for the image.'})
Contact message is a message component that you can use to send contact details to a user. You can create a contact message using the following code:
In order to build a contact message, you need to use multiple classes provided to build, multiple components ofq the contact message. Now this has been done for ease of use and to provide a more structured way to build the contact message.
Product message is a message component that you can use to send a product to a user. You can create a product message using the following code:
Copy
import { ProductMessage } from '@wapijs/Wapi.go'const productMessage = new ProductMessage({ bodyText: 'Hii, I am a product.', buttonText: 'Buy', catalogId: '123', productRetailerId: '123', footerText: 'Beta version',})
Product List message is a message component that you can use to send a list of products to a user. You can create a product list message using the following code: