Partner APIs

Template Apis 6

Description

here you can create a template for a particular app. you will need below details to start using this api. 1. app Id 2. app token

Headers
Key Value Description
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
Key Value Description
elementName ticket_check_url_334 The name of a template. Element name is unique for a WABAs namespace.
languageCode en_US Language code for the template. Refer to all the language codes here.
category TRANSACTIONAL The category of your template. Possible Values: TRANSACTIONAL, MARKETING, and OTP.
templateType TEXT The type of template
vertical BUTTON_CHECK
content your ticket has been confirmed for {{1}} persons on date {{2}}. The body of the template. Character limit: 1028
header This is the header Header of the template. Applicable for templateType = Text Character limit: 60
footer This is the footer Footer of the template. Character limit: 60
buttons [{"type":"PHONE_NUMBER","text":"Call Us","phone_number":"+919872329959"},{"type":"URL","text":"Book A Demo","url":"https://bookins.gupshup.io/{{1}}","example":["https://bookins.gupshup.io/abc"]}] Used only if your template has a CTA. An example is also submitted if a URL button has variable parameter.
example your ticket has been confirmed for 4 persons on date 2020-05-04. An example of the template.
Sample Response

                {
                    "status": "success",
                    "template": {
                        "appId": "8372f7-a233-4aad-8f267-c232d81263",
                        "category": "ACCOUNT_UPDATE",
                        "createdOn": 1652768999707,
                        "data": "Hi, you Welcome to Header.\nHi, {{1}}. This is the template for header testing.\nHi, Welcome to Footer. | [call,917676767676] | [ur,https://www.fb.com]",
                        "elementName": "test_template12332",
                        "id": "fc05da-f2135-45e2-8sad4-dc4410ea",
                        "languageCode": "en",
                        "languagePolicy": "deterministic",
                        "master": true,
                        "meta": "{\"example\":\"Hi, [john]. This is the template for header testing.\"}",
                        "modifiedOn": 1652768999707,
                        "namespace": "efbf3_e5c4_42de_9803_2090d81b",
                        "status": "PENDING",
                        "templateType": "TEXT",
                        "vertical": "Header"
                    }
                }
            
Description

Using this API, you can create and submit a template along with a Sample Media. You will need below details to start using this API.

  1. App Id
  2. Partner App Token
  3. Handle Id

