sales_code
Make a discount code for a post or video in the owner's connected store, with the store's default discount (set on the Sales page, 10% off unless changed), or register a code they already have (existing true: nothing is made in the store). Each order with the code counts for that post on the Sales page: on TikTok and Instagram, where captions have no clickable links, a code said in the video or written in the caption is the surest way to count sales. No credits. It creates a real discount in the merchant's store: use it only when the owner asks for a code, and say what it gives. Clients that can ask their user ask before it runs; otherwise get a clear yes first. Pass the post's "id" (list your posts) when the post exists. For a video not posted yet, leave postId out: the code is tied to the first post saved with it in its text. Without a code, a random one is made (prefix puts letters before it, e.g. the brand). Only workspace admins make codes in the app. A store that cannot make codes from Hookbird (a website with the pixel) takes existing codes only.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "sales_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | The code, 3 to 40 letters, digits, - or _ (default: a random one) | |
| postId | No | The "id" of the post the code is for (leave it out for a video not posted yet) | |
| prefix | No | Letters before a random code, e.g. the brand ("GLOW" gives GLOW7KQ2M) | |
| storeId | No | A store id from sales_overview (default: the first connected store that can make codes) | |
| existing | No | true: the code already exists in the store, it is only tied to the post |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| error | No | ||
| store | No | ||
| postId | No | ||
| existing | No |