{
    "componentChunkName": "component---src-templates-doc-page-js",
    "path": "/docs/en/channels/threads/script_threads/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Gatsby-doc-engine"}},"markdownRemark":{"id":"0c5cdf13-75e4-59d9-946e-5e92fef3ee71","excerpt":"Specific Script Features for the edna.chatCenter Channel Telegram Attachments for the Telegram channel must originate from an approved domain. Please contact…","html":"<h1>Specific Script Features for the edna.chatCenter Channel</h1>\n<hr>\n<h4>Telegram</h4>\n<p>Attachments for the Telegram channel must originate from an approved domain. Please contact the <a href=\"https://threads.im/ru\" target=\"_blank\" rel=\"noopener noreferrer\">edna</a> technical support in order to gain access.</p>\n</br>\n<h4>Sending images to a chat widget</h4>\n<p>To send images to the chat widget, specify a file name and extension. For example:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\">    <span class=\"token keyword\">state:</span> image\n        <span class=\"token storageType\">q!:</span> image\n        <span class=\"token variableParameter\">a:</span> image\n        <span class=\"token variableParameter\">script:</span>\n            $response.replies.push( {\n                type: \"image\",\n                imageUrl: \"https://&lt;imageUrl>.jpg\",\n                text: \"image.jpg\"              <span class=\"token comment\">// image file name and extension</span>\n            } )</code></pre></div>\n<p class='tip'>You can only attach image and audio files if there is a text message in the above statement.</p>\n</br>\n<h4>Sending a file from a script</h4>\n<p>To send a file from a script, use <a href=\"/1.10.3/docs/en/JS_API/variables/response\"><code class=\"language-text\">$response.replies.push</code></a> with parameters:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\">    <span class=\"token storageType\">q!:</span> file\n    <span class=\"token variableParameter\">a:</span> send file\n    <span class=\"token variableParameter\">script:</span>\n        $response.replies = $response.replies || [];\n        $response.replies.push({\n            type:\"file\",                         <span class=\"token comment\">// type, can be audio and image</span>\n            fileUrl: \"&lt;https://fileUrl\",>        <span class=\"token comment\">// path to the file</span>\n            fileName: \"example.docx\",            <span class=\"token comment\">// name of the file</span>\n            mimeType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n        });</code></pre></div>\n<p class='tip'>The <a href=https://developer.mozilla.org/ru/docs/Web/HTTP/Basics_of_HTTP/MIME_types target=\"_blank\" rel=\"noopener noreferrer\"><code class=\"language-text\">mimeType</code></a> parameter is required for file transfer.</p>\n</br>\n<h4>Switching the conversation to an operator</h4>\n<p>To switch the conversation from a bot to an operator, you can use <a href=\"/1.10.3/docs/en/bot_answers/message_types#switch\"><code class=\"language-text\">switch</code></a>, for example:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\">    <span class=\"token keyword\">state:</span> switch\n        <span class=\"token storageType\">q!:</span> switch\n        <span class=\"token variableParameter\">script:</span>\n            $response.replies = $response.replies || [];\n            $response.replies.push({\n                type:\"switch\",\n                closeChatPhrases: [\"/closeLiveChat\", \"Close chat\"],\n                firstMessage: $client.history,\n                lastMessage: \"We’ll be waiting for your return!\",\n                attributes: {\n                \"Name\": \"John\",\n                \"Last Name\": \"Doe\"\n                }\n            });</code></pre></div>\n</br>\n<h4>Channel events</h4>\n<p>When a client sends a message with attached data (graphics, video, document or audio file), <a href=\"/1.10.3/docs/en/bot_answers/events_table\"><code class=\"language-text\">event: fileEvent</code></a> is sent in the script. A JSON object containing the content type, the link to the file being sent and other metadata are submitted in <code class=\"language-text\">eventData</code>:</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">[</span>\n   <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"url\"</span><span class=\"token operator\">:</span><span class=\"token string\">\"https://fileUrl.threads.im/files\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span><span class=\"token string\">\"Screenshot.png\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span><span class=\"token string\">\"image/png\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"size\"</span><span class=\"token operator\">:</span><span class=\"token number\">340140</span>\n   <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">]</span></code></pre></div>\n<p class='warn'><a href=/1.10.3/docs/en/bot_answers/fileEvent  >Learn more about the <code class=\"language-text\">fileEvent</code> event processing</a></p>\n<p class='tip'><a href=/1.10.3/docs/en/bot_answers/events_table  >Please note the events common for all channels</a></p>","frontmatter":{"title":"","description":null},"headings":[{"value":"Specific Script Features for the edna.chatCenter Channel"}]}},"pageContext":{"slug":"/docs/en/channels/threads/script_threads/","previous":{"fields":{"slug":"/docs/en/channels/viber/parameters_transfer/"},"frontmatter":{"title":"","description":null}},"next":{"fields":{"slug":"/docs/en/channels/threads/threads/"},"frontmatter":{"title":"","description":null}}}},
    "staticQueryHashes": ["1209419333"]}