1"use strict";(self.webpackChunkdocs_clientxcms_com=self.webpackChunkdocs_clientxcms_com||[]).push([[1621],{29020:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>a,frontMatter:()=>d,metadata:()=>i,toc:()=>o});const i=JSON.parse('{"id":"extensions/addons/discordgift","title":"Discord Gifts","description":"This page explains step by step how to configure, use, and customize the Discord Gifts addon for ClientXCMS.","source":"@site/docs/extensions/addons/discordgift.md","sourceDirName":"extensions/addons","slug":"/extensions/addons/discordgift","permalink":"/extensions/addons/discordgift","draft":false,"unlisted":false,"editUrl":"https://github.com/ClientXCMS/docs.clientxcms.com/blob/V2/docs/extensions/addons/discordgift.md","tags":[],"version":"current","frontMatter":{"translated":true},"sidebar":"defaultSidebar","previous":{"title":"Customer Reviews","permalink":"/extensions/addons/customers_reviews"},"next":{"title":"Discord Synchronization","permalink":"/extensions/addons/discordlink"}}');var t=s(74848),r=s(28453);const d={translated:!0},c="Discord Gifts",l={},o=[{value:"1. General Principle",id:"1-general-principle",level:2},{value:"2. Prerequisites",id:"2-prerequisites",level:2},{value:"3. Creating the Discord Webhook",id:"3-creating-the-discord-webhook",level:2},{value:"4. Main Settings",id:"4-main-settings",level:2},{value:"5. Webhook Messages",id:"5-webhook-messages",level:2},{value:"5.1 Available Placeholders",id:"51-available-placeholders",level:3},{value:"5.2 Example: <strong>Start Message</strong>",id:"52-example-start-message",level:3},{value:"5.3 Example: <strong>Usage Message</strong>",id:"53-example-usage-message",level:3},{value:"5.4 Example: <strong>End Message</strong>",id:"54-example-end-message",level:3},{value:"6. Dashboard & Graph",id:"6-dashboard--graph",level:2},{value:"7. Best Practices",id:"7-best-practices",level:2}];function h(e){const n={a:"a",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"discord-gifts",children:"Discord Gifts"})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["This page explains step by step how to configure, use, and customize the ",(0,t.jsx)(n.strong,{children:"Discord Gifts"}),' addon for ClientXCMS.\nObjective: automate "Discord gifts" (random credits) sent to your users via a unique code, all driven by Webhook.']}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"1-general-principle",children:"1. General Principle"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"Scheduling"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"You define a time slot (activation duration & delay before the next gift)."}),"\n",(0,t.jsxs)(n.li,{children:["A unique code (e.g., ",(0,t.jsx)(n.code,{children:"CC-PZCRYGZ3"}),") is generated and shared on your Discord server."]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"Distribution"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Each user can use the code ",(0,t.jsx)(n.strong,{children:"only once"})," from the client area (or API)."]}),"\n",(0,t.jsxs)(n.li,{children:["The credited amount is random between a ",(0,t.jsx)(n.strong,{children:"minimum"})," and ",(0,t.jsx)(n.strong,{children:"maximum"})," that you set."]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"Notification"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:"The addon automatically sends one or more Webhook messages:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.em,{children:"Start"}),": gift announcement."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.em,{children:"Usage"}),": when a member uses the code."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.em,{children:"End"}),": when there are no more possible uses or upon expiration."]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"Tracking"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"A graph in the admin panel tracks uses over the last 30 launches."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"2-prerequisites",children:"2. Prerequisites"}
1),"\n",(0,t.jsx)(n.p,{children:'Once the extension is activated, you can access the addon configuration in Admin Panel > Settings > "Customization" Section > "Discord Gifts"'}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Element"}),(0,t.jsx)(n.th,{children:"Version / Detail"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"Dependencies"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.a,{href:"https://clientxcms.com/marketplace/giftcard",children:(0,t.jsx)(n.strong,{children:"Gift Cards"})})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"Add-on"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.a,{href:"https://clientxcms.com/marketplace/discordgift",children:(0,t.jsx)(n.strong,{children:"Discord Gift"})})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"Discord"}),(0,t.jsx)(n.td,{children:'"Manage Webhooks" permissions on the target channel'})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"User Role"}),(0,t.jsx)(n.td,{children:"Must have authorization to use gift codes (default setting)"})]})]})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"3-creating-the-discord-webhook",children:"3. Creating the Discord Webhook"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:"Open the Discord channel where you want to publish the announcement."}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsxs)(n.strong,{children:["Edit Channel \u2192 Integrations \u2192 Webhooks \u2192 ",(0,t.jsx)(n.em,{children:"New Webhook"})]}),"."]}),"\n",(0,t.jsxs)(n.li,{children:["Copy the provided URL (",(0,t.jsx)(n.code,{children:"https://discord.com/api/webhooks/{id}/{token}"}),")."]}),"\n",(0,t.jsxs)(n.li,{children:["Paste it in the ",(0,t.jsx)(n.strong,{children:"Discord Webhook URL"})," field (see \xa7 4)."]}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"4-main-settings",children:"4. Main Settings"}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Field Name"}),(0,t.jsx)(n.th,{children:"Function"}),(0,t.jsx)(n.th,{children:"Example"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Discord Webhook URL"})}),(0,t.jsx)(n.td,{children:"URL copied in the previous step"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"https://discord.com/api/webhooks/13940089/\u2026"})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Minimum amount given"})}),(0,t.jsx)(n.td,{children:"Lowest credit (in cents)"}),(0,t.jsxs)(n.td,{children:[(0,t.jsx)(n.code,{children:"1000"})," \u2192 \u20ac10"]})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Maximum amount given"})}),(0,t.jsx)(n.td,{children:"Highest credit (in cents)"}),(0,t.jsxs)(n.td,{children:[(0,t.jsx)(n.code,{children:"5000"})," \u2192 \u20ac50"]})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Hours between gifts"})}),(0,t.jsx)(n.td,{children:"Interval before the next automatic launch"}),(0,t.jsxs)(n.td,{children:[(0,t.jsx)(n.code,{children:"1"})," = 1 hr"]})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Expiration (in minutes)"})}),(0,t.jsx)(n.td,{children:"Duration during which the code remains valid"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"65"})})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Maximum number of uses"})}),(0,t.jsx)(n.td,{children:"Number of people who can use the code"}),(0,t.jsxs)(n.td,{children:[(0,t.jsx)(n.code,{children:"1"})," or ",(0,t.jsx)(n.code,{children:"\u221e"})]})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Show timer on client area"})}),(0,t.jsx)(n.td,{children:"Countdown bar visible to customers"}),(0,t.jsx)(n.td,{children:"\u2705 / \u274c"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.strong,{children:"Next Discord gift defined"})}),(0,t.jsx)(n.td,{children:"UTC date/time of next launch (editable)"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"2025-07-16 01:11:00"})})]})]})]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["\u2139\ufe0f ",(0,t.jsx)(n.em,{children:"Amounts are stored in cents to avoid decimals (ClientXCMS convention)"}),"."]}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"5-webhook-messages",children:"5. Webhook Messages"}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.img,{alt:"img",src:s(46574).A+"",width:"596",height:"390"})}),"\n",(0,t.jsx)(n.p,{children:"Each event can trigger a customized JSON:"}),"\n",(0,t.jsx)(n.h3,{id:"51-available-placeholders",children:"5.
11 Available Placeholders"}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Placeholder"}),(0,t.jsx)(n.th,{children:"Replaced by\u2026"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"%code%"})}),(0,t.jsx)(n.td,{children:"Current gift code"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"%amount%"})}),(0,t.jsx)(n.td,{children:"Credited amount (formatted)"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsxs)(n.td,{children:[(0,t.jsx)(n.code,{children:"%min%"})," / ",(0,t.jsx)(n.code,{children:"%max%"})]}),(0,t.jsx)(n.td,{children:"Min / Max values"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"%time%"})}),(0,t.jsx)(n.td,{children:"Time before expiration (minutes)"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"%count%"})}),(0,t.jsx)(n.td,{children:"Remaining uses"})]})]})]}),"\n",(0,t.jsxs)(n.h3,{id:"52-example-start-message",children:["5.2 Example: ",(0,t.jsx)(n.strong,{children:"Start Message"})]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "content": null,\n "embeds": [\n {\n "title": "Discord Gifts Starting",\n "description": "Good news! You have %time% minutes to claim between %min%\u20ac and %max%\u20ac in credit with code `%code%`! Attention, there are only %count% possible uses!",\n "color": 5814783\n }\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"53-example-usage-message",children:["5.3 Example: ",(0,t.jsx)(n.strong,{children:"Usage Message"})]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "content": null,\n "embeds": [\n {\n "title": "Discord Gift Used",\n "description": "A Discord gift has been used! Code `%code%` was used by a user for **%amount%\u20ac** credits! (%count% uses remaining)",\n "color": 5814783\n }\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"54-example-end-message",children:["5.4 Example: ",(0,t.jsx)(n.strong,{children:"End Message"})]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "content": null,\n "embeds": [\n {\n "title": "Discord Gifts Ended",\n "description": "Discord gifts are over! Thank you all for participating! A new event will be launched soon!",\n "color": 5814783\n }\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:'You can uncheck "Trigger at start / at end / on usage" according to your needs.'}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"6-dashboard--graph",children:"6. Dashboard & Graph"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Usage Graph"}),"\nDisplays the number of uses (green dots) for each of the last 30 launches. Useful for tracking engagement and adjusting gift value or frequency.\n",(0,t.jsx)(n.img,{alt:"img",src:s(2641).A+"",width:"877",height:"303"})]}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:["\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Settings Section"}),"\nAll fields are reactive; clicking ",(0,t.jsx)(n.strong,{children:"Save"})," immediately applies the new values and updates the scheduling.\n",(0,t.jsx)(n.img,{alt:"img",src:s(96338).A+"",width:"1084",height:"950"})]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"7-best-practices",children:"7. Best Practices"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Limit amounts"}),": set a reasonable max to avoid accidentally high credits."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Dedicated Webhook"}),": create a Webhook specific to the addon to avoid mixing with other integrations."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Test on a private channel"}),": before the first public launch, verify your messages in a staff-only channel."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Multiple uses"}),": if you set ",(0,t.jsx)(n.code,{children:"Maximum number of uses > 1"}),", clearly inform the community to avoid misunderstandings."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"Logs"}),": coupled with the billing module, each use is logged for complete auditing.\n|"]}),"\n"]})]})}function a(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(h,{...e})}):h(e)}},96338:(e,n,s)=>{s.d(n,{A:()=>i});const i=s.p+"assets/images/discordgift_admin_config-9a513e228a7307f277da91286a294744.png"},2641:(e,n,s)=>{s.d(n,{A:()=>i});const i=s.p+"assets/images/discordgift_graph_utilisations-170ae27ef2201b6daa1b03bcdd07efa1.png"},46574:(e,n,s)=>{s.d(n,{A:()=>i});const i=s.p+"assets/images/discordgift_webhooks-3e5bcc469d6a243e16ca85f2a9219fab.png"},28453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>c});var i=s(96540);const t={},r=i.createContext(t);function d(e){const n=i.useContext(r);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:d(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.