Edit Template

Use this API to edit a template using templateId.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
📘

**Note:**Updating carousel templates with Media is not permitted

You will need the below details to start using this API.

  1. App Id
  2. Template Id

Parameters

KeyDescriptionRequired/OptionalTypeValue
AuthorizationAccess Token for the applicationRequiredString{{PARTNER_APP_TOKEN}}
appIdUnique identifier of the Gupshup appRequiredString{{APP_ID}}
templateIdUnique identifier for a template, refer Get templates apiRequiredStringfc05da-f2135-45e2-8sad4-dc44xxxx
contentTEXT: The body of the template. Character limit: 1028OptionalStringyour ticket has been confirmed for {{1}} persons on date {{2}}.
templateTypeThe type of template: TEXT, IMAGE, VIDEO & DOCUMENTOptionalStringTEXT
exampleTEXT - An example of the template.OptionalStringyour ticket has been confirmed for 4 persons on date 2020-05-04
enableSampleBOOLEAN: True or False. Required for creating all types of templates.OptionalBooleantrue
headerHeader of the template. Applicable for templateType = Text Character limit: 60OptionalStringThis is the header
footerFooter of the template. Character limit: 60OptionalStringThis is the footer
buttonsUsed only if your template has a CTA. An example is also submitted if a URL button has variable parameter.OptionalString{"type":"PHONE_NUMBER","text":"Call Us","phone_number":"+xxxxxxxxxxx"},{"type":"URL","text":"Book A Demo","url":"[https://bookins.gupshup.io/{{1}}","example":["https://bookins.gupshup.io/abc"]}]
exampleMediaGet handleId from hereOptionalString4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg
mediaIdMedia IDOptionalStringTEXT
mediaUrlMedia URLOptionalStringTEXT
categoryUse category from these option AUTHENTICATION, MARKETING, UTILITY in description.OptionalStringAUTHENTICATION

Sample Request

curl --location --request PUT 'https://partner.gupshup.io/partner/app/{{APP_ID}}/templates/{{TEMPLATE_ID}}' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'content={{CONTENT}}' \
--data-urlencode 'category={{TEMPLATE_CATEGORY}}' \
--data-urlencode 'templateType={{TEMPLATE_TYPE}}' \
--data-urlencode 'example={{EXAMPLE}}' \
--data-urlencode 'exampleMedia={{EXAMPLE_MEDIA}}' \
--data-urlencode 'header={{TEMPLATE_HEADER}}' \
--data-urlencode 'footer={{TEMPLATE_FOOTER}}' \
--data-urlencode 'buttons={{TEMPLATE_BUTTON}}' \
--data-urlencode 'mediaId={{MEDIA_ID}}' \
--data-urlencode 'exampleHeader={{EXAMPLE_HEADER}}'

Sample Response

  {
    "status": "success"
  }           

Status Codes

Status CodeResponseComments
Success
200{ "id": "460001903531489", "preview": { "expires_at": "2024-09-08T13:45:06+0000", "preview_url": "https://business.facebook.com/wa/manage/flows/460001903531489/preview/?token=a926bc93-ce7f-465e-9c61-60800e9befab" }, "status": "success" }
Error
400{ "status":"error", "message":"No Template found for given id" }
Template does not exist for the provided templateId.


Passkey authentication templates

🔑

Passkey templates
A passkey template is an AUTHENTICATION + TEXT template whose only button is [{"type":"PASSKEY"}]. It lets a user confirm a sign-in with their device screen lock instead of an OTP. Editing one has extra rules.

Rules when editing a passkey template

  • Only a template in APPROVED, REJECTED or PAUSED state can be edited (a PENDING one returns 400).
  • category=AUTHENTICATION must be sent on every edit. Without it the request is not treated as AUTHENTICATION and the passkey-button rule rejects it.
  • The body, example and footer can be changed. A successful edit returns 202 and the template goes back to PENDING.
  • A header cannot be added.
  • The PASSKEY button cannot be changed to another type: the edit returns success but the button stays PASSKEY (the change is ignored).
  • Authentication: a Partner App token, a Universal Token (UT), or a Universal App Token (UAT).

Sample Request (passkey)

curl --location --request PUT 'https://partner.gupshup.io/partner/app/{{APP_ID}}/templates/{{TEMPLATE_ID}}' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'category=AUTHENTICATION' \
--data-urlencode 'templateType=TEXT' \
--data-urlencode 'content=Hi {{1}}, confirm this sign-in by tapping Verify.' \
--data-urlencode 'example=Hi Leo, confirm this sign-in by tapping Verify.' \
--data-urlencode 'buttons=[{"type":"PASSKEY"}]'

Status Codes (passkey)

Status CodeResponseComments
202{ "status": "success" }Edit accepted; template returns to PENDING
400{ "status": "error", "message": "Only Rejected, Approved and Paused templates can be edited" }The template is PENDING
400{ "status": "error", "message": "PASSKEY button is allowed only in AUTHENTICATION templates." }category was not sent
400{ "status": "error", "message": "Header is not allowed with PASSKEY button." }A header was added
Path Params
string
required
string
required
Form Data
string
string
string
boolean
boolean
string
string
integer
boolean
string
string
string
string
string
string
Headers
string
Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here!