[{"data":1,"prerenderedAt":1791},["ShallowReactive",2],{"docs.navigation":3,"docs.content.sdk":317,"docs.section.bots":1774,"docs.prevnext.sdk":1788},[4,46,100,137,171,232,239,258,275,292],{"id":5,"title":6,"position":7,"children":8},32,"Introduction",0,[9,13,17,22,27,32,36,41],{"id":10,"title":6,"slug":11,"position":7,"directory":12},34,"getting-started","introduction",{"id":14,"title":15,"slug":16,"position":7,"directory":12},35,"Quickstart guide","quickstart-guide",{"id":18,"title":19,"slug":20,"position":21,"directory":12},37,"What is a bot?","what-is-a-bot",3,{"id":23,"title":24,"slug":25,"position":26,"directory":12},39,"What is a data source?","what-is-a-data-source",4,{"id":28,"title":29,"slug":30,"position":31,"directory":12},38,"What is a channel?","what-is-a-channel",6,{"id":33,"title":34,"slug":35,"position":31,"directory":12},40,"What is a power-up?","what-is-a-power-up",{"id":37,"title":38,"slug":39,"position":40,"directory":12},33,"FAQ","faq",7,{"id":42,"title":43,"slug":44,"position":45,"directory":12},36,"Troubleshooting","troubleshooting",8,{"id":7,"title":47,"position":48,"children":49},"Bots",1,[50,54,58,62,66,70,74,77,81,84,87,92,96],{"id":21,"title":51,"slug":52,"position":7,"directory":53},"Bot advanced settings","bot-advanced-settings","bots",{"id":55,"title":56,"slug":57,"position":48,"directory":53},10,"Prompt engineering tips","prompt-engineering-tips",{"id":59,"title":60,"slug":61,"position":59,"directory":53},2,"Available models","available-models",{"id":63,"title":64,"slug":65,"position":21,"directory":53},13,"Widget customisation","widget-customisation",{"id":67,"title":68,"slug":69,"position":26,"directory":53},12,"Webhooks","webhooks",{"id":71,"title":72,"slug":73,"position":71,"directory":53},5,"Custom domains","custom-domains",{"id":26,"title":75,"slug":76,"position":31,"directory":53},"Bot testing","bot-testing",{"id":78,"title":79,"slug":80,"position":31,"directory":53},11,"SDK","sdk",{"id":40,"title":82,"slug":83,"position":40,"directory":53},"Human takeover","human-takeover",{"id":31,"title":85,"slug":86,"position":55,"directory":53},"Duplicating bots","duplicating-bots",{"id":88,"title":89,"slug":90,"position":91,"directory":53},9,"My Chats","my-chats",15,{"id":48,"title":93,"slug":94,"position":95,"directory":53},"Analytics","analytics",16,{"id":45,"title":97,"slug":98,"position":99,"directory":53},"Lead capture","lead-capture",20,{"id":101,"title":102,"position":59,"children":103},23,"Data sources",[104,109,113,117,121,125,129,133],{"id":105,"title":106,"slug":107,"position":7,"directory":108},25,"File","file-data-source","data-sources",{"id":110,"title":111,"slug":112,"position":7,"directory":108},28,"Notion","notion-data-source",{"id":114,"title":115,"slug":116,"position":59,"directory":108},30,"Website","website-data-source",{"id":118,"title":119,"slug":120,"position":21,"directory":108},31,"YouTube","youtube-data-source",{"id":122,"title":123,"slug":124,"position":26,"directory":108},29,"RSS","rss-data-source",{"id":126,"title":127,"slug":128,"position":71,"directory":108},27,"Manual","manual-data-source",{"id":130,"title":131,"slug":132,"position":88,"directory":108},24,"Data source best practices","data-source-best-practices",{"id":134,"title":135,"slug":136,"position":55,"directory":108},26,"Keeping your bot up to date","keeping-your-bot-up-to-date",{"id":138,"title":139,"position":26,"children":140},14,"Channels",[141,146,150,154,157,160,164,167],{"id":142,"title":143,"slug":144,"position":7,"directory":145},21,"Web","web-channel","channels",{"id":147,"title":148,"slug":149,"position":48,"directory":145},18,"Slack","slack-bot-channel",{"id":151,"title":152,"slug":153,"position":48,"directory":145},19,"Slack (V1 Deprecated)","slack-channel",{"id":95,"title":155,"slug":156,"position":59,"directory":145},"Discord","discord-channel",{"id":99,"title":158,"slug":159,"position":21,"directory":145},"Telegram","telegram-channel",{"id":161,"title":162,"slug":163,"position":26,"directory":145},22,"WhatsApp","whatsapp-channel",{"id":91,"title":165,"slug":166,"position":71,"directory":145},"API","api-channel",{"id":168,"title":169,"slug":170,"position":45,"directory":145},17,"Email","email-channel",{"id":172,"title":173,"position":26,"children":174},47,"Power-ups",[175,180,184,188,192,196,200,204,208,212,216,220,224,228],{"id":176,"title":177,"slug":178,"position":7,"directory":179},49,"Browse Webpage Power-up","browse-webpage-power-up","power-ups",{"id":181,"title":182,"slug":183,"position":7,"directory":179},53,"Google Search Power-up","google-search-power-up",{"id":185,"title":186,"slug":187,"position":7,"directory":179},55,"Power-up basics","power-up-basics",{"id":189,"title":190,"slug":191,"position":7,"directory":179},60,"Use API Power-up","use-api-power-up",{"id":193,"title":194,"slug":195,"position":48,"directory":179},61,"Zapier Power-up","zapier-power-up",{"id":197,"title":198,"slug":199,"position":59,"directory":179},54,"Notion Power-ups","notion-power-ups",{"id":201,"title":202,"slug":203,"position":21,"directory":179},59,"Talk to a Human Power-up","talk-to-a-human",{"id":205,"title":206,"slug":207,"position":26,"directory":179},52,"Email Power-ups","email-power-up",{"id":209,"title":210,"slug":211,"position":71,"directory":179},57,"Send an email","send-email-power-up",{"id":213,"title":214,"slug":215,"position":55,"directory":179},58,"Slack Power-ups","slack-power-ups",{"id":217,"title":218,"slug":219,"position":78,"directory":179},50,"Discord Power-ups","discord-power-ups",{"id":221,"title":222,"slug":223,"position":67,"directory":179},48,"Bot-to-bot power-up","bot-to-bot-power-up",{"id":225,"title":226,"slug":227,"position":63,"directory":179},51,"Display power-ups","display-power-ups",{"id":229,"title":230,"slug":231,"position":138,"directory":179},56,"Power-up display modes","power-up-display-modes",{"id":233,"title":234,"position":71,"children":235},62,"Tasks",[236],{"id":237,"title":234,"slug":238,"position":7,"directory":238},63,"tasks",{"id":240,"title":241,"position":31,"children":242},64,"Teams",[243,246,250,254],{"id":244,"title":241,"slug":245,"position":7,"directory":245},65,"teams",{"id":247,"title":248,"slug":249,"position":48,"directory":245},66,"Inviting team members","teams-inviting",{"id":251,"title":252,"slug":253,"position":59,"directory":245},67,"Managing team members","teams-member-roles",{"id":255,"title":256,"slug":257,"position":21,"directory":245},68,"Transferring bots","teams-transferring-bots",{"id":259,"title":260,"position":31,"children":261},73,"Use cases",[262,267,271],{"id":263,"title":264,"slug":265,"position":7,"directory":266},76,"Build a support bot for your website","support-bot","use-cases",{"id":268,"title":269,"slug":270,"position":48,"directory":266},74,"Build an internal knowledge bot for your team","internal-knowledge-bot",{"id":272,"title":273,"slug":274,"position":59,"directory":266},75,"Build a lead capture bot for your website","lead-capture-bot",{"id":276,"title":277,"position":40,"children":278},69,"Usage and billing",[279,284,288],{"id":280,"title":281,"slug":282,"position":7,"directory":283},70,"How does billing work?","how-does-billing-work","usage-and-billing",{"id":285,"title":286,"slug":287,"position":7,"directory":283},72,"What are storage tokens?","what-are-storage-tokens",{"id":289,"title":290,"slug":291,"position":21,"directory":283},71,"What are message tokens?","what-are-message-tokens",{"id":293,"title":294,"position":45,"children":295},41,"Plans",[296,301,305,309,313],{"id":297,"title":298,"slug":299,"position":7,"directory":300},44,"Free","free-plan","plans",{"id":302,"title":303,"slug":304,"position":48,"directory":300},42,"Basic","basic-plan",{"id":306,"title":307,"slug":308,"position":59,"directory":300},46,"Standard","standard-plan",{"id":310,"title":311,"slug":312,"position":21,"directory":300},45,"Pro","pro-plan",{"id":314,"title":315,"slug":316,"position":26,"directory":300},43,"Enterprise","enterprise-plan",{"id":318,"title":79,"body":319,"description":1766,"extension":1767,"longTitle":1768,"meta":1769,"navigation":462,"path":1770,"position":31,"seo":1771,"stem":1772,"__hash__":1773},"docs\u002Fdocs\u002Fbots\u002Fsdk.md",{"type":320,"value":321,"toc":1754},"minimark",[322,331,342,418,423,428,504,508,575,579,632,636,687,691,840,844,978,985,989,1045,1049,1052,1060,1419,1424,1427,1486,1489,1750],[323,324,325,326,330],"p",{},"If your using our embed snippet to load your bot into your website, then you already have access to our software development kit. The Software Development Kit (SDK) can be accessed via a property on the global window object ",[327,328,329],"strong",{},"window.chatThing",".",[323,332,333,334,337,338,341],{},"As a reminder our chat embed script looks like this & you can obtain this by visiting your bots dashboard, clicking on the \"",[327,335,336],{},"Embed","\" button (top right), then copy the snippet under \"",[327,339,340],{},"Embed as chat widget","\".",[343,344,349],"pre",{"className":345,"code":346,"language":347,"meta":348,"style":348},"language-html shiki shiki-themes monokai","\u003Cscript\n  src=\"https:\u002F\u002Fchatthing.ai\u002Fchat-widget.js\"\n  type=\"text\u002Fjavascript\"\n  id=\"98c8bb01-129e-4459-b496-648f6601cd70\"\n  async\n  defer\n>\u003C\u002Fscript>\n","html","",[350,351,352,364,377,387,397,402,407],"code",{"__ignoreMap":348},[353,354,356,360],"span",{"class":355,"line":48},"line",[353,357,359],{"class":358},"sCdxs","\u003C",[353,361,363],{"class":362},"s8I7P","script\n",[353,365,366,370,373],{"class":355,"line":59},[353,367,369],{"class":368},"sHkqI","  src",[353,371,372],{"class":358},"=",[353,374,376],{"class":375},"s_Ekj","\"https:\u002F\u002Fchatthing.ai\u002Fchat-widget.js\"\n",[353,378,379,382,384],{"class":355,"line":21},[353,380,381],{"class":368},"  type",[353,383,372],{"class":358},[353,385,386],{"class":375},"\"text\u002Fjavascript\"\n",[353,388,389,392,394],{"class":355,"line":26},[353,390,391],{"class":368},"  id",[353,393,372],{"class":358},[353,395,396],{"class":375},"\"98c8bb01-129e-4459-b496-648f6601cd70\"\n",[353,398,399],{"class":355,"line":71},[353,400,401],{"class":368},"  async\n",[353,403,404],{"class":355,"line":31},[353,405,406],{"class":368},"  defer\n",[353,408,409,412,415],{"class":355,"line":40},[353,410,411],{"class":358},">\u003C\u002F",[353,413,414],{"class":362},"script",[353,416,417],{"class":358},">\n",[323,419,420],{},[327,421,422],{},"If you're using this method to embed your bot, then you have access to the following functionality.",[424,425,427],"h2",{"id":426},"show-or-hide-the-chat-window","Show or hide the chat window",[343,429,433],{"className":430,"code":431,"language":432,"meta":348,"style":348},"language-typescript shiki shiki-themes monokai","\u002F* show the chat window *\u002F\nwindow.chatThing.show(): void;\n\n\u002F* hide the chat window *\u002F\nwindow.chatThing.hide(): void;\n\n\u002F* toggle the chat window *\u002F\nwindow.chatThing.toggle(): void;\n","typescript",[350,434,435,441,458,464,469,482,486,491],{"__ignoreMap":348},[353,436,437],{"class":355,"line":48},[353,438,440],{"class":439},"snpHw","\u002F* show the chat window *\u002F\n",[353,442,443,446,449,452,455],{"class":355,"line":59},[353,444,445],{"class":358},"window.chatThing.",[353,447,448],{"class":368},"show",[353,450,451],{"class":358},"(): ",[353,453,454],{"class":362},"void",[353,456,457],{"class":358},";\n",[353,459,460],{"class":355,"line":21},[353,461,463],{"emptyLinePlaceholder":462},true,"\n",[353,465,466],{"class":355,"line":26},[353,467,468],{"class":439},"\u002F* hide the chat window *\u002F\n",[353,470,471,473,476,478,480],{"class":355,"line":71},[353,472,445],{"class":358},[353,474,475],{"class":368},"hide",[353,477,451],{"class":358},[353,479,454],{"class":362},[353,481,457],{"class":358},[353,483,484],{"class":355,"line":31},[353,485,463],{"emptyLinePlaceholder":462},[353,487,488],{"class":355,"line":40},[353,489,490],{"class":439},"\u002F* toggle the chat window *\u002F\n",[353,492,493,495,498,500,502],{"class":355,"line":45},[353,494,445],{"class":358},[353,496,497],{"class":368},"toggle",[353,499,451],{"class":358},[353,501,454],{"class":362},[353,503,457],{"class":358},[424,505,507],{"id":506},"show-or-hide-the-trigger-button","Show or hide the trigger button",[343,509,511],{"className":430,"code":510,"language":432,"meta":348,"style":348},"\u002F* show the trigger button *\u002F\nwindow.chatThing.showTrigger(): void;\n\n\u002F* hide the trigger button *\u002F\nwindow.chatThing.hideTrigger(): void;\n\n\u002F* toggle the trigger button *\u002F\nwindow.chatThing.toggleTrigger(): void;\n",[350,512,513,518,531,535,540,553,557,562],{"__ignoreMap":348},[353,514,515],{"class":355,"line":48},[353,516,517],{"class":439},"\u002F* show the trigger button *\u002F\n",[353,519,520,522,525,527,529],{"class":355,"line":59},[353,521,445],{"class":358},[353,523,524],{"class":368},"showTrigger",[353,526,451],{"class":358},[353,528,454],{"class":362},[353,530,457],{"class":358},[353,532,533],{"class":355,"line":21},[353,534,463],{"emptyLinePlaceholder":462},[353,536,537],{"class":355,"line":26},[353,538,539],{"class":439},"\u002F* hide the trigger button *\u002F\n",[353,541,542,544,547,549,551],{"class":355,"line":71},[353,543,445],{"class":358},[353,545,546],{"class":368},"hideTrigger",[353,548,451],{"class":358},[353,550,454],{"class":362},[353,552,457],{"class":358},[353,554,555],{"class":355,"line":31},[353,556,463],{"emptyLinePlaceholder":462},[353,558,559],{"class":355,"line":40},[353,560,561],{"class":439},"\u002F* toggle the trigger button *\u002F\n",[353,563,564,566,569,571,573],{"class":355,"line":45},[353,565,445],{"class":358},[353,567,568],{"class":368},"toggleTrigger",[353,570,451],{"class":358},[353,572,454],{"class":362},[353,574,457],{"class":358},[424,576,578],{"id":577},"send-messages-or-start-new-conversations","Send messages or start new conversations",[343,580,582],{"className":430,"code":581,"language":432,"meta":348,"style":348},"\u002F* send a message to the chat interface *\u002F\nwindow.chatThing.sendMessage(message: string): void;\n\n\u002F* start a new conversation *\u002F\nwindow.chatThing.newConversation(message?: string): void;\n",[350,583,584,589,603,607,612],{"__ignoreMap":348},[353,585,586],{"class":355,"line":48},[353,587,588],{"class":439},"\u002F* send a message to the chat interface *\u002F\n",[353,590,591,593,596,599,601],{"class":355,"line":59},[353,592,445],{"class":358},[353,594,595],{"class":368},"sendMessage",[353,597,598],{"class":358},"(message: string): ",[353,600,454],{"class":362},[353,602,457],{"class":358},[353,604,605],{"class":355,"line":21},[353,606,463],{"emptyLinePlaceholder":462},[353,608,609],{"class":355,"line":26},[353,610,611],{"class":439},"\u002F* start a new conversation *\u002F\n",[353,613,614,616,619,622,625,628,630],{"class":355,"line":71},[353,615,445],{"class":358},[353,617,618],{"class":368},"newConversation",[353,620,621],{"class":358},"(message",[353,623,624],{"class":362},"?:",[353,626,627],{"class":358}," string): ",[353,629,454],{"class":362},[353,631,457],{"class":358},[424,633,635],{"id":634},"send-message-previews-message-bubbles","Send message previews (message bubbles)",[343,637,639],{"className":430,"code":638,"language":432,"meta":348,"style":348},"\u002F* show chat message preview *\u002F\nwindow.chatThing.showPreview(message: string, delay?: number): void;\n\n\u002F* hide chat message preview *\u002F\nwindow.chatThing.hidePreview(): void;\n",[350,640,641,646,665,669,674],{"__ignoreMap":348},[353,642,643],{"class":355,"line":48},[353,644,645],{"class":439},"\u002F* show chat message preview *\u002F\n",[353,647,648,650,653,656,658,661,663],{"class":355,"line":59},[353,649,445],{"class":358},[353,651,652],{"class":368},"showPreview",[353,654,655],{"class":358},"(message: string, delay",[353,657,624],{"class":362},[353,659,660],{"class":358}," number): ",[353,662,454],{"class":362},[353,664,457],{"class":358},[353,666,667],{"class":355,"line":21},[353,668,463],{"emptyLinePlaceholder":462},[353,670,671],{"class":355,"line":26},[353,672,673],{"class":439},"\u002F* hide chat message preview *\u002F\n",[353,675,676,678,681,683,685],{"class":355,"line":71},[353,677,445],{"class":358},[353,679,680],{"class":368},"hidePreview",[353,682,451],{"class":358},[353,684,454],{"class":362},[353,686,457],{"class":358},[424,688,690],{"id":689},"extend-chat-interface-theme","Extend chat interface theme",[343,692,694],{"className":430,"code":693,"language":432,"meta":348,"style":348},"type TExtendThemeData = {\n  theme?: \"dark\" | \"light\";\n  colours?: {\n    primaryColour?: string;\n    primaryColourInverted?: string;\n    secondaryColour?: string;\n    secondaryColourInverted?: string;\n  };\n}\n\n\u002F* extend chat interface theme *\u002F\nwindow.chatThing.extendTheme(data: TExtendThemeData): void;\n",[350,695,696,712,730,739,751,762,773,784,789,794,798,803],{"__ignoreMap":348},[353,697,698,702,706,709],{"class":355,"line":48},[353,699,701],{"class":700},"sOx1s","type",[353,703,705],{"class":704},"soZtE"," TExtendThemeData",[353,707,708],{"class":362}," =",[353,710,711],{"class":358}," {\n",[353,713,714,717,719,722,725,728],{"class":355,"line":59},[353,715,716],{"class":358},"  theme",[353,718,624],{"class":362},[353,720,721],{"class":375}," \"dark\"",[353,723,724],{"class":362}," |",[353,726,727],{"class":375}," \"light\"",[353,729,457],{"class":358},[353,731,732,735,737],{"class":355,"line":21},[353,733,734],{"class":358},"  colours",[353,736,624],{"class":362},[353,738,711],{"class":358},[353,740,741,744,746,749],{"class":355,"line":26},[353,742,743],{"class":358},"    primaryColour",[353,745,624],{"class":362},[353,747,748],{"class":700}," string",[353,750,457],{"class":358},[353,752,753,756,758,760],{"class":355,"line":71},[353,754,755],{"class":358},"    primaryColourInverted",[353,757,624],{"class":362},[353,759,748],{"class":700},[353,761,457],{"class":358},[353,763,764,767,769,771],{"class":355,"line":31},[353,765,766],{"class":358},"    secondaryColour",[353,768,624],{"class":362},[353,770,748],{"class":700},[353,772,457],{"class":358},[353,774,775,778,780,782],{"class":355,"line":40},[353,776,777],{"class":358},"    secondaryColourInverted",[353,779,624],{"class":362},[353,781,748],{"class":700},[353,783,457],{"class":358},[353,785,786],{"class":355,"line":45},[353,787,788],{"class":358},"  };\n",[353,790,791],{"class":355,"line":88},[353,792,793],{"class":358},"}\n",[353,795,796],{"class":355,"line":55},[353,797,463],{"emptyLinePlaceholder":462},[353,799,800],{"class":355,"line":78},[353,801,802],{"class":439},"\u002F* extend chat interface theme *\u002F\n",[353,804,805,808,810,813,815,818,821,825,828,830,833,835,838],{"class":355,"line":67},[353,806,807],{"class":704},"window",[353,809,330],{"class":358},[353,811,812],{"class":704},"chatThing",[353,814,330],{"class":358},[353,816,817],{"class":704},"extendTheme",[353,819,820],{"class":358},"(",[353,822,824],{"class":823},"sW0Xf","data",[353,826,827],{"class":362},":",[353,829,705],{"class":704},[353,831,832],{"class":358},")",[353,834,827],{"class":362},[353,836,837],{"class":700}," void",[353,839,457],{"class":358},[424,841,843],{"id":842},"identify-user","Identify user",[343,845,847],{"className":430,"code":846,"language":432,"meta":348,"style":348},"type TIdentifyUser = {\n  name?: string;\n};\n\ntype TIdentifyUserId = TIdentifyUser & {\n  id: string | number;\n};\n\ntype TIdentifyUserEmail = TIdentifyUser & {\n  email: string;\n};\n\n\u002F* identify user *\u002F\nwindow.chatThing.identifyUser(data: TIdentifyUserId | TIdentifyUserEmail): void;\n",[350,848,849,860,871,876,880,896,911,915,919,934,945,949,953,958],{"__ignoreMap":348},[353,850,851,853,856,858],{"class":355,"line":48},[353,852,701],{"class":700},[353,854,855],{"class":704}," TIdentifyUser",[353,857,708],{"class":362},[353,859,711],{"class":358},[353,861,862,865,867,869],{"class":355,"line":59},[353,863,864],{"class":358},"  name",[353,866,624],{"class":362},[353,868,748],{"class":700},[353,870,457],{"class":358},[353,872,873],{"class":355,"line":21},[353,874,875],{"class":358},"};\n",[353,877,878],{"class":355,"line":26},[353,879,463],{"emptyLinePlaceholder":462},[353,881,882,884,887,889,891,894],{"class":355,"line":71},[353,883,701],{"class":700},[353,885,886],{"class":704}," TIdentifyUserId",[353,888,708],{"class":362},[353,890,855],{"class":704},[353,892,893],{"class":362}," &",[353,895,711],{"class":358},[353,897,898,900,902,904,906,909],{"class":355,"line":31},[353,899,391],{"class":358},[353,901,827],{"class":362},[353,903,748],{"class":700},[353,905,724],{"class":362},[353,907,908],{"class":700}," number",[353,910,457],{"class":358},[353,912,913],{"class":355,"line":40},[353,914,875],{"class":358},[353,916,917],{"class":355,"line":45},[353,918,463],{"emptyLinePlaceholder":462},[353,920,921,923,926,928,930,932],{"class":355,"line":88},[353,922,701],{"class":700},[353,924,925],{"class":704}," TIdentifyUserEmail",[353,927,708],{"class":362},[353,929,855],{"class":704},[353,931,893],{"class":362},[353,933,711],{"class":358},[353,935,936,939,941,943],{"class":355,"line":55},[353,937,938],{"class":358},"  email",[353,940,827],{"class":362},[353,942,748],{"class":700},[353,944,457],{"class":358},[353,946,947],{"class":355,"line":78},[353,948,875],{"class":358},[353,950,951],{"class":355,"line":67},[353,952,463],{"emptyLinePlaceholder":462},[353,954,955],{"class":355,"line":63},[353,956,957],{"class":439},"\u002F* identify user *\u002F\n",[353,959,960,962,965,968,971,974,976],{"class":355,"line":138},[353,961,445],{"class":358},[353,963,964],{"class":368},"identifyUser",[353,966,967],{"class":358},"(data: TIdentifyUserId ",[353,969,970],{"class":362},"|",[353,972,973],{"class":358}," TIdentifyUserEmail): ",[353,975,454],{"class":362},[353,977,457],{"class":358},[979,980,982],"callout",{"type":981},"warning",[323,983,984],{},"The following functions are disabled by default, to make use of these you must first switch them on via your bots web channel settings.",[424,986,988],{"id":987},"override-or-extend-the-system-message","Override or extend the system message",[343,990,992],{"className":430,"code":991,"language":432,"meta":348,"style":348},"\u002F* overide the system message *\u002F\nwindow.chatThing.systemMessage(mode: \"override\", message: string): void;\n\n\u002F* extend the system message *\u002F\nwindow.chatThing.systemMessage(mode: \"extend\", message: string): void;\n",[350,993,994,999,1019,1023,1028],{"__ignoreMap":348},[353,995,996],{"class":355,"line":48},[353,997,998],{"class":439},"\u002F* overide the system message *\u002F\n",[353,1000,1001,1003,1006,1009,1012,1015,1017],{"class":355,"line":59},[353,1002,445],{"class":358},[353,1004,1005],{"class":368},"systemMessage",[353,1007,1008],{"class":358},"(mode: ",[353,1010,1011],{"class":375},"\"override\"",[353,1013,1014],{"class":358},", message: string): ",[353,1016,454],{"class":362},[353,1018,457],{"class":358},[353,1020,1021],{"class":355,"line":21},[353,1022,463],{"emptyLinePlaceholder":462},[353,1024,1025],{"class":355,"line":26},[353,1026,1027],{"class":439},"\u002F* extend the system message *\u002F\n",[353,1029,1030,1032,1034,1036,1039,1041,1043],{"class":355,"line":71},[353,1031,445],{"class":358},[353,1033,1005],{"class":368},[353,1035,1008],{"class":358},[353,1037,1038],{"class":375},"\"extend\"",[353,1040,1014],{"class":358},[353,1042,454],{"class":362},[353,1044,457],{"class":358},[424,1046,1048],{"id":1047},"register-client-side-power-ups","Register client side power ups",[323,1050,1051],{},"Client side power-ups allows you to create custom power-ups for your bots allowing it to take actions on behalf of your users. This is extremely powerful and allows you to create AI co-pilots for your apps that can do things like add items to a user's basket etc.",[323,1053,1054,1055],{},"For a detailed example of how to use client-side power-ups to build an AI shopping assistant, checkout this blog post and video: ",[1056,1057,1059],"a",{"href":1058},"\u002Fblog\u002Fbuilding-an-ai-shopping-co-pilot","Build an AI shopping co-pilot",[343,1061,1063],{"className":430,"code":1062,"language":432,"meta":348,"style":348},"\u002F* register a client side power up *\u002F\nwindow.chatThing.registerPowerUp(data: TRegisterPowerUpData): TRegisteredPowerUp;\n\ntype TPowerUpArgs = Record\u003Cstring, any>;\ntype TPowerUpHandler = (args: TPowerUpArgs) => Record\u003Cstring, any>;\ntype TRegisterPowerUpParameters = {\n  [key: string]: {\n    type: \"string\" | \"number\" | \"boolean\" | \"object\";\n    values?: (string | number | boolean)[];\n    description: string;\n    required: boolean;\n  };\n};\n\ntype TRegisterPowerUpData = {\n  id?: string;\n  name: string;\n  description: string;\n  parameters: TRegisterPowerUpParameters;\n  handler?: TPowerUpHandler;\n};\n\ntype TRegisteredPowerUp = {\n  id: string;\n  enabled: boolean;\n  setEnabled: (enabled: boolean) => void;\n  destroy: () => void;\n  handler?: TPowerUpHandler;\n};\n",[350,1064,1065,1070,1080,1084,1110,1147,1158,1177,1204,1227,1238,1249,1253,1257,1261,1272,1282,1292,1303,1314,1325,1329,1333,1344,1354,1365,1389,1405,1415],{"__ignoreMap":348},[353,1066,1067],{"class":355,"line":48},[353,1068,1069],{"class":439},"\u002F* register a client side power up *\u002F\n",[353,1071,1072,1074,1077],{"class":355,"line":59},[353,1073,445],{"class":358},[353,1075,1076],{"class":368},"registerPowerUp",[353,1078,1079],{"class":358},"(data: TRegisterPowerUpData): TRegisteredPowerUp;\n",[353,1081,1082],{"class":355,"line":21},[353,1083,463],{"emptyLinePlaceholder":462},[353,1085,1086,1088,1091,1093,1096,1098,1101,1104,1107],{"class":355,"line":26},[353,1087,701],{"class":700},[353,1089,1090],{"class":704}," TPowerUpArgs",[353,1092,708],{"class":362},[353,1094,1095],{"class":704}," Record",[353,1097,359],{"class":358},[353,1099,1100],{"class":700},"string",[353,1102,1103],{"class":358},", ",[353,1105,1106],{"class":700},"any",[353,1108,1109],{"class":358},">;\n",[353,1111,1112,1114,1117,1119,1122,1125,1127,1129,1132,1135,1137,1139,1141,1143,1145],{"class":355,"line":71},[353,1113,701],{"class":700},[353,1115,1116],{"class":704}," TPowerUpHandler",[353,1118,708],{"class":362},[353,1120,1121],{"class":358}," (",[353,1123,1124],{"class":823},"args",[353,1126,827],{"class":362},[353,1128,1090],{"class":704},[353,1130,1131],{"class":358},") ",[353,1133,1134],{"class":700},"=>",[353,1136,1095],{"class":704},[353,1138,359],{"class":358},[353,1140,1100],{"class":700},[353,1142,1103],{"class":358},[353,1144,1106],{"class":700},[353,1146,1109],{"class":358},[353,1148,1149,1151,1154,1156],{"class":355,"line":31},[353,1150,701],{"class":700},[353,1152,1153],{"class":704}," TRegisterPowerUpParameters",[353,1155,708],{"class":362},[353,1157,711],{"class":358},[353,1159,1160,1163,1166,1168,1170,1173,1175],{"class":355,"line":40},[353,1161,1162],{"class":358},"  [",[353,1164,1165],{"class":823},"key",[353,1167,827],{"class":362},[353,1169,748],{"class":700},[353,1171,1172],{"class":358},"]",[353,1174,827],{"class":362},[353,1176,711],{"class":358},[353,1178,1179,1182,1184,1187,1189,1192,1194,1197,1199,1202],{"class":355,"line":45},[353,1180,1181],{"class":358},"    type",[353,1183,827],{"class":362},[353,1185,1186],{"class":375}," \"string\"",[353,1188,724],{"class":362},[353,1190,1191],{"class":375}," \"number\"",[353,1193,724],{"class":362},[353,1195,1196],{"class":375}," \"boolean\"",[353,1198,724],{"class":362},[353,1200,1201],{"class":375}," \"object\"",[353,1203,457],{"class":358},[353,1205,1206,1209,1211,1213,1215,1217,1219,1221,1224],{"class":355,"line":88},[353,1207,1208],{"class":358},"    values",[353,1210,624],{"class":362},[353,1212,1121],{"class":358},[353,1214,1100],{"class":700},[353,1216,724],{"class":362},[353,1218,908],{"class":700},[353,1220,724],{"class":362},[353,1222,1223],{"class":700}," boolean",[353,1225,1226],{"class":358},")[];\n",[353,1228,1229,1232,1234,1236],{"class":355,"line":55},[353,1230,1231],{"class":358},"    description",[353,1233,827],{"class":362},[353,1235,748],{"class":700},[353,1237,457],{"class":358},[353,1239,1240,1243,1245,1247],{"class":355,"line":78},[353,1241,1242],{"class":358},"    required",[353,1244,827],{"class":362},[353,1246,1223],{"class":700},[353,1248,457],{"class":358},[353,1250,1251],{"class":355,"line":67},[353,1252,788],{"class":358},[353,1254,1255],{"class":355,"line":63},[353,1256,875],{"class":358},[353,1258,1259],{"class":355,"line":138},[353,1260,463],{"emptyLinePlaceholder":462},[353,1262,1263,1265,1268,1270],{"class":355,"line":91},[353,1264,701],{"class":700},[353,1266,1267],{"class":704}," TRegisterPowerUpData",[353,1269,708],{"class":362},[353,1271,711],{"class":358},[353,1273,1274,1276,1278,1280],{"class":355,"line":95},[353,1275,391],{"class":358},[353,1277,624],{"class":362},[353,1279,748],{"class":700},[353,1281,457],{"class":358},[353,1283,1284,1286,1288,1290],{"class":355,"line":168},[353,1285,864],{"class":358},[353,1287,827],{"class":362},[353,1289,748],{"class":700},[353,1291,457],{"class":358},[353,1293,1294,1297,1299,1301],{"class":355,"line":147},[353,1295,1296],{"class":358},"  description",[353,1298,827],{"class":362},[353,1300,748],{"class":700},[353,1302,457],{"class":358},[353,1304,1305,1308,1310,1312],{"class":355,"line":151},[353,1306,1307],{"class":358},"  parameters",[353,1309,827],{"class":362},[353,1311,1153],{"class":704},[353,1313,457],{"class":358},[353,1315,1316,1319,1321,1323],{"class":355,"line":99},[353,1317,1318],{"class":358},"  handler",[353,1320,624],{"class":362},[353,1322,1116],{"class":704},[353,1324,457],{"class":358},[353,1326,1327],{"class":355,"line":142},[353,1328,875],{"class":358},[353,1330,1331],{"class":355,"line":161},[353,1332,463],{"emptyLinePlaceholder":462},[353,1334,1335,1337,1340,1342],{"class":355,"line":101},[353,1336,701],{"class":700},[353,1338,1339],{"class":704}," TRegisteredPowerUp",[353,1341,708],{"class":362},[353,1343,711],{"class":358},[353,1345,1346,1348,1350,1352],{"class":355,"line":130},[353,1347,391],{"class":358},[353,1349,827],{"class":362},[353,1351,748],{"class":700},[353,1353,457],{"class":358},[353,1355,1356,1359,1361,1363],{"class":355,"line":105},[353,1357,1358],{"class":358},"  enabled",[353,1360,827],{"class":362},[353,1362,1223],{"class":700},[353,1364,457],{"class":358},[353,1366,1367,1370,1372,1374,1377,1379,1381,1383,1385,1387],{"class":355,"line":134},[353,1368,1369],{"class":368},"  setEnabled",[353,1371,827],{"class":362},[353,1373,1121],{"class":358},[353,1375,1376],{"class":823},"enabled",[353,1378,827],{"class":362},[353,1380,1223],{"class":700},[353,1382,1131],{"class":358},[353,1384,1134],{"class":700},[353,1386,837],{"class":700},[353,1388,457],{"class":358},[353,1390,1391,1394,1396,1399,1401,1403],{"class":355,"line":126},[353,1392,1393],{"class":368},"  destroy",[353,1395,827],{"class":362},[353,1397,1398],{"class":358}," () ",[353,1400,1134],{"class":700},[353,1402,837],{"class":700},[353,1404,457],{"class":358},[353,1406,1407,1409,1411,1413],{"class":355,"line":110},[353,1408,1318],{"class":358},[353,1410,624],{"class":362},[353,1412,1116],{"class":704},[353,1414,457],{"class":358},[353,1416,1417],{"class":355,"line":122},[353,1418,875],{"class":358},[1420,1421,1423],"h3",{"id":1422},"example-adding-to-cart","Example: Adding to cart",[323,1425,1426],{},"Let's demonstrate a basic example where we allow our bot to add products to a users cart. Assume we already have a basic add to cart function in the frontend of our app that looks something like this:",[343,1428,1430],{"className":430,"code":1429,"language":432,"meta":348,"style":348},"function addToCart(itemId: string, qty: number): Promise\u003Cany> {\n  \u002F\u002F Add to cart implementation goes here. You may post to an API or handle adding to cart\n  \u002F\u002F entirely on the frontend\n}\n",[350,1431,1432,1472,1477,1482],{"__ignoreMap":348},[353,1433,1434,1437,1440,1442,1445,1447,1449,1451,1454,1456,1458,1460,1462,1465,1467,1469],{"class":355,"line":48},[353,1435,1436],{"class":700},"function",[353,1438,1439],{"class":368}," addToCart",[353,1441,820],{"class":358},[353,1443,1444],{"class":823},"itemId",[353,1446,827],{"class":362},[353,1448,748],{"class":700},[353,1450,1103],{"class":358},[353,1452,1453],{"class":823},"qty",[353,1455,827],{"class":362},[353,1457,908],{"class":700},[353,1459,832],{"class":358},[353,1461,827],{"class":362},[353,1463,1464],{"class":704}," Promise",[353,1466,359],{"class":358},[353,1468,1106],{"class":700},[353,1470,1471],{"class":358},"> {\n",[353,1473,1474],{"class":355,"line":59},[353,1475,1476],{"class":439},"  \u002F\u002F Add to cart implementation goes here. You may post to an API or handle adding to cart\n",[353,1478,1479],{"class":355,"line":21},[353,1480,1481],{"class":439},"  \u002F\u002F entirely on the frontend\n",[353,1483,1484],{"class":355,"line":26},[353,1485,793],{"class":358},[323,1487,1488],{},"We can now allow our bot to use the function when a user would like to add a product to the cart by adding a client side power-up.",[343,1490,1492],{"className":430,"code":1491,"language":432,"meta":348,"style":348},"const addToCartPowerUp = window.chatThing.registerPowerUp({\n  name: \"Add to cart\",\n  description: \"Add a product to the shopping cart\",\n  parameters: {\n    itemId: {\n      type: \"string\",\n      description: \"The unique product id\",\n      required: true,\n    },\n    qty: {\n      type: \"number\",\n      description: \"The number of items to add\",\n      required: true,\n    },\n  },\n  handler: async (args: { itemId: string; qty: number }) => {\n    \u002F\u002F In the power-up handler you can now call your original add to cart function using\n    \u002F\u002F the arguments provided by the bot\n    try {\n      const res = await addToCart(itemId, qty);\n\n      \u002F\u002F You should return a string from the handler functions\n      return res;\n    } catch (e) {\n      \u002F\u002F If there has been an error return an error message so the bot\n      \u002F\u002F knows something has gone wrong\n      return e.message;\n    }\n  },\n});\n",[350,1493,1494,1512,1523,1533,1538,1543,1553,1563,1574,1579,1584,1593,1602,1610,1614,1619,1656,1661,1666,1673,1691,1695,1700,1708,1719,1724,1729,1736,1741,1745],{"__ignoreMap":348},[353,1495,1496,1499,1502,1504,1507,1509],{"class":355,"line":48},[353,1497,1498],{"class":700},"const",[353,1500,1501],{"class":358}," addToCartPowerUp ",[353,1503,372],{"class":362},[353,1505,1506],{"class":358}," window.chatThing.",[353,1508,1076],{"class":368},[353,1510,1511],{"class":358},"({\n",[353,1513,1514,1517,1520],{"class":355,"line":59},[353,1515,1516],{"class":358},"  name: ",[353,1518,1519],{"class":375},"\"Add to cart\"",[353,1521,1522],{"class":358},",\n",[353,1524,1525,1528,1531],{"class":355,"line":21},[353,1526,1527],{"class":358},"  description: ",[353,1529,1530],{"class":375},"\"Add a product to the shopping cart\"",[353,1532,1522],{"class":358},[353,1534,1535],{"class":355,"line":26},[353,1536,1537],{"class":358},"  parameters: {\n",[353,1539,1540],{"class":355,"line":71},[353,1541,1542],{"class":358},"    itemId: {\n",[353,1544,1545,1548,1551],{"class":355,"line":31},[353,1546,1547],{"class":358},"      type: ",[353,1549,1550],{"class":375},"\"string\"",[353,1552,1522],{"class":358},[353,1554,1555,1558,1561],{"class":355,"line":40},[353,1556,1557],{"class":358},"      description: ",[353,1559,1560],{"class":375},"\"The unique product id\"",[353,1562,1522],{"class":358},[353,1564,1565,1568,1572],{"class":355,"line":45},[353,1566,1567],{"class":358},"      required: ",[353,1569,1571],{"class":1570},"s7s5_","true",[353,1573,1522],{"class":358},[353,1575,1576],{"class":355,"line":88},[353,1577,1578],{"class":358},"    },\n",[353,1580,1581],{"class":355,"line":55},[353,1582,1583],{"class":358},"    qty: {\n",[353,1585,1586,1588,1591],{"class":355,"line":78},[353,1587,1547],{"class":358},[353,1589,1590],{"class":375},"\"number\"",[353,1592,1522],{"class":358},[353,1594,1595,1597,1600],{"class":355,"line":67},[353,1596,1557],{"class":358},[353,1598,1599],{"class":375},"\"The number of items to add\"",[353,1601,1522],{"class":358},[353,1603,1604,1606,1608],{"class":355,"line":63},[353,1605,1567],{"class":358},[353,1607,1571],{"class":1570},[353,1609,1522],{"class":358},[353,1611,1612],{"class":355,"line":138},[353,1613,1578],{"class":358},[353,1615,1616],{"class":355,"line":91},[353,1617,1618],{"class":358},"  },\n",[353,1620,1621,1623,1626,1629,1631,1633,1635,1638,1640,1642,1645,1647,1649,1652,1654],{"class":355,"line":95},[353,1622,1318],{"class":368},[353,1624,1625],{"class":358},": ",[353,1627,1628],{"class":362},"async",[353,1630,1121],{"class":358},[353,1632,1124],{"class":823},[353,1634,827],{"class":362},[353,1636,1637],{"class":358}," { itemId",[353,1639,827],{"class":362},[353,1641,748],{"class":700},[353,1643,1644],{"class":358},"; qty",[353,1646,827],{"class":362},[353,1648,908],{"class":700},[353,1650,1651],{"class":358}," }) ",[353,1653,1134],{"class":700},[353,1655,711],{"class":358},[353,1657,1658],{"class":355,"line":168},[353,1659,1660],{"class":439},"    \u002F\u002F In the power-up handler you can now call your original add to cart function using\n",[353,1662,1663],{"class":355,"line":147},[353,1664,1665],{"class":439},"    \u002F\u002F the arguments provided by the bot\n",[353,1667,1668,1671],{"class":355,"line":151},[353,1669,1670],{"class":362},"    try",[353,1672,711],{"class":358},[353,1674,1675,1678,1681,1683,1686,1688],{"class":355,"line":99},[353,1676,1677],{"class":700},"      const",[353,1679,1680],{"class":358}," res ",[353,1682,372],{"class":362},[353,1684,1685],{"class":362}," await",[353,1687,1439],{"class":368},[353,1689,1690],{"class":358},"(itemId, qty);\n",[353,1692,1693],{"class":355,"line":142},[353,1694,463],{"emptyLinePlaceholder":462},[353,1696,1697],{"class":355,"line":161},[353,1698,1699],{"class":439},"      \u002F\u002F You should return a string from the handler functions\n",[353,1701,1702,1705],{"class":355,"line":101},[353,1703,1704],{"class":362},"      return",[353,1706,1707],{"class":358}," res;\n",[353,1709,1710,1713,1716],{"class":355,"line":130},[353,1711,1712],{"class":358},"    } ",[353,1714,1715],{"class":362},"catch",[353,1717,1718],{"class":358}," (e) {\n",[353,1720,1721],{"class":355,"line":105},[353,1722,1723],{"class":439},"      \u002F\u002F If there has been an error return an error message so the bot\n",[353,1725,1726],{"class":355,"line":134},[353,1727,1728],{"class":439},"      \u002F\u002F knows something has gone wrong\n",[353,1730,1731,1733],{"class":355,"line":126},[353,1732,1704],{"class":362},[353,1734,1735],{"class":358}," e.message;\n",[353,1737,1738],{"class":355,"line":110},[353,1739,1740],{"class":358},"    }\n",[353,1742,1743],{"class":355,"line":122},[353,1744,1618],{"class":358},[353,1746,1747],{"class":355,"line":114},[353,1748,1749],{"class":358},"});\n",[1751,1752,1753],"style",{},"html pre.shiki code .sCdxs, html code.shiki .sCdxs{--shiki-default:#F8F8F2}html pre.shiki code .s8I7P, html code.shiki .s8I7P{--shiki-default:#F92672}html pre.shiki code .sHkqI, html code.shiki .sHkqI{--shiki-default:#A6E22E}html pre.shiki code .s_Ekj, html code.shiki .s_Ekj{--shiki-default:#E6DB74}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .snpHw, html code.shiki .snpHw{--shiki-default:#88846F}html pre.shiki code .sOx1s, html code.shiki .sOx1s{--shiki-default:#66D9EF;--shiki-default-font-style:italic}html pre.shiki code .soZtE, html code.shiki .soZtE{--shiki-default:#A6E22E;--shiki-default-text-decoration:underline}html pre.shiki code .sW0Xf, html code.shiki .sW0Xf{--shiki-default:#FD971F;--shiki-default-font-style:italic}html pre.shiki code .s7s5_, html code.shiki .s7s5_{--shiki-default:#AE81FF}",{"title":348,"searchDepth":59,"depth":59,"links":1755},[1756,1757,1758,1759,1760,1761,1762,1763],{"id":426,"depth":59,"text":427},{"id":506,"depth":59,"text":507},{"id":577,"depth":59,"text":578},{"id":634,"depth":59,"text":635},{"id":689,"depth":59,"text":690},{"id":842,"depth":59,"text":843},{"id":987,"depth":59,"text":988},{"id":1047,"depth":59,"text":1048,"children":1764},[1765],{"id":1422,"depth":21,"text":1423},"Use the Chat Thing SDK to control the chat widget on your website, including showing, hiding, and sending messages programmatically.","md",null,{"prevPage":73},"\u002Fdocs\u002Fbots\u002Fsdk",{"title":79,"description":1766},"docs\u002Fbots\u002Fsdk","06FBYpUJWKVMnSbkwdAXnDmvylU5ZteoajoAZfcMQ2M",{"id":1775,"title":47,"body":1776,"description":348,"extension":1767,"longTitle":1768,"meta":1783,"navigation":462,"path":1784,"position":48,"seo":1785,"stem":1786,"__hash__":1787},"docs\u002Fdocs\u002Fbots\u002F_index.md",{"type":320,"value":1777,"toc":1781},[1778],[1779,1780,47],"h1",{"id":53},{"title":348,"searchDepth":59,"depth":59,"links":1782},[],{},"\u002Fdocs\u002Fbots\u002F_index",{"title":47,"description":348},"docs\u002Fbots\u002F_index","LInSds9dB2V3BPa4s2Zj6NtChX_0uTxLY942NyFy688",{"prev":1789,"next":1790},{"title":75,"slug":76,"position":31,"directory":53},{"title":82,"slug":83,"position":40,"directory":53},1780676214585]