Enhancing Customer Engagement: Exploring Gupshup API Integration for Effective Messaging

Jitendra Kumar
Engineering @ Housing/Proptiger/Makaan
4 min readJun 12, 2024

Introduction

In today’s world, effective communication plays an important role in the success of businesses and organizations. With the rise of mobile devices and messaging, businesses continue to find new ways to connect and interact with customers. Gupshup is an interactive platform that provides a powerful API that allows businesses to connect resources in their applications, websites or systems. In this blog, we will explore the advantages and steps of integrating the Gupshup API to better communicate with our customers.

What is Gupshup API?

The Gupshup API is a set of tools and resources that allow developers to integrate messaging into their own applications. SMS messages, WhatsApp messages and Facebook Messenger etc. other social media apps have great features like sending and receiving. With the Gupshup API, businesses can harness the power of messaging to improve the customer experience, increase operational efficiency and drive business growth. Gupshup’s WhatsApp Business API allows businesses to message and communicate with WhatsApp users.

Before getting into the detail integration of gupshup api, we need one more step. we need a whatsapp bussiness account that need to be linked the gupshup account.

To link a WhatsApp Business account with Gupshup, you can follow the steps outlined below:

  1. Create a WhatsApp Business Account: First, you need to create a WhatsApp Business account for your business or organization. You can download the WhatsApp Business app from the Google Play Store or Apple App Store and follow the registration process to create your account.
  2. Sign up for Gupshup API: Visit the Gupshup website (www.gupshup.io) and sign up for an account. Choose the appropriate plan and subscription based on your business requirements.
  3. Request WhatsApp Business API Access: Once you have signed up for Gupshup, you need to request access to the WhatsApp Business API. This step involves providing necessary information about your business, such as its name, website, and the number of messages you anticipate sending per month.
  4. Wait for WhatsApp Approval: After submitting the request for WhatsApp Business API access, you will need to wait for WhatsApp’s approval. This process may take some time, as WhatsApp reviews and approves requests based on their policies and guidelines.
  5. Verify the WhatsApp Business Account: Once your request is approved by WhatsApp, you will receive verification details. Follow the instructions provided to verify your WhatsApp Business account. This step typically involves associating your phone number with your WhatsApp Business account and verifying it using a verification code.
  6. Complete Gupshup’s WhatsApp Integration Process: After the verification process, you can proceed with Gupshup’s WhatsApp integration. Gupshup provides a set of APIs and tools to facilitate WhatsApp Business account integration.

Once the integration of bussiness whatsapp account with gupshup account is done. after integration you will have 3 important gupshup credentials (username, password and another password for template creation which we will be using later in the blog ) . now we are good to go ahead with these credentials :

  1. Log in to gupshup account with username and password.
  2. First step is to create a whatsapp message template. this is the template which user will be using to trigger the message on whatsapp.
  3. To create the template, click on create under Message Templates tab and fill the require details according to your usecase.
sample template creation preview

4. Once you have created the template, whatsapp will verify the message template that you have created so you have to wait for few minutes (about 2 to 3 minutes).

5. Opt-in a User : To send business-initiated messages (Notifications) to a user on WhatsApp, you must first collect the user’s explicit consent to send such notifications on WhatsApp and then call the Gupshup Messaging API using the OPT_IN API method to mark the user as ‘Opt-In’.

API Endpoint
To mark a user as Opt-in, the API request is made to this endpoint:

https://media.smsgupshup.com/GatewayAPI/rest

Simple request :
Below is a sample GET request to mark a user with whatsapp number 9711111111 as Opt-In:

https://media.smsgupshup.com/GatewayAPI/rest?userid=<USERID>&password=<GUPSHUP_PASSWORD>&phone_number=9711111111&method=OPT_IN&auth_scheme=plain&channel=WHATSAPP&format=json&v=1.1

Note : All query params are required in above api except format.

6. Test and Deploy: Before deploying the integration, thoroughly test the messaging functionality to ensure everything is working as expected. Send and receive test messages, check for any errors or inconsistencies, and make necessary adjustments if required.

Steps for testing :

Go to List under Message Templates tab on gupshup dashboard.

Search your template that you wanna test. click on Test this template button.

Enter your password, provide values for variables if any in message template and provide the whatsapp mobile number of opt-in user and click send button.

If everything goes well, your message will be sent to opt-in user successfully. now you are ready to integrate the whatsapp to your app.

sample image for template testing

Start Messaging: Once your integration is tested and functioning correctly, you can start using your WhatsApp Business account via Gupshup to send and receive messages. Leverage Gupshup’s API features to enhance customer engagement, automate communication processes, and leverage the power of WhatsApp Business for your business needs.

Simple request to trigger message :

Below is a sample GET request when sending a text message on WhatsApp

https://media.smsgupshup.com/GatewayAPI/rest?userid=<USERID>&password=<GUPSHUP_PASSWORD>&phone_number=9711111111&method=OPT_IN&auth_scheme=plain&channel=WHATSAPP&format=json&v=1.1

There are more than just sending the plain text but for blog i have only shown the example of plain text message.

Note : Remember to refer to the official documentation and guidelines provided by both Gupshup and WhatsApp for the most up-to-date and accurate instructions on linking your WhatsApp Business account with Gupshup.

Conclusion : In this way anyone can integrate the gupshup into their applications easily by following above steps and enhance their user engagement and expand their reach to maximum end-users.

--

--