Headers
Key Value Description
token {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
Key Value Description
elementName ticket_check_url_334
languageCode en_US
content Your verification code is {{1}}.
footer This is the footer Footer of the template. Character limit: 60
category TRANSACTIONAL The category of your template. Possible Values: TRANSACTIONAL, MARKETING, and OTP.
templateType IMAGE
vertical Ticket update
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
example Your verification code is 213.
exampleMedia 4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg This is the handleId.
enableSample true
Sample Response

        {
        "status": "success",
        "template": {
            "category": "TICKET_UPDATE",
            "createdOn": 1634624637136,
            "data": "Your verification code is {{1}}.",
            "elementName": "verification_code_with_image_3",
            "id": "ae7ae44e-710c-495a-b011-648a775b2063",
            "languageCode": "en",
            "languagePolicy": "deterministic",
            "master": true,
            "meta": "{\"example\":\"Your verification code is 123.\"}",
            "modifiedOn": 1634624637136,
            "status": "PENDING",
            "templateType": "IMAGE",
            "vertical": "TICKET_UPDATE"
        }
        }
                                                            
Description

Using this API, you can upload your sample media and generate a handleId for it. Using the handleId, you can create and submit a template along with a sample media. The handleId is passed in the exampleMedia parameter of the Apply for templates with sample media API. You will need below details to start using this API.

  1. App Id
  2. Partner App Token

Headers
Key Value Description
Authorization {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
Key Value Description
file @"/C:/Users/Pictures/sample.png" Upload a file from your local machine.
file_type image/png
Sample Response

        {
        "handleId": {
        "message": "4::aW1hZ2UvcG5n:ARYY-6d3Nol2fC0RG7nG1d-Rie7-q4SeLZ0M_Fcffdkv7glkYgGa0IxKLc9DqlyuVIQD18KxYmgaEfuiUuQSdbYMpjce0jPgI59Q7hZVws5e5Q:e:1634970144:2281283925530161:100033655335566:ARYj6TLlB5Nu6A5KJaI"
        },
        "status": "success"
        }
                                                            
Description

This will provide you the list of templates for a particular app. You will also get the rejection reason for templates.
The following details are required to start using this API.

  1. app Id
  2. Partner app token


Headers
Key Value Description
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Sample Response

            {
                "status": "success",
                "templates": [
                    {
                        "category": "ISSUE_RESOLUTION",
                        "createdOn": 1635439783282,
                        "data": "Here is a sample video for your help.",
                        "elementName": "media_video_template2",
                        "id": "11ce423b-4d77-4a97-a5a0-aa91bdbde1f4",
                        "languageCode": "en",
                        "languagePolicy": "deterministic",
                        "master": true,
                        "meta": "{\"example\":\"Here is a sample video for your help.\"}",
                        "modifiedOn": 1638721806995,
                        "reason": "Template not submitted due to internal error. Try again",
                        "status": "REJECTED",
                        "templateType": "VIDEO",
                        "vertical": "ISSUE_RESOLUTION"
                    },
                    {
                        "category": "ACCOUNT_UPDATE",
                        "createdOn": 1630544236074,
                        "data": "Buen día, {{1}}. ✨En redes sociales es fundamental saber cómo transmitir mensajes a tus clientes. 🔊 👀\\\\nHoy aprenderás a mejorar la comunicación con tus clientes 💬 y conocerás una herramienta muy útil para este proceso: *WhatsApp Business*.\\\\n💡 Revisa la infografía que te compartimos en este mensaje para enterarte de más.",
                        "elementName": "digital_basico_m01_comunicacion_con_clientes_v1_doc",
                        "id": "1a6b3d02-948d-4040-b7d2-8a6092ae8d81",
                        "languageCode": "es",
                        "languagePolicy": "deterministic",
                        "master": true,
                        "meta": "{\"example\":\"Buen día, [Leo Q]. ✨En redes sociales es fundamental saber cómo transmitir mensajes a tus clientes. 🔊 👀\\\\\\\\nHoy aprenderás a mejorar la comunicación con tus clientes 💬 y conocerás una herramienta muy útil para este proceso: *WhatsApp Business*.\\\\\\\\n💡 Revisa la infografía que te compartimos en este mensaje para enterarte de más.\"}",
                        "modifiedOn": 1638721806995,
                        "reason": "Promotional Content",
                        "status": "REJECTED",
                        "templateType": "DOCUMENT",
                        "vertical": "comunicacion"
                    }
                ]
            }
                                                            
Headers
KeyValueDescription
Connection keep-alive
Authorization {{PARTNER_APP_TOKEN}}
URL Variables
KeyValueDescription
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
KeyValueDescription
source 918910567700
sandbox false
destination 918286836492
template {"id": "007b7c0e-fc8d-4698-a9a8-3938151dd5da","params": ["monday","2020-12-20","apps"]}
src.name GupshupDevAssistant01
Body


Sample Response
                                                                
        {
            "status": "submitted",
            "messageId": "bc856acb-3ca3-4ed3-9822-6443f52ea9ce"
        }
                                                                
                                                            
Description

Using this API, you can delete a template using the elementName for it. You will need below details to start using this API.
NOTE: This action is irreversible. Once a template has been deleted, it cannot be restored.

  1. App Id
  2. Partner App Token
  3. Element Name

Headers
Key Value Description
Authorization {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
elementName order_update
Sample Response

        {
            "status": "success"
        }
                                                            

Token Apis 2

Description

this api will provide the access token for accessing particular app. you can use this token to get app’s templates , submit templates, send messages etc. you will need below details to start using this api. 1. partner token

Headers
Key Value Description
token {{PARTNER_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body


Sample Response

            {
                "status": "success",
                "token": {
                    "active": true,
                    "authoriserId": "9e97650d-add3-4557-9535-4cdf47c3fa68",
                    "createdOn": 1607490531782,
                    "expiresOn": 0,
                    "modifiedOn": 1607490531782,
                    "requestorId": "1",
                    "token": "sk_61b3021c97214370b341f8baaae07b5a"
                }
            }
                                                            
Description

You have to first use this api to get the token, this will help you in accessing other apis. currently expirey for the token is 24 hours.

Body
Key Value Description
email shahsharad1111@gmail.com
password sharad
Sample Response

                {
                    "name": "Partner_Name",
                    "terms_read": true,
                    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjoiMSIsImlzwiZXhwIjoxNjA3Njc4MjUyLCJpYXQiOjE2MDc1OTE4NTJ9.EKQdBq4GLvV9adInkVgKgA30JE4ME0aA5Dyjs55rF6g"
                }
                                                            

Useful Apis 17

Headers
Key Value Description
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
Key Value Description
phone 918286836492
isBlocked true
Sample Response

    {
        "status": "success"
    }
    
Description

Using this API, you can enable or disable template messaging for an App. You will need below details to start using this API.

  1. App Id
  2. Partner App Token
Headers
Key Value Description
Content-Type application/x-www-form-urlencoded
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
Key Value Description
isHSMEnabled true Possible values: true or false
Sample Response
Status: 202 Accepted
Headers
KeyValueDescription
Connection keep-alive
Authorization {{PARTNER_APP_TOKEN}}
URL Variables
KeyValueDescription
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
KeyValueDescription
phone 918286836492
isBlocked true
Sample Response

    {
        "healthy": "true"
    }
    
Headers
Key Value Description
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
Query
Key Value Description
phone 918286831212
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body


Sample Response

    {
        "userStatus": {
            "active": false,
            "appId": "9e97650d-add3-4557-9535-4cdf47c3fa68",
            "blocked": true,
            "countryCode": "91",
            "dialCode": "8286836412",
            "phone": "918286836412",
            "status": "OPT_IN"
        }
    }
    
Headers
Key Value Description
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
URL Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body


Sample Response

    {
        "walletResponse": {
            "currency": "USD",
            "currentBalance": 295.6172,
            "overDraftLimit": 0
        }
    }
    
Description

This api will provide you the list of Apps which are linked to your account. Required parameter is only ‘partner token’. you will need app id and app access token in order to access app related apis and this api will help you get the id for the app.

Headers
Key Value Description
token {{PARTNER_TOKEN}}


Sample Response

    {
        "partnerAppsList": [
            {
                "createdOn": 1600398419731,
                "healthy": true,
                "id": "9e97650d-add3-4557-9535-4cdf47c3fa68",
                "live": true,
                "modifiedOn": 1602051341986,
                "name": "GupshupDevAssistant01",
                "partnerId": 0,
                "phone": "918910567700",
                "stopped": false
            }
        ]
    }
    
Description

Using this API, you can update the gupshup fee cap for an app


Headers
Key Value Description
Connection keep-alive
token {{PARTNER_APP_TOKEN}}
Path Variables
Key Value Description
appId 9e97650d-add3-4557-9535-4cdf47c3fa68
Body
Key Value Description
cap 100 Values supported between: 50 to 750
Sample Response

        {
            "status": "success"
        }
        
Description

Using this API you can get the inbound message logs for the specified duration.

Headers
Key Value Description
token {{PARTNER_TOKEN}}
Query parameters
KeyValueDescription
Id optional 9e97a0d-add3-4as557-1535-4cdf47c3fa68 Unique identifier for a message
appId optional as97850d-adad3-4557-1535-4cdf47c3asfa68 Unique identifier for an app
date 02-05-2022 date in DD-MM-YYYY format.
Note: Data only gets updated every day at 8am IST / 11.30pm Brazil time / 4.30am Zimbabwe time. Hence you will not get logs for current day.
start 1651500199740 The start time in EPOCH format. The difference between start and end time must be less than or equal to 10 minutes/ 600000 milliseconds.
end 1651500799740 The end time in EPOCH format


Sample Response

        {
            "eventList":[
            {
                "delay":56,
                "dest":"91832975XXXX",
                "endTime":1650525824281,
                "eventDescription":"Enqueued event sent to the Callback URL",
                "eventId":"569ca252-0e5b-42fb-b5e5-82270e243d",
                "source":"appname",
                "startTime":1650525824225
            }
            ]
        }
    
Description

Using this API you can get the outbound message logs for the specified date.

Headers
Key Value Description
token {{PARTNER_TOKEN}}
Query parameters
KeyValueDescription
Id optional 9e97a0d-add3-4as557-1535-4cdf47c3fa68 Unique identifier for a message
appId optional as97850d-adad3-4557-1535-4cdf47c3asfa68 Unique identifier for an app
date 02-05-2022 date in DD-MM-YYYY format.
Note: Data only gets updated every day at 8am IST / 11.30pm Brazil time / 4.30am Zimbabwe time. Hence you will not get logs for current day.


Sample Response

        {
            "eventList":[
            {
                "delay":3,
                "dest":"91991183XXXX",
                "endTime":1650524010311,
                "eventDescription":"Send message request received at Gupshup",
                "eventId":"3b506e13-d87d-482d-abc1-b8ac688b7c",
                "source":"91845XXXX087",
                "startTime":1650524010308
            },
            {
                "delay":16,
                "dest":"91991183XXXX",
                "endTime":1650524010340,
                "eventDescription":"Send message completed",
                "eventId":"3b506e13-d87d-482d-abc1-beb8ac688b7c",
                "source":"91845XXXX087",
                "startTime":1650524010324
            }
            ]
        }
    
Description

Using this API you can get the daily usage breakdown for a particular app ranging between two dates.

Headers
Key Value Description
token sk_19eew348befyg27057fa1ff999869f Partner app token
Query parameters
KeyValueDescription
from 2022-03-01 date in YYYY-MM-DD format.
to 2022-04-01 date in YYYY-MM-DD format.
Path Variables
KeyValueDescription
appId 832a9f7-aa33-4aad-8b67-c23d81263


Sample Response

        {
            "partnerAppUsageList":[
            {
                "appId":"8803nf3e5-f866-4c0e-80f6-69a43a1",
                "appName":"testapp",
                "bic":5,
                "date":"2022-03-02",
                "fep":2,
                "ftc":10,
                "gsFees":0,
                "incomingMsg":0,
                "outgoingMediaMsgSKU":0,
                "outgoingMsg":0,
                "templateMediaMsgSKU":0,
                "templateMsg":0,
                "totalFees":0,
                "totalMsg":0,
                "uic":10,
                "waFees":0
            },
            {
                "appId":"8803nf3e5-f866-4c0e-80f6-69a43a1",
                "appName":"testapp",
                "bic":0,
                "date":"2022-03-03",
                "fep":0,
                "ftc":1,
                "gsFees":0.003,
                "incomingMsg":1,
                "outgoingMediaMsgSKU":0,
                "outgoingMsg":2,
                "templateMediaMsgSKU":0,
                "templateMsg":0,
                "totalFees":0.003,
                "totalMsg":3,
                "uic":0,
                "waFees":0
            }
            ]
        }
    
Description

Using this API you can get the daily discount, daily bill, and the cumulative bill for a particular app ranging a month.

Headers
Key Value Description
token sk_19eew348befyg27057fa1ff999869f Partner app token
Query parameters
KeyValueDescription
year 2022 Year in YYYY format.
month 04 Month in MM format.
Path Variables
KeyValueDescription
appId 832a9f7-aa33-4aad-8b67-c23d81263


Sample Response

        {
            "dailyAppDiscountList":[
            {
                "appId":"8372adj7-a233-4aad-8b67-c23938247bf263",
                "cumulativeBill":0,
                "dailyBill":0,
                "day":2,
                "discount":0,
                "gsCap":75,
                "gsFees":0,
                "month":4,
                "partnerId":15,
                "year":2022
            },
            {
                "appId":"8372adj7-a233-4aad-8b67-c23938247bf263",
                "cumulativeBill":0.014,
                "dailyBill":0.014,
                "day":4,
                "discount":0,
                "gsCap":75,
                "gsFees":0.014,
                "month":4,
                "partnerId":15,
                "year":2022
            }
            ]
        }
    

Business Profile 7

Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "profile": {
                "address": "<address>",
                "profileEmail": "<emailId>",
                "desc": "<description>",
                "vertical": "<vertical>",
                "website1": "<website1>",
                "website2": "<website2>"
            },
            "status": "success"
        }
        
Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "about": {
                "message": "<about>"
            },
            "status": "success"
        }
        
Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "profile": {
                "address": "<address>",
                "profileEmail": "<emailId>",
                "desc": "<description>",
                "vertical": "<vertical>",
                "website1": "<website1>",
                "website2": "<website2>"
            },
            "status": "success"
        }
        
Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "about": {
                "message": "<about>"
            },
            "status": "success"
        }
        
Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "message": "<link>",
            "status": "success"
        }
        
Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "message": "profile picture updated successfully",
            "status": "success"
        }
        
Headers
KeyValueDescription
Authorization {{PARTNER_APP_TOKEN}}
Sample Response

        {
            "message": "profile photo deleted successfully",
            "status": "success"
        }