<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dishant gandhi on Medium]]></title>
        <description><![CDATA[Stories by Dishant gandhi on Medium]]></description>
        <link>https://medium.com/@dishant_gandhi?source=rss-490e77b1b024------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q8TBHZsw7uMEafLy-0xxwQ.jpeg</url>
            <title>Stories by Dishant gandhi on Medium</title>
            <link>https://medium.com/@dishant_gandhi?source=rss-490e77b1b024------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:50:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dishant_gandhi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build a Local Agentic RAG App with Elasticsearch, Ollama, and Python]]></title>
            <link>https://medium.com/@dishant_gandhi/elastic-vector-database-for-rag-complete-guide-to-building-an-agentic-ai-rag-llm-with-32bde4ba891c?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/32bde4ba891c</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[generative-ai-solution]]></category>
            <category><![CDATA[ollama]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 07:35:12 GMT</pubDate>
            <atom:updated>2026-02-26T19:31:06.031Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWvdO-ZeMamX5dJ0Lyyxgw.png" /><figcaption>AI abstract art</figcaption></figure><h3>Hello folks👋,</h3><p>If you’ve been exploring <strong>what is RAG in AI</strong>, you’ve likely come across various <strong>vector databases</strong> like ChromaDB and Milvus. But when building modern <strong>RAG architecture</strong> for <strong>Agentic AI systems</strong>, Elasticsearch offers a powerful all-in-one alternative.</p><p>But what if I told you that you can get:</p><ul><li>Vector search</li><li>RAG pipelines</li><li>Agentic AI orchestration</li><li>Observability</li><li>Integrations</li></ul><p>Yes, you heard that right.</p><p>Elastic does it all.</p><p>In this guide, we’ll build a complete Agentic AI RAG LLM application using Elasticsearch as a vector database, combined with Elastic Agent, Fleet Server, Ollama, and Streamlit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*CMPC1O2pf6n9WNqrTb1onw.gif" /><figcaption>Damn gif</figcaption></figure><p>By the end, you’ll understand how Elastic powers modern RAG models without needing a separate vector DB.</p><p>Disclaimer: This blog post was submitted to the Elastic Blogathon Contest and is eligible to win a prize</p><h3>What We’ll Cover</h3><p>Here’s what we’ll break down step by step:</p><ol><li>What is Elastic and why use it as a vector database?</li><li>What is Elastic Agent?</li><li>Setting up Elasticsearch, Kibana, and Fleet Server using Docker</li><li>Creating a vector index for RAG</li><li>Ingesting PDF documents as embeddings</li><li>Implementing hybrid search (keyword + vector)</li><li>Building an Agentic RAG LLM using Ollama</li><li>Creating a Streamlit chat UI</li></ol><h3>What is Elastic and Why Use It as a Vector Database?</h3><p>Elasticsearch is an open-source, distributed search and analytics engine built for speed, scale, and AI-powered applications.</p><p>As a modern retrieval platform, Elasticsearch supports:</p><ul><li>Structured and unstructured data</li><li>Real-time indexing and search</li><li>Vector search and hybrid retrieval</li><li>Observability and security analytics</li><li>AI-driven and RAG-based applications</li></ul><p>Because Elasticsearch supports <strong><em>dense_vector</em></strong> fields and <strong><em>cosine similarity scoring</em></strong>, it can act as a powerful vector database for RAG architecture.</p><p>Instead of managing separate tools for search, vector storage, and analytics, Elastic consolidates everything.</p><p>That’s a major advantage for production-grade Agentic AI systems.</p><h3>What is an Elastic Agent?</h3><p>Elastic Agent is a unified data collection and orchestration agent within the Elastic ecosystem.</p><p>With Elastic Agent, you can:</p><ul><li>Collect logs, metrics, traces, and documents</li><li>Connect to multiple data sources and integrations</li><li>Query and analyze data dynamically</li><li>Power agentic workflows and AI-driven insights</li></ul><p>In simple terms, if your data lives in Elasticsearch, Elastic Agent helps you reason over it intelligently which is perfect for agentic use cases.</p><h3>Setting Up Elasticsearch Locally (Docker)</h3><p>Let’s start by setting up Elasticsearch and Kibana locally using Docker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*QRA_0JJU0UQoUp2wxsWwig.gif" /><figcaption>Shall we Begin</figcaption></figure><p>Copy following docker-compose.yml and .env</p><pre>version: &quot;3.8&quot;<br>services:<br>elasticsearch:<br>image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}<br>container_name: elasticsearch<br>environment:<br>- node.name=es01<br>- cluster.name=${CLUSTER_NAME}<br>- discovery.type=single-node<br>- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}<br>- xpack.security.enabled=true<br>- xpack.security.http.ssl.enabled=false<br>- xpack.license.self_generated.type=${LICENSE}<br>ports:<br>- &quot;9200:9200&quot;<br>volumes:<br>- esdata:/usr/share/elasticsearch/data<br>kibana:<br>image: docker.elastic.co/kibana/kibana:${STACK_VERSION}<br>container_name: kibana<br>depends_on:<br>- elasticsearch<br>environment:<br>- ELASTICSEARCH_HOSTS=http://elasticsearch:9200<br>- ELASTICSEARCH_USERNAME=kibana_system<br>- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}<br>- XPACK_FLEET_AGENTS_FLEET_SERVER_HOSTS=[&quot;http://fleet-server:8220&quot;]<br>- XPACK_FLEET_AGENTS_ELASTICSEARCH_HOSTS=[&quot;http://elasticsearch:9200&quot;]<br>- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=your-encryption-key<br>- XPACK_REPORTING_ENCRYPTIONKEY=your-key<br>- XPACK_SECURITY_ENCRYPTIONKEY=your-key<br>ports:<br>- &quot;5601:5601&quot;<br>volumes:<br>  esdata:</pre><p>.env</p><pre>STACK_VERSION=9.3.0<br>ELASTIC_PASSWORD=elastic123<br>KIBANA_PASSWORD=kibana123<br>CLUSTER_NAME=docker-cluster<br>LICENSE=basic</pre><h3>What Does This Setup Do?</h3><ul><li>Spins up Elasticsearch and Kibana</li><li>Enables Fleet Server support</li><li>Configures required X-Pack security keys</li><li>Prepares the stack for Elastic Agent integrations</li></ul><p>For now, keep the X-Pack keys as-is. We’ll use them shortly.</p><h3>Start Elasticsearch</h3><p>Run to you command prompt or terminal and follow my lead:</p><ul><li>Run: <strong><em>docker compose up elasticsearch -d</em></strong></li><li>Exec into elasticsearch by using following command:</li><li><strong><em>docker exec -it elasticsearch bin/elasticsearch-reset-password -u kibana_system -i</em></strong></li><li>It will prompt you with question similar to below screenshot, proceed with typing <strong><em>y</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHgwji81lFuB13xscdDG9w.png" /></figure><ul><li>And add your password which you can remember or have saved somewhere</li><li>Lets reflect our changes, run<strong><em> docker compose down</em></strong></li><li>This time we will start both services, to do that run docker compose up -d to make sure we detach from docker logs</li><li>Open your browser and visit: <strong><em>localhost:560</em></strong><em>1</em>, you should be able to see good elastic login screen.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*YGX06PhZElyXUVuyBcT1Dg.png" /><figcaption>Elasticsearch Login screen</figcaption></figure><ul><li>Login using:</li><li>Username: elastic</li><li>Password: elastic123</li></ul><h3>Setting Up Fleet Server (Elastic Agent for Agentic AI)</h3><ul><li>Open your terminal where we ran docker compose commands.</li><li>Exec into kibana pod by running <strong><em>docker exec -it kibana /bin/bash</em></strong></li><li>In kibana’s bash, run <strong><em>bin/kibana-encryption-keys generate</em></strong></li><li>This will generate keys similar to following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TyiwTQ85ACMOTjBJbXk6BA.png" /><figcaption>encryption keys</figcaption></figure><ul><li>We need to add these keys inside our docker-compose.yml</li><li>Refer following screenshot and add these keys by replacing placeholder:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S8a4Tm45sQLgjdXhwcQesg.png" /><figcaption>docker compose image</figcaption></figure><ul><li>Run <strong><em>docker compose down </em></strong>and <strong><em>docker compose up -d</em></strong> to reflect our changes.</li><li>By adding these changes, we will be able to add fleet server integration.</li><li>Inside Kibana, Go to integrations and search for fleet, results should look like below image</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxVrzNHzfUFTNwRqRF4Ksw.png" /><figcaption>Integrations page</figcaption></figure><ul><li>Click on Fleet server and it should open up something like below, and click on Add fleet server</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8gv1BI6ag67wqWXpdBQVw.png" /><figcaption>Fleet server page</figcaption></figure><ul><li>Add following configuration, you can name your integration and we will add new host for agent policy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPAJzdH3UJ-nB7y_nDxWUQ.png" /><figcaption>Fleet server integration page</figcaption></figure><ul><li>We will see following pop-up, and yes we will add elastic agent right now.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*StomdBCyBxXHwsJSl4-64A.png" /><figcaption>Fleet server integration</figcaption></figure><ul><li>Elastic will redirect us to this page, click on Add agent</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffMY0-KYZio99oI872GTVQ.png" /><figcaption>Fleet server list page</figcaption></figure><ul><li>By now you will have sidebar, with following instructions:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2p1g3b9AjyrT-OgLZyoSg.png" /><figcaption>Add Fleet server sidebar</figcaption></figure><ul><li>You will be able to find <a href="http://fleet-server:8220/">http://fleet-server:8220</a> configured, reason?</li><li>Earlier in our docker-compose we add environment variable</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S8a4Tm45sQLgjdXhwcQesg.png" /><figcaption>docker compose instructions</figcaption></figure><ul><li>This is helping us to by pass https url requirement. Feel free to remove it if you want to use https url</li><li>Lets generate service token by clicking on generate service token button.</li><li>Copy the token and paste in following docker command along with policy ID which will be found in installation command, following screenshot will guide you:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*KKdusSoNnle44JqtmVhezg.png" /><figcaption>Service token instruction</figcaption></figure><ul><li>Run following docker command to start fleet server:</li></ul><pre>docker run -d -p 8220:8220 - name fleet-server -e FLEET_SERVER_ENABLE=true -e FLEET_SERVER_POLICY_ID=fleet-server-policy -e FLEET_SERVER_ELASTICSEARCH_HOST=http://host.docker.internal:9200 -e KIBANA_HOST=http://host.docker.internal:5601 -e FLEET_SERVER_SERVICE_TOKEN=your-token -e FLEET_INSECURE=true -e FLEET_SERVER_POLICY_ID=your-id docker.elastic.co/elastic-agent/elastic-agent:9.3.0</pre><ul><li>Once configured and running, your sidebar will have turned green at the bottom in confirm connection section</li><li>Superrr, you have setup everything for our Agentic and RAG:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*dk6YmOk2hZPl-IZGnV2ysg.gif" /><figcaption>Superr gif</figcaption></figure><h3>Creating a Vector Index for RAG in Elasticsearch</h3><p>Click on top left hamburger menu, click on Dev tools, you may have to scroll a little to see it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*RHMFTlHr0VNq0HOvcqoLCw.png" /><figcaption>Dev tools sidebar</figcaption></figure><p>Now, paste following script to add vector index in Elasticsearch</p><pre>PUT rag-pdf-docs<br>{<br>  &quot;mappings&quot;: {<br>    &quot;properties&quot;: {<br>      &quot;content&quot;: {<br>        &quot;type&quot;: &quot;text&quot;<br>      },<br>      &quot;embedding&quot;: {<br>        &quot;type&quot;: &quot;dense_vector&quot;,<br>        &quot;dims&quot;: 384,<br>        &quot;index&quot;: true,<br>        &quot;similarity&quot;: &quot;cosine&quot;<br>      },<br>      &quot;doc_id&quot;: {<br>        &quot;type&quot;: &quot;keyword&quot;<br>      },<br>      &quot;doc_name&quot;: {<br>        &quot;type&quot;: &quot;keyword&quot;<br>      },<br>      &quot;page&quot;: {<br>        &quot;type&quot;: &quot;integer&quot;<br>      },<br>      &quot;chunk_id&quot;: {<br>        &quot;type&quot;: &quot;keyword&quot;<br>      },<br>      &quot;source&quot;: {<br>        &quot;type&quot;: &quot;keyword&quot;<br>      },<br>      &quot;timestamp&quot;: {<br>        &quot;type&quot;: &quot;date&quot;<br>      }<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvsrfyR7IuRJG8a-pXL45w.png" /><figcaption>RAG query search</figcaption></figure><p>You’ve now created a vector-enabled index for your <strong>RAG architecture</strong>. Its time write some code to do RAG and agentic messages</p><h3>Ingesting PDFs into Elasticsearch as Embeddings</h3><p>Install all dependencies from <strong><em>requirements.txt</em></strong> in your python environment as below:</p><pre>pypdf<br>streamlit<br>ollama<br>elasticsearch<br>sentence-transformers</pre><p>This script:</p><ul><li>Reads PDFs</li><li>Chunks text</li><li>Generates embeddings using Sentence Transformers</li><li>Stores content + vectors inside Elasticsearch</li></ul><p>we will add following code:</p><pre>import os<br>from pypdf import PdfReader<br>from sentence_transformers import SentenceTransformer<br>from elasticsearch import Elasticsearch<br>from uuid import uuid4<br>from datetime import datetime<br><br><br># ---------- CONFIG ----------<br>DOCS_DIR = &quot;docs&quot;<br>ES_INDEX = &quot;rag-pdf-docs&quot;<br>ES_URL = &quot;http://localhost:9200&quot;<br><br><br>es = Elasticsearch(<br>    ES_URL,<br>    basic_auth=(os.getenv(&quot;ES_USER&quot;), os.getenv(&quot;ES_PASS&quot;))<br>)<br>model = SentenceTransformer(&quot;all-MiniLM-L6-v2&quot;)<br>def chunk_text(text, chunk_size=500, overlap=50):<br>    chunks = []<br>    start = 0<br><br>    while start &lt; len(text):<br>        end = start + chunk_size<br>        chunks.append(text[start:end])<br>        start = end - overlap<br>    return chunks<br><br>def ingest_pdf(pdf_path):<br>    reader = PdfReader(pdf_path)<br>    doc_id = str(uuid4())<br>    doc_name = os.path.basename(pdf_path)<br>    print(f&quot;Ingesting: {doc_name}&quot;)<br>    for page_num, page in enumerate(reader.pages):<br>        text = page.extract_text()<br>        if not text:<br>            continue<br>        chunks = chunk_text(text)<br>        for chunk_idx, chunk in enumerate(chunks):<br>            embedding = model.encode(chunk).tolist()<br>            es.index(<br>                index=ES_INDEX,<br>                refresh=False,<br>                document={<br>                    &quot;content&quot;: chunk,<br>                    &quot;embedding&quot;: embedding,<br>                    &quot;doc_id&quot;: doc_id,<br>                    &quot;doc_name&quot;: doc_name,<br>                    &quot;page&quot;: page_num + 1,<br>                    &quot;chunk_id&quot;: f&quot;{doc_id}_{page_num}_{chunk_idx}&quot;,<br>                    &quot;source&quot;: &quot;pdf&quot;,<br>                    &quot;timestamp&quot;: datetime.utcnow()<br>                }<br>            )<br><br><br>def ingest_directory(directory_path):<br>    pdf_files = [<br>        os.path.join(directory_path, f)<br>        for f in os.listdir(directory_path)<br>        if f.lower().endswith(&quot;.pdf&quot;)<br>    ]<br>    if not pdf_files:<br>        print(&quot;No PDF files found.&quot;)<br>        return<br>    for pdf in pdf_files:<br>        ingest_pdf(pdf)<br>    es.indices.refresh(index=ES_INDEX)<br>    print(&quot;Ingestion complete.&quot;)<br># ---------- RUN ----------<br>if __name__ == &quot;__main__&quot;:<br>    ingest_directory(DOCS_DIR)<br><br></pre><p>After ingestion, you can validate with:</p><pre>GET rag-pdf-docs/_search<br>{<br>  &quot;query&quot;: {<br>    &quot;match&quot;: {<br>      &quot;content&quot;: &quot;your question&quot;<br>    }<br>  }<br>}</pre><h3>Implementing Hybrid Search (Keyword + Vector)</h3><p>A strong RAG model benefits from hybrid retrieval.</p><p>Below <em>hybrid_search()</em> function combines:</p><ul><li>Traditional keyword match</li><li>Cosine similarity vector scoring</li></ul><p>This enables Elasticsearch to function as a <em>full hybrid</em> vector database for RAG LLM systems.</p><pre>def hybrid_search(query, top_k=5):<br>    query_embedding = model.encode(query).tolist()<br><br><br>    body = {<br>        &quot;size&quot;: top_k,<br>        &quot;query&quot;: {<br>            &quot;bool&quot;: {<br>                &quot;should&quot;: [<br>                    {&quot;match&quot;: {&quot;content&quot;: query}},<br>                    {<br>                        &quot;script_score&quot;: {<br>                            &quot;query&quot;: {&quot;match_all&quot;: {}},<br>                            &quot;script&quot;: {<br>                                &quot;source&quot;: &quot;cosineSimilarity(params.q, &#39;embedding&#39;) + 1.0&quot;,<br>                                &quot;params&quot;: {&quot;q&quot;: query_embedding}<br>                            }<br>                        }<br>                    }<br>                ]<br>            }<br>        }<br>    }<br><br><br>    res = es.search(index=ES_INDEX, body=body)<br>    return [hit[&quot;_source&quot;][&quot;content&quot;] for hit in res[&quot;hits&quot;][&quot;hits&quot;]]</pre><h3>Building the Agentic RAG LLM (Ollama + Qwen3)</h3><p>For this tutorial, we will be running Qwen3 model via Ollama, please make sure to install ollama by clicking <a href="http://ollama.com/download">here</a></p><p>Adding our Agentic approach, we will be using following code to call our agent:</p><p>Create a <strong>utils.py</strong> file and add following code</p><pre>from elastic_rag import hybrid_search<br>from ollama import chat<br>from ollama import ChatResponse<br>import re<br><br><br>def call_qwen(prompt):<br>    response: ChatResponse = chat(model=&#39;qwen3&#39;, messages=[<br>    {<br>        &#39;role&#39;: &#39;user&#39;,<br>        &#39;content&#39;: prompt,<br>    },<br>    ])<br>    print(response[&#39;message&#39;][&#39;content&#39;])<br>    cleaned_content = re.sub(r&quot;&lt;think&gt;.*?&lt;/think&gt;\n?&quot;, &quot;&quot;, response.message.content, flags=re.DOTALL)<br>    return cleaned_content<br><br><br><br><br>def agentic_rag(question):<br>    context_chunks = hybrid_search(question)<br><br><br>    context = &quot;\n\n&quot;.join(context_chunks)<br><br><br>    prompt = f&quot;&quot;&quot;<br>You are an AI assistant answering questions based ONLY on the provided context.<br><br><br>Context:<br>{context}<br><br><br>Question:<br>{question}<br>&quot;&quot;&quot;<br><br><br>    return call_qwen(prompt)</pre><p>As our agent is ready to answer our queries, why not give our agent a good UI?</p><p>Streamlit is one of the best library used in python for orchestrating chatting environment.</p><p>Create a <strong>main.py</strong> file and add following streamlit UI code</p><pre>import streamlit as st<br>from utils import agentic_rag<br><br><br>st.set_page_config(page_title=&quot;Elastic RAG Agent&quot;, layout=&quot;wide&quot;)<br>st.title(&quot;📄 Elastic Agentic RAG Assistant&quot;)<br><br><br>if &quot;messages&quot; not in st.session_state:<br>    st.session_state.messages = []<br><br><br>for msg in st.session_state.messages:<br>    with st.chat_message(msg[&quot;role&quot;]):<br>        st.write(msg[&quot;content&quot;])<br><br><br>query = st.chat_input(&quot;Ask something from your PDFs&quot;)<br><br><br>if query:<br>    with st.chat_message(&quot;user&quot;):<br>        st.write(query)<br><br><br>    st.session_state.messages.append(<br>        {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: query}<br>    )<br><br><br>    answer = agentic_rag(query)<br><br><br>    with st.chat_message(&quot;assistant&quot;):<br>        st.write(answer)<br><br><br>    st.session_state.messages.append(<br>        {&quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: answer}<br>    )</pre><p>When we run our app, i.e. <strong><em>streamlit run main.py</em></strong> we will be able to query just like following screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SyMcgvah1AkDAQqANN95cw.png" /><figcaption>Output image — Streamlit</figcaption></figure><p>You now have:</p><ul><li>Elasticsearch as vector database</li><li>Hybrid RAG retrieval</li><li>Agentic AI orchestration</li><li>Local LLM inference via Ollama</li><li>Clean Streamlit chat UI</li></ul><p>All running locally.</p><h3>Let’s Summarize: Elastic for Modern RAG Architecture</h3><p>In just four simple steps, we built a powerful Agentic RAG system using Elastic:</p><ul><li>Elasticsearch as a vector store</li><li>Elastic Agent + Fleet Server for orchestration</li><li>Ollama for local LLM inference</li><li>Streamlit for chat UI</li><li>No external vector DBs. No SaaS lock-in. One unified stack.</li></ul><p>Its time to Celebrate!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*lUhhxD2Q_9WRT7z3lf9-rQ.gif" /><figcaption>Celebrate gif</figcaption></figure><h3>What’s Next?</h3><p>I highly recommend exploring Elastic Agent Builder, where you can build similar pipelines without writing code(whispers)<em> you can build everything without any coding expertise..</em>😉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1IsjdzAGtuiDIkMaMztXtw.png" /><figcaption>Elastic Agent Builder image</figcaption></figure><p>Try it out by yourself without signing up right <a href="https://www.elastic.co/demo-gallery/elastic-agent-builder">here</a></p><p>All source code for this tutorial is available in the GitHub repository click <a href="https://github.com/Horizon733/Elastic-blogathon">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32bde4ba891c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add Buttons of Rasa chatbot in Android]]></title>
            <link>https://medium.com/@dishant_gandhi/how-to-add-buttons-of-rasa-chatbot-in-android-b2c128dc47b1?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2c128dc47b1</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[rasa]]></category>
            <category><![CDATA[button]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[covid19]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Mon, 19 Oct 2020 07:13:15 GMT</pubDate>
            <atom:updated>2020-10-19T07:13:15.887Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Internet, I will be making many add-ons tutorials regarding Android with Rasa chatbot from now on since many stuffs of Android and Rasa are left to be covered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*xsc7ieq-_xr6ounW.jpg" /><figcaption><a href="https://www.freepik.com/free-vector/artificial-intelligence-isometric-ai-robot-mobile-phone-screen-chatbot-app_3629606.htm#page=1&amp;query=chatbot&amp;position=12">Freepik</a></figcaption></figure><p>I would love to share this with you all! Hope you all like this.</p><p>An Overview How this is going to work!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F90RshdbXYbc&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D90RshdbXYbc&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/29cf0907e6d0051737097377370146f1/href">https://medium.com/media/29cf0907e6d0051737097377370146f1/href</a></iframe><p>So, get ready for an Awesome Journey into Android with Rasa (Again!!)lol</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F7744662&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fthe-good-wife-lockart-alicia-fasten-seatbelts-gif-7744662&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F64180efd371de7afff60a0b569ffa0e3%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/101b0ef8e8f548f2decb95815e5ca02d/href">https://medium.com/media/101b0ef8e8f548f2decb95815e5ca02d/href</a></iframe><p>Let’s get started!</p><p>Open your Android Project of Covid bot!</p><h4>Step 1: UI for Bot Response and Button list item</h4><ul><li>We will be adding RecyclerView to view all buttons</li><li>Add the following code snippet into your bot_response layout</li></ul><pre>&lt;androidx.recyclerview.widget.RecyclerView<br>    <em>android:id</em>=&quot;@+id/button_list&quot;<br>    <em>android:layout_width</em>=&quot;match_parent&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot; /&gt;</pre><ul><li>Also, Add a extra parent layout of Linear Layout as Linear Layout it will look like this:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcae56022ff24eccb4b40c66cb7e7228/href">https://medium.com/media/fcae56022ff24eccb4b40c66cb7e7228/href</a></iframe><ul><li>Now, to create button list item layout</li></ul><pre>&lt;?<em>xml version</em>=&quot;1.0&quot; <em>encoding</em>=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout <em>xmlns:android</em>=&quot;http://schemas.android.com/apk/res/android&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:layout_margin</em>=&quot;8dp&quot;<br>    <em>xmlns:app</em>=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    <em>xmlns:tool</em>=&quot;http://schemas.android.com/tools&quot;&gt;<br>    &lt;com.google.android.material.button.MaterialButton<br>        <em>android:id</em>=&quot;@+id/payload_button&quot;<br>        <em>android:layout_width</em>=&quot;wrap_content&quot;<br>        <em>android:layout_height</em>=&quot;wrap_content&quot;<br>      <em>style</em>=&quot;@style/Widget.MaterialComponents.Button.OutlinedButton&quot;<br>        <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>        <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>        <em>app:layout_constraintTop_toTopOf</em>=&quot;parent&quot;<br>        <em>tool:text</em>=&quot;Button&quot;/&gt;<br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;</pre><ul><li>I have used material button to make UI simple and cool!</li><li>Material Design library is awesome! ( Do have a look at it and try it)</li><li>Let’s move to step 2….</li></ul><h4><strong>Step 2: Adding Buttons in Bot Response Class</strong></h4><ul><li>Adding an inner class in BotResponse class</li></ul><pre><em>class </em>BotResponse(<br>    <em>var </em>recipient_id: String,<br>    <em>var </em>text: String,<br>    <em>var </em>buttons: <em>List</em>&lt;Buttons&gt;<br>){<br><br>    <em>inner class </em>Buttons(<em>var </em>payload: String, <em>var </em>title: String)<br><br>}</pre><ul><li>Your code now look like this!</li><li>This is a great progress already completed 50% work.</li><li>Now, main arc for adding buttons</li></ul><h4>Step 3: Creating adapter for Recycler View</h4><ul><li>We will need to create an adapter for buttons to display</li><li>So, we will be creating whole recyclerview class inside MainActivity instead of creating separately. Why?🤔</li><li>If we <strong>create recycler view adapter</strong> as <strong>different</strong> it will be <strong>difficult</strong> to <strong>access sendMessage</strong> method which is in <strong>MainActivity</strong></li><li>So, let’s add it as inner class(Kotlin) for java just make public class inside MainActivity. Code will be same!</li></ul><pre><em>inner class </em>ButtonRecyclerView(<em>var </em>context: Context, <em>var </em>buttons: <em>List</em>&lt;BotResponse.Buttons&gt;) :<br>    RecyclerView.Adapter&lt;ButtonRecyclerView.ButtonViewHolder&gt;() {<br><br><br>    <em>override fun </em>onCreateViewHolder(parent: ViewGroup, viewType: Int): ButtonViewHolder {<br>        <em>val </em>view =<br>            LayoutInflater.from(context).inflate(R.layout.<em>button_list_item</em>, parent, <em>false</em>)<br>        <em>return </em>ButtonViewHolder(view)<br><br>    }<br><br>    <em>override fun </em>onBindViewHolder(holder: ButtonViewHolder, position: Int) {<br>        <em>val </em>payload_button = buttons[position]<br>        holder.button.text = payload_button.title<br>        holder.button.setOnClickListener {<br>            sendMessage(payload_button.payload)<br>        }<br>    }<br><br>    <em>override fun </em>getItemCount(): Int {<br>        buttons.isEmpty() ?: <em>return </em>-1<br>        <em>return </em>buttons.size<br><br>    }<br><br>    <em>inner class </em>ButtonViewHolder(view: View) : RecyclerView.ViewHolder(view) {<br>        <em>val </em>button = view.findViewById&lt;MaterialButton&gt;(R.id.<em>payload_button</em>)<br>    }<br>}</pre><ul><li>Your MainActivity might look this:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5dae48101d84972fba6c1731262a84d9/href">https://medium.com/media/5dae48101d84972fba6c1731262a84d9/href</a></iframe><ul><li>Let’s add the icing on waffle! Making this work</li></ul><h4>Step 4: Make it work</h4><ul><li>Since, recycler view adapter has been added now it time to initialize our recyclerview, add adapter, and layout manager</li><li>Declaring Recycler View(On start of our class)</li></ul><pre><em>private lateinit var </em>recyclerView: RecyclerView</pre><ul><li>Checking buttons not null and calling adapter</li></ul><pre><em>if </em>(botResponse.buttons != <em>null</em>) {<br>    <em>val </em>buttonRecyclerView =<br>        ButtonRecyclerView(<em>this</em>@MainActivity, botResponse.buttons)<br>    recyclerView = findViewById(R.id.<em>button_list</em>)<br>    recyclerView.adapter = buttonRecyclerView<br>    <em>val </em>layoutManager = LinearLayoutManager(<em>this</em>@MainActivity)<br>    layoutManager.orientation = LinearLayoutManager.<em>HORIZONTAL<br>    </em>recyclerView.<em>layoutManager </em>= layoutManager<br>}</pre><p>Step 5: Run!</p><p>Your bot will be working and try to click on button. Did it send some message?</p><p>Wow, it has started working. Great Job!</p><p>Useful Links:</p><ul><li><a href="https://material.io/design">Material Design</a></li></ul><p>Just comment I will get you ASAP!</p><p>Loved this Do give some claps….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2c128dc47b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rasa Chatbot Tutorial: Bonus!!]]></title>
            <link>https://medium.com/@dishant_gandhi/rasa-chatbot-tutorial-bonus-e171416ecc25?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/e171416ecc25</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[rasa]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Fri, 09 Oct 2020 14:01:06 GMT</pubDate>
            <atom:updated>2020-10-09T14:01:06.340Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Creators, Hope you all are doing well.<br>I got a lot of queries about creating a server and hosting chatbot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*35SDpLIq6NH_k8kC.jpg" /><figcaption><a href="https://www.vecteezy.com/vector-art/1308422-chatbot-technology-isometric-illustration">Vecteezy</a></figcaption></figure><p>So, I planned to create a bonus tutorial on hosting chatbot on you own pc without any kind of fees!</p><p>My most of tuts will be budget friendly😄.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F15388068&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fican-afford-that-affordable-cheap-low-cost-low-priced-gif-15388068&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F95da9d5597ad13e676e572228769b7ce%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/533575beefb5e65be1af0c35c7469546/href">https://medium.com/media/533575beefb5e65be1af0c35c7469546/href</a></iframe><p>As always….</p><h3>Lets Begin</h3><p><strong>Step 1: Download required softwares</strong></p><ul><li><a href="https://ngrok.com/download">Ngrok</a></li><li><a href="https://www.postman.com/downloads/">Postman</a></li></ul><p><strong>Step 2: Ngrok setup</strong></p><ul><li>After downloading Ngrok, we can see there is .exe file present in it.</li><li>Now, unzip</li><li>Copy .exe file and paste it into system32 (For Windows Users)<br>For Mac: <br>Try following command(Honestly I am not familiar with Mac OS for ngrok. Apologies!)</li></ul><blockquote>$ brew cask install ngrok</blockquote><ul><li>Now, add your ngrok.exe location to Environment Variables -&gt; Path</li><li>We can now run ngrok and tunnel our pc as server.</li></ul><p><strong>Step 3: What is Postman? Is it Really a “Postman”</strong></p><ul><li>Haha, Yes it is! It sends data to url we request and sends us response from that url.</li><li>This application help us to test our endpoints url works or not.</li><li>We will go through it.</li><li>Installation is simple. DIY!😊</li></ul><p><strong>Step 4: Chatbot hosting with ngrok!</strong></p><ul><li>Start Actions and Endpoints by following commands in pycharm or any other terminal.</li></ul><blockquote>rasa run actions<br>rasa run -m models --enable-api --endpoint endpoints.yml</blockquote><ul><li>Time to turn on server. <br>Run ngrok</li><li>We can see terminal opened.</li><li>Now, <strong>check</strong> which <strong>port</strong> is provided when we ran <strong>endpoints command</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*elX8k7LzOqlYRNFh8bppkw.png" /></figure><ul><li>For me it was <strong>5005</strong></li><li>Go to ngrok terminal add the following command to turn server</li><li>ngrok http portNumber</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*wQoBl-7kjp1Xhquy-ZmhqQ.png" /></figure><ul><li>Click enter</li><li>Now, our server is up and running!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*U8aFOimzZT3HcPJKdgW4TA.png" /></figure><p><strong>Step 5: Testing</strong></p><ul><li>Did you saw there are 2 links provided by ngrok one starts with http other with https.</li><li>Both are fine, But! go for https to keep chatting secure..</li><li>Copy https url till .io and paste it instead of localhost:portNumber</li><li>Now, lets test on Postman</li><li>Open Postman and click on +New Request</li><li>Add your https url and then add /webhooks/rest/webhook</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*uqXKwKejTRUjMKn4evS65w.png" /></figure><ul><li>As shown above, We will have to add Body as our message to bot.</li><li>So, select raw, then from the dropdown select JSON.</li><li>Then type message as above image shows.</li><li>Format:</li></ul><blockquote>{<br>“sender”: “droid City”<br>“message”: “Hi”<br>}</blockquote><ul><li>Now, we will get response from our bot in response</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*ZSoewzmEHLVQMEVtB9EAig.png" /></figure><ul><li>By clicking on send we can get our response.</li><li>Let’s check Ngrok terminal what status it shows us…</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*22bbZWeyBe894tpbLkAbmg.png" /></figure><ul><li>Ah, It says 200 OK so we have successfully tested.🥳</li><li>Now, we can use this link in android application, website, etc platforms instead of writing localhost:portNumber.</li></ul><h4>Note: Our Ngrok server can work for 8hrs max. So, we can use this for testing purpose or for small investors meet to pitch your plan!!</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl49JHz7kJvl6MCj3G%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fgood-luck-l49JHz7kJvl6MCj3G&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fl49JHz7kJvl6MCj3G%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="407" frameborder="0" scrolling="no"><a href="https://medium.com/media/73a9eb8c4d3aedb27f43816f56141bc3/href">https://medium.com/media/73a9eb8c4d3aedb27f43816f56141bc3/href</a></iframe><h4>Good Luck!👍</h4><h4>Previous Rasa Tuts:</h4><ol><li><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-1-1010f667c06c">Rasa Chatbot + Android Covid app Tutorial: Part 1</a></li><li><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-2-40b53cab3630">Rasa Chatbot + Android Covid app Tutorial: Part 2</a></li><li><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-3-73c7a69f3c65">Rasa Chatbot + Android Covid app Tutorial: Part 3</a></li></ol><p>Any Questions Do comment <br>Loved it! Give some claps 1,2,50,100 count is one you😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e171416ecc25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rasa Chatbot + Android Covid app Tutorial: Part 2]]></title>
            <link>https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-2-40b53cab3630?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b53cab3630</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[rasa]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Mon, 07 Sep 2020 16:51:12 GMT</pubDate>
            <atom:updated>2020-09-07T16:51:12.033Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Creating Rasa Covid Chatbot from scratch</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/0*JIb8Bcwz1GdNAmhn" /><figcaption><a href="https://www.freepik.com/free-vector/cute-bot-say-users-hello-chatbot-greets-online-consultation_4015765.htm#page=1&amp;query=chatbot&amp;position=0">Source</a></figcaption></figure><p><strong>Which softwares you can install/ use for creating chatbot:</strong><br>1. Pycharm(I will be using)<br>2. Sublime + command line/ Terminal(for Linux/ Mac)<br>3. Other softwares are there too. (But don’t go for jupyter notebook for this purpose)</p><p>I hope you have installed Rasa and know some background of Rasa.</p><p>First and Foremost, Creating rasa project</p><p>Start Typing guys!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F4903969&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Ftyping-jim-carrey-fast-busy-gif-4903969&amp;image=https%3A%2F%2Fc.tenor.com%2Fz4_HKSF6Nx8AAAAC%2Ftyping-jim-carrey.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/09280d758f99c6bfcee28d64fddce5b3/href">https://medium.com/media/09280d758f99c6bfcee28d64fddce5b3/href</a></iframe><p>Open your Command line/ Terminal and write following command in your directory where you want to create Chatbot.</p><blockquote>rasa init</blockquote><p>This will ask you to specify directory for your project. If you are already inside your directory then press Enter without writing anything. Else, specify your directory where you want to add your Chatbot.</p><p>Now, you will have a simple chatbot which can say Hi, Hello and send a cub picture to make you happy. Lol!😂</p><p>We will be creating simple FAQ bot on Covid 19. One of the 2020&#39;s Biggest tragedy!.</p><p>API’s we will be using are as follows:</p><ol><li><a href="https://rapidapi.com/Gramzivi/api/covid-19-data">Rapid API’s Covid data</a> (Registration Needed)!</li><li><a href="https://api.covid19india.org/data.json">Covid India Data</a></li></ol><p>Let’s Start creation of our Bot</p><p>First Step: Intent creation. Open nlu.md file</p><p><strong>What are intents?</strong></p><p><strong>Intents</strong> are intensions/<strong>goals</strong> that <strong>users</strong> will <strong>provide</strong> in their <strong>responses</strong>.</p><p>Have look to <strong>Google’s</strong> definition for intents in chatbot:</p><blockquote><strong>Intent</strong> refers to the goal the customer has in mind when typing in a question or comment</blockquote><ol><li>corona cases information intent</li></ol><p>Our Information will consist Globally and Native(India)</p><pre><em>## intent:corona_cases_info<br></em>- [india](<em>country</em>) corona info<br>- [usa](<em>country</em>)<br>- [uk](<em>country</em>)<br>- [afghanistan](<em>country</em>)<br>- I want to know corona cases in [maharashtra](<em>state</em>)<br>- count of corona cases in [india](<em>country</em>)<br>- [delhi](<em>state</em>) corona case<br>- [karnataka](<em>state</em>) corona info <br>- corona cases in [goa](<em>state</em>)<br>- [harayan](<em>state</em>)<br>- [Andaman and Nicobar Islands](<em>state</em>)<br>- [Andhra Pradesh](<em>state</em>)<br>- [Arunachal Pradesh](<em>state</em>)<br>- [Assam](<em>state</em>)<br>- [Bihar](<em>state</em>)<br>- [Chandigarh](<em>state</em>)<br>- [Chhattisgarh](<em>state</em>)<br>- [Dadra and Nagar Haveli](<em>state</em>)<br>- [Daman and Diu](<em>state</em>)<br>- [Gujarat](<em>state</em>)<br>- [Himachal Pradesh](<em>state</em>)<br>- [Jammu and Kashmir](<em>state</em>)</pre><p>Using entities for names of country and states in India</p><p><em>Syntax:</em></p><p><strong>[value](entity)</strong></p><p>2. Add corona safety intent</p><pre><em>## intent: corona_safety<br></em>- symptoms for corona<br>- how to check if I have corona or not?<br>- what are the common symptoms for corona</pre><p>Here, We added questions or else can be said as user responses</p><p>There are pre-built simple intents provided by Rasa you can check it out above these intents.</p><p>Now, time to add stories. Open stories.md file</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F14484132&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fwait-what-meme-wait-a-minute-gif-14484132&amp;image=https%3A%2F%2Fc.tenor.com%2FIJwsfw7ToiQAAAAd%2Fwait-what.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/64653f6ce8dd89404ba1c0202d42dd69/href">https://medium.com/media/64653f6ce8dd89404ba1c0202d42dd69/href</a></iframe><p>What are Stories? Have heard of Intents but Stories?🤔</p><p>Alright! <br>Stories are the actions that has to be executed when that particular intent is found in user’s response. So, for example we want to add a sequence of actions after a user ask/says something we can add it in following ways:</p><pre><em>## story name<br></em>* intent_name(as it is)<br>  - action_name<br>* intent_name <br>  - action_name</pre><p>🧠Remember the way I have wrote and added indentation maintain it👆. Because it won’t recognise and throw error.</p><ol><li>Adding story for intent “<em>corona_cases_info</em>”</li></ol><pre><em>## corona cases<br></em>* corona_cases_info<br>  - corona_cases_action</pre><p>2. Adding story for intent “ corona safety”</p><pre><em>## corona safety<br></em>* corona_safety<br>  - utter_safety</pre><p>Here, <strong>utter</strong> is added when there are direct responses instead of a whole process created for giving a response. Like, fetching data, processing, appending, then responding. We will see that further. For now relax ☕.</p><p>Remember we added entities in nlu file. Yeah that one, We have to specify them as entities or else chatbot won’t recognize them. So let’s add them</p><p>Open domain.yml file</p><p>Right below the intents gets over write <strong>entities </strong>as follows:</p><pre>entities:<br>  - state<br>  - country</pre><p>We can add as many entities as we want to. But, for now these two are enough.</p><p>Moving ahead….</p><p>Stay in domain file we have to add other things too.</p><p>Go to intents and add the two intents that we created earlier. Just like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Mrx040GWKWVY8aEN_sj6Rw.png" /></figure><p>Keep indentation as it is.</p><p>Now, adding responses, for which intent response/s will be added here? Guess….</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F8838342&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fyup-youknowit-shy-hey-well-gif-8838342&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F8aba09a8617dfdd2aa6ff6a12dc7748a%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a51194af8dc153cf6d64b91e8c74807/href">https://medium.com/media/6a51194af8dc153cf6d64b91e8c74807/href</a></iframe><p>Correct! Its utter_safety. 🥳</p><p>Didn’t got it correct, don’t get disappointed. Happens!😉 First time Right!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2WIBjPeYDFbTxkkjuL9tDQ.png" /></figure><p>I added theese big response. You’ll can add miniature one. Safety matters!</p><p>Now, we need to add all the actions that were added by us in stories file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*Cy-0oYj5IpTBHXrJBBuU5Q.png" /></figure><p>Note:</p><ul><li>I added these pictures instead of code so that you all can check the indentation of each and every code.</li><li>Domain file is important file for a bot. If you create any intent,actions,stories,entities,etc you need to specify them in domain.</li><li>While training the bot, first domain file is looked and then it goes to specified actions, intents, stories and entities</li></ul><p>Ready for some Action!</p><p>Open actions.py file, we are going to add action. Lol</p><p>Here, we are fetching all covid 19 info from an api. below is the Class for that Action.</p><pre>class CoronaCasesInfo(Action):<br><br>     def name(self) -&gt; Text:<br>         return &quot;corona_cases_action&quot;<br><br>     def run(self, dispatcher: CollectingDispatcher,<br>             tracker: Tracker,<br>             domain: Dict[Text, Any]) -&gt; List[Dict[Text, Any]]:<br>         user_message_entity = tracker.latest_message[&#39;entities&#39;]<br>         context = &quot;&quot;<br>         for entity in user_message_entity:<br>             if (entity[&#39;entity&#39;] == &quot;state&quot;):<br>                 url = &quot;https://api.covid19india.org/data.json&quot;<br>                 response = requests.get(url).json()<br>                 state = entity[&#39;value&#39;].title()<br>                 for data in response[&quot;statewise&quot;]:<br>                     if (data[&quot;state&quot;] == state):<br>                         print(&quot;confirmed cases: &quot;, data[&quot;confirmed&quot;])<br>                         context = &quot;Confirmed cases: &quot;+data[&quot;confirmed&quot;]+&quot;\nActive cases: &quot;+data[&quot;active&quot;]+&quot;\nDeaths: &quot;\<br>                                   +data[&quot;deaths&quot;]+&quot;\nRecovered cases: &quot;+data[&quot;recovered&quot;]+&quot;\n TimeStamp: &quot;+data[&quot;lastupdatedtime&quot;]<br>             elif(entity[&#39;entity&#39;]==&quot;country&quot; and entity[&#39;entity&#39;] != &quot;state&quot;):<br>                 url = &quot;https://covid-19-data.p.rapidapi.com/country&quot;<br>                 country = entity[&#39;value&#39;].lower()<br>                 querystring = {&quot;format&quot;: &quot;json&quot;, &quot;name&quot;: country}<br>                 headers = {<br>                     &#39;x-rapidapi-host&#39;: &quot;covid-19-data.p.rapidapi.com&quot;,<br>                     &#39;x-rapidapi-key&#39;: &quot;Add your Rapid API key&quot;<br>                 }<br>                 response = requests.get(url, headers=headers, params=querystring).json()<br><br>                 for data in response:<br>                     date = data[&#39;lastUpdate&#39;]<br>                     dt = date.split(&#39;T&#39;)<br>                     dat = datetime.datetime.strptime(dt[0], &#39;%Y-%m-%d&#39;).strftime(&#39;%d-%m-%Y&#39;)<br>                     context = &quot;Confirmed cases: &quot;+str(data[&quot;confirmed&quot;])+&quot;\nCritical cases: &quot;+str(data[&quot;critical&quot;])+&quot;\nDeaths: &quot;+str(data[&quot;deaths&quot;])+&quot;\nRecovered cases: &quot;+str(data[&quot;recovered&quot;])+&quot;\nLast Update: &quot;+dat<br>         dispatcher.utter_message(text=context)<br>         return []</pre><p>Above, we added 2 api’s to fetch JSON result. This was as per entity values.If it was country then api used was from Rapid API and if it was Indian states then the api was covid19india.</p><p>So, now successfully we can train our bot and get an awesome responses regarding covid-19</p><ol><li>Training the bot</li></ol><p>Open terminal/ command line -&gt; Go to the location where your bot folder is</p><p>Activate your virtual environment (if created)</p><p>We will run <strong><em>“rasa train”</em></strong> to train our bot. It will take few minutes as per system configurations</p><p>Then command line/terminal will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ALfyiNjw0klo0QPtANdHrg.png" /></figure><p>After its complete we can see a message <strong>NLU model training completed</strong></p><p>So, now to test our model.</p><p>Open another terminal. activate your environment.</p><p>Run following two commands in two different terminals.</p><p>1st terminal -&gt; rasa run actions</p><p>2nd terminal -&gt; rasa shell</p><p>What this will do?</p><p>First command will run our Actions in actions.py file.</p><p>Second command will open up a chatting section in our terminal.</p><p>We can now check that our bot is replying proper responses or not.</p><p>It will look like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLRMviQgx19o&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLRMviQgx19o&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f599416b8befc604ee3559c3667439f6/href">https://medium.com/media/f599416b8befc604ee3559c3667439f6/href</a></iframe><p>Congrats! you created covid tracking bot from scratch</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F14425232&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fclapping-congrats-sarcastic-clap-leonardo-di-caprio-gif-14425232&amp;image=https%3A%2F%2Fc.tenor.com%2FskHIRi8nWaAAAAAC%2Fclapping-congrats.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ec60dfb470fb515a8a41d5c1654e899/href">https://medium.com/media/1ec60dfb470fb515a8a41d5c1654e899/href</a></iframe><p>Loved it!♥ Give some claps👏.</p><p>Let me know in comments your experience in creating chatbot.</p><p>Previous Part:</p><h4><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-1-1010f667c06c">Making Chatbot Gui</a></h4><p>Next Part:</p><h4><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-3-73c7a69f3c65">Integrating with Android app</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b53cab3630" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rasa Chatbot + Android Covid app Tutorial: Part 1]]></title>
            <link>https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-1-1010f667c06c?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/1010f667c06c</guid>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[rasa]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[user-interface]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Mon, 07 Sep 2020 16:50:11 GMT</pubDate>
            <atom:updated>2020-12-28T12:39:56.257Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*X3vNx8wloTsR7ac5.jpg" /><figcaption><a href="https://www.freepik.com/premium-vector/virus-corona-illustration_6886398.htm">Freepik Illustration</a></figcaption></figure><p><strong>Welcome!</strong></p><p><strong>This tutorial series will be break down into 3 parts:</strong></p><ol><li>GUI creation and adding functionality to GUI</li><li>Creating chatbot in Rasa</li><li><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-3-73c7a69f3c65">Integrating Rasa Chatbot</a></li></ol><p><strong>Pre-requisite for this tutorial are:</strong></p><ol><li>Basics of Rasa Chatbot</li><li>Python Basics</li><li>Android Studio Basics</li><li>Java basics or Kotlin Basics (In this tutorial I will be teaching in both languages)</li></ol><p>If you don’t know how to install Rasa. Soon I will be adding blog for that too. So, have a tinee tiny patience.</p><p>Let me give you a taste to what an awesome app we all will be creating at the end of this whole tutorial</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fe5j-ZJl2ilo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3De5j-ZJl2ilo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fe5j-ZJl2ilo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/117ae0161695d310c0c811937472f74c/href">https://medium.com/media/117ae0161695d310c0c811937472f74c/href</a></iframe><h3><strong>Want to follow video tutorial?</strong></h3><p>Play below video!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fgib9AZePDE8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dgib9AZePDE8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fgib9AZePDE8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f7a25b8e3c701cf6818df89dced8c01/href">https://medium.com/media/3f7a25b8e3c701cf6818df89dced8c01/href</a></iframe><p><strong>Lets Begin with our First part!</strong></p><h3><strong>Chat GUI creation and Functionality in Android Studio</strong></h3><p>Open Android studio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*rDMFLvHYvvRzTl_Vj_mCMA.png" /><figcaption>Android studio main screen</figcaption></figure><p>Create new project by choosing empty activity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*1oPZsGoV_vXokCw0hz8O3Q.png" /></figure><p>Enter name for your app and language for writing code. Do keep minimum sdk as lollipop since its better to target large audience<br>Click on Finish!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*bu8BF9CIFaecBr1R0ZkYvA.png" /></figure><p>Now, Creating GUI for our chat Activity that indeed will be our Main Activity</p><p>Open build.gradle file of your app module, add following dependency:</p><pre>implementation &#39;com.google.android.material:material:1.2.0&#39;</pre><p>This dependency is for material design this dependency makes UI look awesome!</p><p>Open activity_main xml file and start creating chat UI</p><p>Make sure the parent layout is constraint layout. This layout helps to adjust UI for any kind of screen size</p><p>Adding Appbar:</p><pre>&lt;com.google.android.material.appbar.AppBarLayout<br>    <em>android:id</em>=&quot;@+id/appbar&quot;<br>    <em>android:layout_width</em>=&quot;match_parent&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:theme</em>=&quot;@style/ThemeOverlay.AppCompat.Dark.ActionBar&quot;<br>    <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintTop_toTopOf</em>=&quot;parent&quot;&gt;<br><br>    &lt;androidx.appcompat.widget.Toolbar<br>        <em>android:id</em>=&quot;@+id/toolbar&quot;<br>        <em>android:layout_width</em>=&quot;match_parent&quot;<br>        <em>android:layout_height</em>=&quot;?attr/actionBarSize&quot;<br>        <em>android:background</em>=&quot;?attr/colorPrimary&quot;<br>        <em>app:popupTheme</em>=&quot;@style/ThemeOverlay.AppCompat.Light&quot; &gt;<br><br>        &lt;com.google.android.material.imageview.ShapeableImageView<br>            <em>android:layout_width</em>=&quot;42dp&quot;<br>            <em>android:layout_height</em>=&quot;42dp&quot;<br>            <em>android:padding</em>=&quot;5dp&quot;<br>            <em>android:background</em>=&quot;@drawable/ic_launcher_background&quot;<br>            <em>tools:background</em>=&quot;@tools:sample/backgrounds/scenic&quot;<br>            <em>app:strokeColor</em>=&quot;@color/colorAccent&quot;<br>            <em>app:shapeAppearanceOverlay</em>=&quot;@style/circleImageView&quot;<br>            <em>app:strokeWidth</em>=&quot;1dp&quot;/&gt;<br>        &lt;TextView<br>            <em>android:layout_width</em>=&quot;wrap_content&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:text</em>=&quot;@string/app_name&quot;<br>            <em>android:textColor</em>=&quot;@android:color/white&quot;<br>            <em>android:padding</em>=&quot;16dp&quot;<br>            <em>android:textSize</em>=&quot;16sp&quot;/&gt;<br>    &lt;/androidx.appcompat.widget.Toolbar&gt;<br><br>&lt;/com.google.android.material.appbar.AppBarLayout&gt;</pre><p>Shapeable ImageView will help us to get a circular Imageview</p><p>Add a style for circular Imagview :</p><p>To add it go to values -&gt; styles.xml</p><pre>&lt;style <em>name</em>=&quot;circleImageView&quot; <em>parent</em>=&quot;&quot;&gt;<br>    &lt;item <em>name</em>=&quot;cornerFamily&quot;&gt;rounded&lt;/item&gt;<br>    &lt;item <em>name</em>=&quot;cornerSize&quot;&gt;50%&lt;/item&gt;<br>&lt;/style&gt;</pre><p>Now,add scroll view for our chat messages</p><pre>&lt;androidx.core.widget.NestedScrollView<br>    <em>android:id</em>=&quot;@+id/chatScrollView&quot;<br>    <em>android:layout_width</em>=&quot;match_parent&quot;<br>    <em>android:layout_height</em>=&quot;match_parent&quot;<br>    <em>android:layout_marginTop</em>=&quot;60dp&quot;<br>    <em>android:layout_marginBottom</em>=&quot;80dp&quot;<br>    <em>app:layout_constraintBottom_toTopOf</em>=&quot;@+id/frame&quot;<br>    <em>app:layout_constraintLeft_toLeftOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintRight_toRightOf</em>=&quot;parent&quot;&gt;<br><br>    &lt;LinearLayout<br>        <em>android:id</em>=&quot;@+id/chat_layout&quot;<br>        <em>android:layout_width</em>=&quot;match_parent&quot;<br>        <em>android:layout_height</em>=&quot;wrap_content&quot;<br>        <em>android:orientation</em>=&quot;vertical&quot; /&gt;<br>&lt;/androidx.core.widget.NestedScrollView&gt;</pre><p>Now, adding Edit Text for getting input and send button</p><pre>&lt;FrameLayout<br>    <em>android:id</em>=&quot;@+id/frame&quot;<br>    <em>android:layout_width</em>=&quot;0dp&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>app:layout_constraintBottom_toBottomOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintLeft_toLeftOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintRight_toRightOf</em>=&quot;parent&quot;&gt;<br>    &lt;View<br>        <em>android:id</em>=&quot;@+id/view&quot;<br>        <em>android:layout_width</em>=&quot;0dp&quot;<br>        <em>android:layout_height</em>=&quot;2dp&quot;<br>        <em>android:background</em>=&quot;#000000&quot;<br>        <em>app:layout_constraintBottom_toTopOf</em>=&quot;@+id/layout_chatbox&quot;<br>        <em>app:layout_constraintLeft_toLeftOf</em>=&quot;parent&quot;<br>        <em>app:layout_constraintRight_toRightOf</em>=&quot;parent&quot; /&gt;<br>    &lt;LinearLayout<br>        <em>android:id</em>=&quot;@+id/layout_chatbox&quot;<br>        <em>android:layout_width</em>=&quot;match_parent&quot;<br>        <em>android:layout_height</em>=&quot;wrap_content&quot;<br>        <em>android:background</em>=&quot;#ffffff&quot;<br>        <em>android:minHeight</em>=&quot;48dp&quot;<br>        <em>android:orientation</em>=&quot;horizontal&quot;&gt;<br><br>        &lt;com.google.android.material.textfield.TextInputLayout<br>            <em>android:layout_width</em>=&quot;0dp&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:layout_gravity</em>=&quot;center&quot;<br>            <em>android:layout_marginLeft</em>=&quot;16dp&quot;<br>            <em>android:layout_marginRight</em>=&quot;16dp&quot;<br>            <em>android:layout_weight</em>=&quot;1&quot;<br>            <em>android:background</em>=&quot;@android:color/transparent&quot;<br>            <em>app:boxStrokeColor</em>=&quot;#878787&quot;<br>            <em>android:maxLines</em>=&quot;6&quot;&gt;<br><br>            &lt;com.google.android.material.textfield.TextInputEditText<br>                <em>android:id</em>=&quot;@+id/edittext_chatbox&quot;<br>                <em>android:layout_width</em>=&quot;match_parent&quot;<br>                <em>android:layout_height</em>=&quot;match_parent&quot;<br>                <em>android:hint</em>=&quot;Enter message&quot;<br>                <em>android:background</em>=&quot;@android:color/transparent&quot;<br>                <em>android:maxLines</em>=&quot;6&quot; /&gt;<br>        &lt;/com.google.android.material.textfield.TextInputLayout&gt;<br><br>        &lt;com.google.android.material.floatingactionbutton.FloatingActionButton<br>            <em>android:id</em>=&quot;@+id/send_button&quot;<br>            <em>android:layout_width</em>=&quot;wrap_content&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:layout_gravity</em>=&quot;bottom&quot;<br>            <em>android:layout_margin</em>=&quot;8dp&quot;<br>            <em>android:src</em>=&quot;@drawable/ic_send&quot;<br>            <em>android:background</em>=&quot;?attr/selectableItemBackground&quot;<br>            <em>android:clickable</em>=&quot;true&quot;<br>            <em>android:focusable</em>=&quot;true&quot;<br>            <em>android:gravity</em>=&quot;center&quot;<br>            <em>app:fabSize</em>=&quot;normal&quot; /&gt;<br><br>    &lt;/LinearLayout&gt;<br>&lt;/FrameLayout&gt;</pre><p>Creating a send icon is easy</p><ol><li>Right on <strong>drawable</strong> folder -&gt; Go to <strong>New</strong> -&gt; Click on <strong>Vector Asset</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*c6rid36MtWwLaQ96mptAtw.png" /></figure><p>2. click on android icon opposite to <strong>Clip Art</strong>. -&gt; Enter <strong>send</strong> in search box -&gt; select the <strong>send icon</strong> -&gt; Click on <strong>Ok</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*LA4DB6htAVOM6BXTBxd3zw.png" /></figure><p>Change to any color you want to by click on 000000 just opposite to Color</p><p>It will open the following dialog box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*RF3e132l9NxjGBgKg7_5dQ.png" /></figure><p>Adding a tiny line on top of our Chat box</p><pre>&lt;View<br>    <em>android:id</em>=&quot;@+id/view&quot;<br>    <em>android:layout_width</em>=&quot;0dp&quot;<br>    <em>android:layout_height</em>=&quot;2dp&quot;<br>    <em>android:background</em>=&quot;#dfdfdf&quot;<br>    <em>app:layout_constraintBottom_toTopOf</em>=&quot;@+id/layout_chatbox&quot;<br>    <em>app:layout_constraintLeft_toLeftOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintRight_toRightOf</em>=&quot;parent&quot; /&gt;<br></pre><p>Creating Layout and shapes for our chats</p><p>Chat Shape</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*uEXPBs3Psw2wDtJT5l_1Nw.png" /></figure><p>Our code’s output will look like this</p><p>Bot’s Message container</p><pre>&lt;shape <em>xmlns:android</em>=&quot;http://schemas.android.com/apk/res/android&quot;<br>    <em>android:shape</em>=&quot;rectangle&quot;&gt;<br><br>    &lt;corners<br>        <em>android:bottomLeftRadius</em>=&quot;15dp&quot;<br>        <em>android:bottomRightRadius</em>=&quot;15dp&quot;<br>        <em>android:topLeftRadius</em>=&quot;0dp&quot;<br>        <em>android:topRightRadius</em>=&quot;15dp&quot; /&gt;<br><br>    &lt;solid <em>android:color</em>=&quot;#DCDCDC&quot;/&gt;<br><br>&lt;/shape&gt;</pre><p>User’s Message container: It is same as our bot message container I just changed the color of shape</p><pre>&lt;shape <em>xmlns:android</em>=&quot;http://schemas.android.com/apk/res/android&quot;<br><em>android:shape</em>=&quot;rectangle&quot;&gt;<br><br>&lt;corners<br>    <em>android:bottomLeftRadius</em>=&quot;15dp&quot;<br>    <em>android:bottomRightRadius</em>=&quot;15dp&quot;<br>    <em>android:topLeftRadius</em>=&quot;15dp&quot;<br>    <em>android:topRightRadius</em>=&quot;0dp&quot; /&gt;<br><br>&lt;solid <em>android:color</em>=&quot;@color/colorAccent&quot;/&gt;<br><br>&lt;/shape&gt;</pre><p>Layout creation for Bot and User <br>Bot:</p><pre>&lt;?<em>xml version</em>=&quot;1.0&quot; <em>encoding</em>=&quot;utf-8&quot;?&gt;<br>&lt;FrameLayout <em>xmlns:android</em>=&quot;http://schemas.android.com/apk/res/android&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>xmlns:tools</em>=&quot;http://schemas.android.com/tools&quot;<br>    <em>xmlns:app</em>=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    <em>android:layout_margin</em>=&quot;4dp&quot;&gt;<br><br>    &lt;LinearLayout<br>        <em>android:id</em>=&quot;@+id/chat_msg_layout&quot;<br>        <em>android:layout_width</em>=&quot;wrap_content&quot;<br>        <em>android:layout_height</em>=&quot;wrap_content&quot;<br>        <em>android:layout_gravity</em>=&quot;start|center_vertical&quot;<br>        <em>android:layout_marginTop</em>=&quot;4dp&quot;<br>        <em>android:layout_marginBottom</em>=&quot;4dp&quot;<br>        <em>android:layout_marginEnd</em>=&quot;16dp&quot;<br>        <em>android:layout_marginStart</em>=&quot;8dp&quot;<br>        <em>android:background</em>=&quot;@drawable/bot_chat&quot;<br>        <em>android:gravity</em>=&quot;start|center_vertical&quot;<br>        <em>android:orientation</em>=&quot;horizontal&quot;&gt;<br><br>        &lt;TextView<br>            <em>android:id</em>=&quot;@+id/chat_msg&quot;<br>            <em>android:layout_width</em>=&quot;wrap_content&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:layout_marginTop</em>=&quot;4dp&quot;<br>            <em>android:padding</em>=&quot;12dp&quot;<br>            <em>android:layout_gravity</em>=&quot;start&quot;<br>            <em>tools:text</em>=&quot;@tools:sample/full_names&quot;<br>            <em>android:textColor</em>=&quot;@color/colorPrimaryDark&quot;<br>            <em>android:textSize</em>=&quot;16sp&quot; /&gt;<br>        &lt;TextView<br>            <em>android:id</em>=&quot;@+id/message_time&quot;<br>            <em>android:layout_width</em>=&quot;wrap_content&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:layout_gravity</em>=&quot;end|bottom&quot;<br>            <em>android:layout_margin</em>=&quot;4dp&quot;<br>            <em>tools:text</em>=&quot;@tools:sample/date/hhmm&quot;<br>            <em>android:textColor</em>=&quot;@color/colorPrimary&quot;<br>            <em>android:textSize</em>=&quot;12sp&quot; /&gt;<br><br>    &lt;/LinearLayout&gt;<br>&lt;/FrameLayout&gt;</pre><p>Bot:</p><pre>&lt;?<em>xml version</em>=&quot;1.0&quot; <em>encoding</em>=&quot;utf-8&quot;?&gt;<br>&lt;FrameLayout <em>xmlns:android</em>=&quot;http://schemas.android.com/apk/res/android&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>xmlns:tools</em>=&quot;http://schemas.android.com/tools&quot;<br>    <em>xmlns:app</em>=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    <em>android:layout_margin</em>=&quot;4dp&quot;&gt;<br><br>    &lt;LinearLayout<br>        <em>android:id</em>=&quot;@+id/chat_msg_layout&quot;<br>        <em>android:layout_width</em>=&quot;wrap_content&quot;<br>        <em>android:layout_height</em>=&quot;wrap_content&quot;<br>        <em>android:layout_gravity</em>=&quot;end|center_vertical&quot;<br>        <em>android:layout_marginTop</em>=&quot;4dp&quot;<br>        <em>android:layout_marginBottom</em>=&quot;4dp&quot;<br>        <em>android:layout_marginEnd</em>=&quot;16dp&quot;<br>        <em>android:layout_marginStart</em>=&quot;8dp&quot;<br>        <em>android:background</em>=&quot;@drawable/user_chat&quot;<br>        <em>android:gravity</em>=&quot;start|center_vertical&quot;<br>        <em>android:orientation</em>=&quot;horizontal&quot;&gt;<br><br>        &lt;TextView<br>            <em>android:id</em>=&quot;@+id/chat_msg&quot;<br>            <em>android:layout_width</em>=&quot;wrap_content&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:padding</em>=&quot;12dp&quot;<br>            <em>android:layout_gravity</em>=&quot;start|top&quot;<br>            <em>tools:text</em>=&quot;@tools:sample/full_names&quot;<br>            <em>android:textColor</em>=&quot;@android:color/white&quot;<br>            <em>android:textSize</em>=&quot;16sp&quot; /&gt;<br>        &lt;TextView<br>            <em>android:id</em>=&quot;@+id/message_time&quot;<br>            <em>android:layout_width</em>=&quot;wrap_content&quot;<br>            <em>android:layout_height</em>=&quot;wrap_content&quot;<br>            <em>android:layout_gravity</em>=&quot;end|bottom&quot;<br>            <em>android:layout_margin</em>=&quot;4dp&quot;<br>            <em>tools:text</em>=&quot;@tools:sample/date/hhmm&quot;<br>            <em>android:textColor</em>=&quot;@android:color/white&quot;<br>            <em>android:textSize</em>=&quot;12sp&quot; /&gt;<br>    &lt;/LinearLayout&gt;<br>&lt;/FrameLayout&gt;</pre><p>Great, here we have finished our UI layout.</p><p>Time for next step i.e Sending message functionality</p><ol><li>Getting message from Edit Text.</li></ol><p>Java:</p><pre>public class MainActivity extends AAppCompatActivity{</pre><pre>private EditText editText;</pre><pre>public void onCreate(){<br>editText = findViewById(R.id.<em>edittext_chatbox</em>);<br>}</pre><p>Kotlin:</p><pre><em>class </em>MainActivity : AppCompatActivity() {<br>    <em>private lateinit var </em>editText: EditText<br>...<br><em>override fun </em>onCreate(savedInstanceState: Bundle?) {<br>...</pre><pre>editText = findViewById(R.id.<em>edittext_chatbox</em>)<br>}</pre><p>Creating Send Message method</p><p>Java:</p><pre><em>private void </em>sendMessage() {<br>     String msg = editText.getText().toString();<br>     <em>if </em>(msg.trim().isEmpty()) {<br>         Toast.<em>makeText</em>(MainActivity.<em>this</em>, &quot;Please enter your      query!&quot;, Toast.<em>LENGTH_LONG</em>).show();<br>     } <em>else </em>{<br>          showTextView(msg, <em>USER</em>);<br>          editText.setText(&quot;&quot;);<br>}</pre><p>Kotlin:</p><pre><em>fun </em>sendMessage(){<br>    <em>val </em>msg = editText.<em>text</em>.toString()<br>    <em>if</em>(msg.<em>trim</em>().<em>isEmpty</em>())<br>        Toast.makeText(<em>this</em>,&quot;Please enter your query&quot;,Toast.<em>LENGTH_SHORT</em>).show()<br>    showTextView(msg,USER)<br>    editText.setText(&quot;&quot;)<br>}</pre><p>We will be switching between layouts of user and bot. Also, we will be adding current time and message in our Text view</p><p>For switching we need to add USER and BOT :</p><p>Java:</p><pre><em>private final int </em>USER = 0<br><em>private final int </em>BOT = 1</pre><p>Kotlin:</p><pre><em>private val </em>USER = 0<br><em>private val </em>BOT = 1</pre><p>Java:</p><pre><em>private void </em>showTextView(String message, <em>int </em>type) {<br>    LinearLayout chatLayout = findViewById(R.id.<em>chatLayout</em>);<br>    LayoutInflater inflater = LayoutInflater.<em>from</em>(MainActivity.<em>this</em>);<br>    FrameLayout layout;<br>    <em>switch </em>(type) {<br>        <em>case USER</em>:<br>            layout = getUserLayout();<br>            <em>break</em>;<br>        <em>case BOT</em>:<br>            layout = getBotLayout();<br>            <em>break</em>;<br>        <em>default</em>:<br>            layout = getBotLayout();<br>            <em>break</em>;<br>    }<br>    layout.setFocusableInTouchMode(<em>true</em>);<br>    chatLayout.addView(layout);<br>    TextView tv = layout.findViewById(R.id.<em>chatMsg</em>);<br>    tv.setText(message);<br>    layout.requestFocus();<br>    edittextChatbox.requestFocus();<br>    Date date = <em>new </em>Date(System.<em>currentTimeMillis</em>());<br>    SimpleDateFormat dateFormat = <em>new </em>SimpleDateFormat(&quot;hh:mm aa&quot;,<br>            Locale.<em>ENGLISH</em>);<br>    String time = dateFormat.format(date);<br>    TextView timeTextView = layout.findViewById(R.id.message_time);<br>            timeTextView.setText(time.toString());<br>}</pre><p>Kotlin:</p><pre><em>fun </em>showTextView(message:String,type:Int){<br>    <em>val </em>inflater =LayoutInflater.from(<em>this</em>@MainActivity)<br>    <em>var </em>frameLayout:FrameLayout? = <em>null<br>    val </em>linearLayout_main = findViewById&lt;LinearLayout&gt;(R.id.<em>chat_layout</em>)<br>    <em>when</em>(type){<br>        USER -&gt; { frameLayout = getUserLayout()<br>        }<br>        BOT -&gt;{frameLayout = getBotLayout()<br>        }<br>        <em>else</em>-&gt;{<br>            frameLayout = getBotLayout()<br>        }<br>    }<br>    frameLayout?.<em>isFocusableInTouchMode </em>= <em>true<br>    </em>linearLayout_main.addView(frameLayout)<br>    <em>val </em>messageTextView = frameLayout?.findViewById&lt;TextView&gt;(R.id.<em>chat_msg</em>)<br>    messageTextView?.setText(message)<br>    frameLayout?.requestFocus()<br>    editText.requestFocus()<br>     <em>val </em>date = Date(System.currentTimeMillis());<br>     <em>val </em>dateFormat = SimpleDateFormat(&quot;hh:mm aa&quot;,<br>        Locale.<em>ENGLISH</em>)<br>    <em>val </em>time = dateFormat.format(date)<br>    <em>val </em>timeTextView = frameLayout?.findViewById&lt;TextView&gt;(R.id.<em>message_time</em>)<br>    timeTextView?.setText(time.toString())<br>}</pre><p>Time to create getUserLayout and getBotLayout</p><p>Java:</p><pre>FrameLayout getUserLayout() {<br>    LayoutInflater inflater = LayoutInflater.<em>from</em>(MainActivity.<em>this</em>);<br>    <em>return </em>(FrameLayout) inflater.inflate(R.layout.<em>user_message_box</em>, <em>null</em>);<br>}<br><br>FrameLayout getBotLayout() {<br>    LayoutInflater inflater = LayoutInflater.<em>from</em>(MainActivity.<em>this</em>);<br>    <em>return </em>(FrameLayout) inflater.inflate(R.layout.<em>chatbot_response_item</em>, <em>null</em>);<br>}</pre><p>Kotlin:</p><pre><em>fun </em>getUserLayout(): FrameLayout? {<br>    <em>val </em>inflater = LayoutInflater.from(<em>this</em>@MainActivity)<br>    <em>return </em>inflater.inflate(R.layout.<em>user_message_box</em>, <em>null</em>) <em>as </em>FrameLayout?<br>}<br><br><em>fun </em>getBotLayout(): FrameLayout? {<br>    <em>val </em>inflater = LayoutInflater.from(<em>this</em>@MainActivity)<br>    <em>return </em>inflater.inflate(R.layout.<em>bot_message_box</em>, <em>null</em>) <em>as </em>FrameLayout?<br>}</pre><p>Here we have functional Chat UI</p><p>It would look like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_O4uCEyIIvY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_O4uCEyIIvY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_O4uCEyIIvY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/17b2efc39c417b17915a86cf19f9366a/href">https://medium.com/media/17b2efc39c417b17915a86cf19f9366a/href</a></iframe><h4>Next Part:<br><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-2-40b53cab3630">Rasa Chatbot Creation</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1010f667c06c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rasa Chatbot + Android Covid app Tutorial: Part 3]]></title>
            <link>https://medium.com/@dishant_gandhi/rasa-chatbot-android-covid-app-tutorial-part-3-73c7a69f3c65?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/73c7a69f3c65</guid>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[connection]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Mon, 07 Sep 2020 16:46:29 GMT</pubDate>
            <atom:updated>2021-01-21T10:01:32.322Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Connecting Bot with Application</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*Ma4xHGumLEnbyynf.jpg" /><figcaption><a href="https://www.freepik.com/free-vector/chatbot-concept-background-with-mobile-device_2411540.htm#page=1&amp;query=chatbot&amp;position=4">Source</a></figcaption></figure><h4>Before you start here is a video if you want to check how it works</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOkOU9sEIi8s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOkOU9sEIi8s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOkOU9sEIi8s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cfe54f9f99106a2e3708e65703e5d04/href">https://medium.com/media/8cfe54f9f99106a2e3708e65703e5d04/href</a></iframe><p>We are going to Save Money!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F7551462&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fmoney-save-money-goals-yassss-excited-gif-7551462&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F5b748b602286fa9d2f059f493d547809%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd4ca6bc97c81083684ecd6021ce5611/href">https://medium.com/media/fd4ca6bc97c81083684ecd6021ce5611/href</a></iframe><p>Here, we will be going budget friendly. We won’t need any server or anything for getting reply from bot.</p><p>Libraries can be used for sending and receiving request:</p><ul><li><a href="http://square.github.io/retrofit/">Retrofit</a> (We will be using for this tutorial)</li><li><a href="http://square.github.io/okhttp/">Okhttpclient</a></li><li><a href="https://github.com/InsertKoinIO/koin">Koin</a></li><li><a href="https://developer.android.com/reference/kotlin/java/net/HttpURLConnection">HttpUrlConnection</a> (Android’s native)</li></ul><p>Let’s start our integration</p><p>Go to the android studio in our covid app</p><p>Open build.gradle to add dependency:</p><pre>implementation &#39;com.squareup.retrofit2:retrofit:2.6.4&#39;<br>implementation &#39;com.squareup.retrofit2:converter-gson:2.6.4&#39;</pre><p>GSON dependency is for getting JSON response into our app</p><p>How will we get response and send our response to bot?</p><p><strong>User response</strong> will be sent via <strong>POST</strong> method.</p><p>And we will be <strong>Bot response</strong> receiving<strong> </strong>them via <strong>webhook.</strong></p><p>So, We will need to setup Internet permission in Manifest. This will help us to get message from Rasa Bot.</p><pre>&lt;uses-permission <em>android:name</em>=&quot;android.permission.INTERNET&quot;/&gt;</pre><p>What do you’ll think what will be the next step?<br>Correct!👏<br><strong><em>Sending and Receiving Messages <br></em>So we will create classes from them too</strong></p><ol><li>User Message class</li></ol><p>Java:</p><pre><em>public class </em>UserMessage {<br>    String sender;<br>    String message;<br><br>    <em>public </em>UserMessage(String sender, String message){<br>        <em>this</em>.sender = sender;<br>        <em>this</em>.message = message;<br>    }<br><br>    <em>public </em>String getSender() {<br>        <em>return </em>sender;<br>    }<br><br>    <em>public </em>String getMessage() {<br>        <em>return </em>message;<br>    }<br>}</pre><p>Kotlin:</p><pre><em>class </em>UserMessage {<br>    <em>public lateinit var </em>sender:String<br>    <em>public lateinit var </em>message: String<br>    <em>fun </em>UserMessage(id:String,response_message:String){<br>        sender = id<br>        message = response_message<br>    }<br>}</pre><p>2. Bot Response class</p><p>Java:</p><pre><em>public class </em>BotResponse {<br>    String recipient_id;<br>    String text;<br><br>    <em>public </em>BotResponse(String recipient_id, String text) {<br>        <em>this</em>.recipient_id = recipient_id;<br>        <em>this</em>.text = text;<br><br>    }<br><br>    <em>public </em>String getRecipient_id() {<br>        <em>return </em>recipient_id;<br>    }<br><br>    <em>public </em>String getText() {<br>        <em>return </em>text;<br>    }<br>}</pre><p>Kotlin:</p><pre><em>class </em>BotResponse(<br>    <em>var </em>recipient_id: String,<br>    <em>var </em>text: String,<br>)</pre><p>Creating Interface for sending message:</p><p>Java:</p><pre><em>public interface MessageSender </em>{<br>    @POST(&quot;webhook&quot;)<br>   <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt; sendMessage(@Body UserMessage userMessage);<br>}</pre><p>Kotlin:</p><pre><em>interface MessageSender </em>{<br>    @POST(&quot;webhook&quot;)<br>    <em>fun </em>sendMessage(@Body userMessage: UserMessage?): <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt;<br>}</pre><p>We will be updating our sendMessage method that was created earlier.</p><p>The whole updated function is given below:</p><p>Java:</p><pre><em>private void </em>sendMessage() {<br><br>    String msg = edittextChatbox.getText().toString();<br>    OkHttpClient okHttpClient = <em>new </em>OkHttpClient();<br>    Retrofit retrofit = <em>new </em>Retrofit.Builder()<br>            .baseUrl(&quot;http://<strong>PC-IP-ADDRESS</strong>:5005/webhooks/rest/&quot;)<br>            .client(okHttpClient)<br>            .addConverterFactory(GsonConverterFactory.<em>create</em>())<br>            .build();<br><br>    <em>if </em>(msg.trim().isEmpty()) {<br>        Toast.<em>makeText</em>(MainActivity.<em>this</em>, &quot;Please enter your query!&quot;, Toast.<em>LENGTH_LONG</em>).show();<br>    } <em>else </em>{<br>        showTextView(msg, <em>USER</em>);<br>        edittextChatbox.setText(&quot;&quot;);<br><br>        userMessage = <em>new </em>UserMessage(&quot;User&quot;,msg);<br>    }<br>    Toast.<em>makeText</em>(MainActivity.<em>this</em>, &quot;&quot;+userMessage.getMessage(), Toast.<em>LENGTH_LONG</em>).show();<br>    messageSender = retrofit.create(<em>MessageSender</em>.<em>class</em>);<br>    <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt; response = messageSender.sendMessage(userMessage);<br>    response.enqueue(<em>new </em>Callback&lt;<em>List</em>&lt;BotResponse&gt;&gt;() {<br>        @Override<br>        <em>public void </em>onResponse(<em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt; call, Response&lt;<em>List</em>&lt;BotResponse&gt;&gt; response) {<br>            <em>if</em>(response.body() == <em>null </em>|| response.body().size() == 0){<br>                showTextView(&quot;Sorry didn&#39;t understand&quot;,<em>BOT</em>);<br>            }<br>            <em>else</em>{<br>                BotResponse botResponse = response.body().get(0);<br>                showTextView(botResponse.getText(),<em>BOT</em>);<br>            }<br>        }<br>        @Override<br>        <em>public void </em>onFailure(<em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt; call, Throwable t) {<br>            showTextView(&quot;Waiting for message&quot;,<em>BOT</em>);<br>            Toast.<em>makeText</em>(MainActivity.<em>this</em>,&quot;&quot;+t.getMessage(),Toast.<em>LENGTH_SHORT</em>).show();<br>        }<br>    });<br>}</pre><p>Kotlin:</p><pre><em>fun </em>sendMessage(){<br>    <em>val </em>msg:String = editText.<em>text</em>.toString()<br>    <em>val </em>okHttpClient = OkHttpClient()<br>    <em>val </em>retrofit = Retrofit.Builder()<br>        .baseUrl(&quot;http://<strong>PC-IP-ADDRESS</strong>:5005/webhooks/rest/&quot;)<br>        .client(okHttpClient)<br>        .addConverterFactory(GsonConverterFactory.create())<br>        .build()<br>    <em>val </em>userMessage = UserMessage()<br>    <em>if</em>(msg.<em>trim</em>().<em>isEmpty</em>())<br>        Toast.makeText(<em>this</em>,&quot;Please enter your query&quot;,Toast.<em>LENGTH_SHORT</em>).show()<br>    <em>else </em>{<br>        Log.e(&quot;MSg&quot;,&quot;msssage: $msg&quot;)<br>        showTextView(msg, USER)<br>        editText.setText(&quot;&quot;)<br>        userMessage.UserMessage(&quot;User&quot;,msg)<br>    }<br>   <em>val </em>messageSender = retrofit.create(<em>MessageSender</em>::<em>class</em>.<em>java</em>)<br>    <em>val </em>response =<br>        messageSender.sendMessage(userMessage)<br>    response.enqueue(<em>object </em>: <em>Callback</em>&lt;<em>List</em>&lt;BotResponse&gt;?&gt; {<br>        <em>override fun </em>onResponse(call: <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;?&gt;, response: Response&lt;<em>List</em>&lt;BotResponse&gt;?&gt;) {<br>            <em>if </em>(response.body() == <em>null </em>|| response.body()!!.size == 0) {<br>                showTextView(&quot;Sorry didn&#39;t understand&quot;, BOT)<br>            } <em>else </em>{<br>                <em>val </em>botResponse = response.body()!![0]<br>                showTextView(botResponse.text,BOT)<br>            }<br>        }<br>        <em>override fun </em>onFailure(call: <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;?&gt;, t: Throwable) {<br>            showTextView(&quot;Waiting for message&quot;, BOT)<br>            Toast.makeText(<em>this</em>@MainActivity, &quot;&quot; + t.message, Toast.<em>LENGTH_SHORT</em>).show()<br>        }<br>    })<br>}</pre><p>Here, we are sending and receiving messages from bot</p><p>Remember to add IP address of your system before running this code.</p><p><strong>What send message method is doing?</strong></p><ol><li>Setting up retrofit with our url where we will be sending message.</li></ol><pre><em>val </em>okHttpClient = OkHttpClient()<br>    <em>val </em>retrofit = Retrofit.Builder()<br>        .baseUrl(&quot;http://<strong>PC-IP-ADDRESS</strong>:5005/webhooks/rest/&quot;)<br>        .client(okHttpClient)<br>        .addConverterFactory(GsonConverterFactory.create())<br>        .build()</pre><p>2. Sending message</p><pre><em>if</em>(msg.<em>trim</em>().<em>isEmpty</em>())<br>        Toast.makeText(<em>this</em>,&quot;Please enter your query&quot;,Toast.<em>LENGTH_SHORT</em>).show()<br>    <em>else </em>{<br>        Log.e(&quot;MSg&quot;,&quot;msssage: $msg&quot;)<br>        showTextView(msg, USER)<br>        editText.setText(&quot;&quot;)<br>        userMessage.UserMessage(&quot;User&quot;,msg)<br>    }<br>   <em>val </em>messageSender = retrofit.create(<em>MessageSender</em>::<em>class</em>.<em>java</em>)<br>    <em>val </em>response =<br>        messageSender.sendMessage(userMessage)</pre><p>PS: We are receiving the response too..</p><p>3. Receiving message and showing message.</p><ul><li>Added null message exception</li><li>Also, a failure message so that user can check the problem instead of waiting for message.</li></ul><pre>response.enqueue(<em>object </em>: <em>Callback</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt; {<br>    <em>override fun </em>onResponse(call: <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt;, response: Response&lt;<em>List</em>&lt;BotResponse&gt;&gt;) {<br>        <em>if </em>(response.body() == <em>null </em>|| response.body()!!.size == 0) {<br>            showTextView(&quot;Sorry didn&#39;t understand&quot;, BOT)<br>        } <em>else </em>{<br>            <em>val </em>botResponse = response.body()!![0]<br>            showTextView(botResponse.text,BOT)<br>            <em>if</em>(botResponse.buttons != <em>null</em>) {<br>                Log.e(&quot;Button c&quot;, &quot;${botResponse.buttons.size}&quot;)<br>            }<br>        }<br>    }<br><br>    <em>override fun </em>onFailure(call: <em>Call</em>&lt;<em>List</em>&lt;BotResponse&gt;&gt;, t: Throwable) {<br>        showTextView(&quot;Getting message failed!&quot;, BOT)<br>        Toast.makeText(<em>this</em>@MainActivity, &quot;&quot; + t.message, Toast.<em>LENGTH_SHORT</em>).show()<br>    }<br>})</pre><p><strong>How to find IP address?</strong></p><p>Open command line/terminal and write following command</p><ul><li>For Windows -&gt;<em> ipconfig</em></li><li>For Mac/Linux -&gt; <em>ifconfig</em></li></ul><p>For API greater than M i.e 23 Clear Traffic Network is not accepted by default.</p><p>So, We will have to add following line in Manifest File in application tag:</p><pre><strong>android:usesCleartextTraffic=&quot;true&quot;</strong></pre><p>Also, Add windows Soft input mode in Manifest file so that we can scroll chat messages when keyboard appears: It will look like this:</p><pre>&lt;activity <em>android:name</em>=&quot;.MainActivity&quot;<br>   <strong> <em>android:windowSoftInputMode</em>=&quot;adjustResize&quot;</strong>&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action <em>android:name</em>=&quot;android.intent.action.MAIN&quot; /&gt;<br><br>        &lt;category <em>android:name</em>=&quot;android.intent.category.LAUNCHER&quot; /&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><p>Now, Everything is ready and we have to just start our Chatbot server ON!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FBoILryUmXnQSzprTB1%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fstickers%2Ftheroadshow-ready-are-you-BoILryUmXnQSzprTB1&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FBoILryUmXnQSzprTB1%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/e971d8342dbe42cd99bdcd4b9bb47977/href">https://medium.com/media/e971d8342dbe42cd99bdcd4b9bb47977/href</a></iframe><p>Switch to Rasa project.</p><ul><li>Turn on Environment</li><li>On one terminal run actions:</li></ul><p><strong><em>rasa run actions</em></strong></p><ul><li>On another terminal run models via endpoints:</li></ul><p><strong><em>rasa run -m models --enable-api --endpoints endpoints.yml</em></strong></p><p>We can see that our server is up and running.</p><p>Now, Execute the app in emulator or physical device. We will be able to see chatbot is working fine and awesome…</p><p>Give some claps…. We have created a chatbot android application and sell them in market everyone needs this 👏👏</p><p>Learn..Built..Earn💸</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fe5j-ZJl2ilo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3De5j-ZJl2ilo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fe5j-ZJl2ilo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/117ae0161695d310c0c811937472f74c/href">https://medium.com/media/117ae0161695d310c0c811937472f74c/href</a></iframe><p><a href="https://medium.com/@dishant_gandhi/rasa-chatbot-tutorial-bonus-e171416ecc25">Rasa Server creation Bonus!!</a></p><p>Github Repo Link: <a href="https://github.com/Horizon733/Covid-Chatbot-app/tree/master">Covid Chatbot</a></p><p>📃 Save this story in <a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_read_later_text">Journal</a></p><p>Useful link for getting more information:</p><ul><li><a href="https://rasa.com/docs/">Rasa Docs</a></li><li><a href="https://codelabs.developers.google.com/">Android Codelabs Tutorials</a></li><li><a href="https://blog.rasa.com/how-to-build-a-mobile-voice-assistant-with-open-source-rasa-and-aimybox/">Rasa Voice assistance in Android</a></li></ul><p>Let me know in Comments and by your claps how much you liked and what you all created!</p><p>Stay Safe, Stay Healthy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73c7a69f3c65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Social Media with Android Apps: Snapchat  3/3]]></title>
            <link>https://medium.com/@dishant_gandhi/integrate-social-media-with-android-apps-snapchat-3-3-75d9b9e7558e?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/75d9b9e7558e</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[snapchat]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[social-media]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Sat, 04 Jul 2020 18:17:20 GMT</pubDate>
            <atom:updated>2020-07-04T18:43:08.530Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrate Social Media with Android Apps: Part 3/3</h3><p>The Final part is here!!!</p><p>Guess the app which is really awesome and we all love it and try hard to maintain streaks!! 🔥🔥</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Foam-hldpuAxxRtZ" /><figcaption>Photo by <a href="https://unsplash.com/@morningbrew?utm_source=medium&amp;utm_medium=referral">Morning Brew</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>One and Only SnapChat!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/0*fOJvIrEg-MWezbJP.jpg" /><figcaption>(<em>Spider-Man: Into the Spider-Verse</em> via Sony Pictures Entertainment)</figcaption></figure><blockquote>Alright people, Let’s do this one last time</blockquote><p>The process is simple and easy. The steps are getting start!!</p><h3><strong>Step 1: Creating Snapchat Kit account</strong></h3><p>Create account or login with Snapchat Account on <a href="https://kit.snapchat.com/">Snapchat Kits</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oyplQp0LhHBXKOZHejvnbA.png" /><figcaption>Snapchat kits</figcaption></figure><p>Now, create app by clicking on + icon look at the image below as a guide</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2S4fAEb1qe2XcTG_XI1zw.png" /></figure><p>Add all the information for your app and add following enteries in that particular part</p><ul><li>For redirect URLS -&gt; yourappname://snap-kit/oauth2</li><li>Choose Login kit since for this app we just want name</li><li>Permissions -&gt; Display Name will be already selected if you want you can add more</li><li>In Development Environment select Android</li></ul><p>These are steps u have completed</p><h3>Step 2: Adding Dependencies and maven</h3><p>Let’s add maven url inside allprojects -&gt; repositories</p><pre><br>        maven {<br>            url &quot;https://storage.googleapis.com/snap-kit-build/maven&quot;<br>      }</pre><p>Add dependencies for login and core in build.gradle(module:app)</p><pre>implementation([<br>        &#39;com.snapchat.kit.sdk:login:1.1.4&#39;, <em>// for Login Kit<br>        </em>&#39;com.snapchat.kit.sdk:core:1.1.4&#39;,  <em>// core dependency for all of the above Kits<br></em>])</pre><p>We are moving so slow and easy now lets work on Main part i.e Add Login</p><h3>Step 3: Working on Manifest and strings files</h3><ul><li>strings.xml</li></ul><p>Add client id found just below Development Environment as shown in Image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKG_yL3l28mcgEa5tHGB9g.png" /><figcaption>client id for authorization</figcaption></figure><pre>&lt;string <em>name</em>=&quot;snapchat_id&quot;&gt;Your client Autho2 id&lt;/string&gt;</pre><p>Add scopes for data fetching in strings.xml file as string-array</p><pre>&lt;string-array <em>name</em>=&quot;snap_connect_scopes&quot;&gt;<br>    &lt;item&gt;https://auth.snapchat.com/oauth2/api/user.display_name&lt;/item&gt;<br>&lt;/string-array&gt;</pre><ul><li>Manifest file meta-data and activity</li></ul><pre>&lt;meta-data <em>android:name</em>=&quot;com.snapchat.kit.sdk.clientId&quot; <em>android:value</em>=&quot;@string/snapchat_id&quot; /&gt;<br>&lt;meta-data <em>android:name</em>=&quot;com.snapchat.kit.sdk.redirectUrl&quot; <em>android:value</em>=&quot;yourappname://snap-kit/oauth2&quot; /&gt;<br>&lt;meta-data <em>android:name</em>=&quot;com.snapchat.kit.sdk.scopes&quot; <em>android:resource</em>=&quot;@array/snap_connect_scopes&quot; /&gt;</pre><pre>&lt;activity<br>        <em>android:name</em>=&quot;com.snapchat.kit.sdk.SnapKitActivity&quot;<br>        <em>android:launchMode</em>=&quot;singleTask&quot;&gt;<br>    &lt;intent-filter&gt;<br>    &lt;action <em>android:name</em>=&quot;android.intent.action.VIEW&quot; /&gt;<br>    &lt;category <em>android:name</em>=&quot;android.intent.category.DEFAULT&quot; /&gt;<br>    &lt;category <em>android:name</em>=&quot;android.intent.category.BROWSABLE&quot; /&gt;<br>        &lt;data<br>            <em>android:scheme</em>=&quot;yourappname&quot;<br>            <em>android:host</em>=&quot;snap-kit&quot;<br>            <em>android:path</em>=&quot;/oauth2&quot; /&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><h3>Step 4: Adding Button and TextView</h3><p>Adding Button here does not give us designed Button like Twitter and Facebook so I haven’t made fancy Button its just a normal button</p><p>You can create it if you want to the code will be as follows:</p><ul><li>Normal Button:</li></ul><pre>&lt;Button<br>    <em>android:id</em>=&quot;@+id/snapchat_login&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:layout_marginTop</em>=&quot;16dp&quot;<br>    <em>android:textAllCaps</em>=&quot;false&quot;<br>    <em>android:text</em>=&quot;Login with Snapchat&quot;<br>    <em>android:textSize</em>=&quot;20sp&quot;<br>    <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintTop_toBottomOf</em>=&quot;@+id/twitter_login&quot; /&gt;</pre><ul><li>Snapchat Button:</li></ul><pre>&lt;LinearLayout<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:orientation</em>=&quot;horizontal&quot;<br>    <em>android:background</em>=&quot;#FFFFE600&quot;<br>    <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintTop_toBottomOf</em>=&quot;@+id/snapchat_user_id&quot;&gt;<br>    &lt;ImageView<br>        <em>android:layout_width</em>=&quot;42dp&quot;<br>        <em>android:layout_height</em>=&quot;42dp&quot;<br>        <em>android:layout_margin</em>=&quot;12dp&quot;<br>        <em>android:layout_gravity</em>=&quot;center&quot;<br>        <em>android:background</em>=&quot;@drawable/ic_snapchat&quot;/&gt;<br>    &lt;TextView<br>        <em>android:layout_width</em>=&quot;wrap_content&quot;<br>        <em>android:layout_height</em>=&quot;wrap_content&quot;<br>        <em>android:text</em>=&quot;Login with Snapchat&quot;<br>        <em>android:layout_gravity</em>=&quot;center&quot;<br>        <em>android:layout_margin</em>=&quot;16dp&quot;<br>        <em>android:textColor</em>=&quot;@android:color/black&quot;<br>        <em>android:textSize</em>=&quot;20sp&quot;<br>       /&gt;<br>&lt;/LinearLayout&gt;<br></pre><p>This above code will look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*yFRAEwR7Z0afjjd38_42Yg.png" /><figcaption>login with snapchat button</figcaption></figure><p>Find icon for Snapchat on F<a href="https://www.flaticon.com/free-icon/snapchat_1409941?term=snapchat&amp;page=1&amp;position=6">laticon</a></p><p>Adding TextView for user Name display</p><pre>&lt;TextView<br>    <em>android:id</em>=&quot;@+id/snapchat_user_id&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:layout_margin</em>=&quot;16dp&quot;<br>    <em>android:textSize</em>=&quot;20sp&quot;<br>    <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintTop_toBottomOf</em>=&quot;@+id/snapchat_login&quot; /&gt;</pre><h3>Step 5: Adding functionality for login</h3><p>Setting OnClickListener() on View or Button which ever you have used inside OnCreate()</p><pre>snapchat_login_button.setOnClickListener(<em>new </em>View.OnClickListener() {<br>    @Override<br>    <em>public void </em>onClick(View v) {<br>        SnapLogin.<em>getAuthTokenManager</em>(MainActivity.<em>this</em>).startTokenGrant();<br>        getUserNameSnapChat();<br>    }<br>});</pre><p>Here above, we are fetching the Token and userName function is called</p><p>So, Lets add the Login Controller inside onCreate</p><pre>SnapLogin.<em>getLoginStateController</em>(MainActivity.<em>this</em>).addOnLoginStateChangedListener(snapchatLoginButton());</pre><p>Adding snapchatLoginButton()</p><pre><em>private LoginStateController</em>.<em>OnLoginStateChangedListener </em>snapchatLoginButton(){<br>    <em>LoginStateController</em>.<em>OnLoginStateChangedListener </em>loginStateController =  <em>new LoginStateController</em>.OnLoginStateChangedListener(){<br><br>        @Override<br>        <em>public void </em>onLoginSucceeded() {<br>            Toast.<em>makeText</em>(MainActivity.<em>this</em>,&quot;login Successfull&quot;,Toast.<em>LENGTH_SHORT</em>).show();<br>            Log.<em>e</em>(&quot;Main Activity snapchat&quot;,&quot;login Successfull&quot;);<br><br>        }<br><br>        @Override<br>        <em>public void </em>onLoginFailed() {<br>            Toast.<em>makeText</em>(MainActivity.<em>this</em>,&quot;Login Failed&quot;,Toast.<em>LENGTH_SHORT</em>).show();<br>        }<br><br>        @Override<br>        <em>public void </em>onLogout() {<br>            Toast.<em>makeText</em>(MainActivity.<em>this</em>,&quot;Logout Success!&quot;,Toast.<em>LENGTH_SHORT</em>).show();<br>        }<br>    };<br>     <em>return </em>loginStateController;<br> }</pre><p>Fetching User name from Snapchat model</p><pre><em>void </em>getUserNameSnapChat(){<br>    <em>boolean </em>isLogedIn = SnapLogin.<em>isUserLoggedIn</em>(MainActivity.<em>this</em>);<br>    <em>if</em>(isLogedIn) {<br>        String query = &quot;{me{displayName}}&quot;;<br>        SnapLogin.<em>fetchUserData</em>(MainActivity.<em>this</em>, query, <em>null</em>, <em>new </em>FetchUserDataCallback() {<br>            @Override<br>            <em>public void </em>onSuccess(@Nullable UserDataResponse userDataResponse) {<br>                <em>if </em>(userDataResponse == <em>null </em>|| userDataResponse.getData() == <em>null</em>) {<br>                    Log.<em>e</em>(&quot;Main Activity snapchat &quot;, &quot;null&quot;);<br>                    <em>return</em>;<br>                }<br><br>                MeData meData = userDataResponse.getData().getMe();<br>                <em>if </em>(meData == <em>null</em>) {<br>                    <em>return</em>;<br>                }<br>                snapchat_name.setText(meData.getDisplayName());<br>            }<br><br>            @Override<br>            <em>public void </em>onFailure(<em>boolean </em>b, <em>int </em>i) {<br>                Toast.<em>makeText</em>(MainActivity.<em>this</em>, &quot;Sorry problem with fetching try again&quot;, Toast.<em>LENGTH_SHORT</em>).show();<br>            }<br>        });<br>    }<br>}</pre><p>Note: This will only work when Snapchat is installed</p><p>We are checking if login has been done or not before fetching so that crashing doesn’t occur</p><p>Wow, 3 part successfully completes here.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl0MYDGA3Du1hBR4xG%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fdeadpool-applause-clapping-l0MYDGA3Du1hBR4xG&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fl0MYDGA3Du1hBR4xG%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="226" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f0b9dc9ed5ba487e6671748ec7356bc/href">https://medium.com/media/8f0b9dc9ed5ba487e6671748ec7356bc/href</a></iframe><p>What incredible things we have learnt in this journey without going through any docs of that app.</p><p><strong>Pros:</strong></p><ul><li>Learnt view binding</li><li>Learnt Facebook login integration</li><li>Learnt Twitter login integration</li><li>Learnt Snapchat login integration</li><li>Learnt to create a fancy button with layout</li></ul><p>Go play around with more stuffs on that developer website look what you can do with it and let me know on my Instagram handle I will add it to my story</p><p>The Repo has been updated with icons and button for this part branch name —<a href="https://github.com/Horizon733/lets-connect/tree/snapchat"> snapchat</a></p><p>Previous <a href="https://medium.com/@dishant_gandhi/integrate-social-media-with-android-app-twitter-2-3-248a6c29accb">Part 2</a></p><p>Give as many claps as you can one, two , twenty ,etc I would love it!!</p><p>Connect with me on <a href="https://www.instagram.com/_dishant_733/">Instagram</a>, <a href="https://www.linkedin.com/in/dishant-gandhi/">LinkedIn</a> and <a href="https://github.com/Horizon733">Github</a></p><p>See you in next Stories!!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl1J3CbFgn5o7DGRuE%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fgoodbye-see-ya-you-l1J3CbFgn5o7DGRuE&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fl1J3CbFgn5o7DGRuE%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="280" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c3694edd75a14d189c0d12c44748d53/href">https://medium.com/media/0c3694edd75a14d189c0d12c44748d53/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75d9b9e7558e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Social Media with Android app: Twitter: 2/3]]></title>
            <link>https://medium.com/@dishant_gandhi/integrate-social-media-with-android-app-twitter-2-3-248a6c29accb?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/248a6c29accb</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[twitter]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 14:09:33 GMT</pubDate>
            <atom:updated>2020-06-30T14:09:33.593Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrate Social Media with Android app: Part 2/3</h3><p>Welcome to the part 2 of 3 where we will be integrating social media with android app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KIGyUfIs8G8J7wb1" /><figcaption>Photo by <a href="https://unsplash.com/@yucelmoran?utm_source=medium&amp;utm_medium=referral">Yucel Moran</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Part 2: Twitter Login</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F14152185&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Flet-us-begin-lets-start-begin-gif-14152185&amp;image=https%3A%2F%2Fmedia.tenor.com%2F6Igas8ss6BAAAAAN%2Flet-us-begin-lets-start.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/9cc0aea67ff17f147896c23c35f834da/href">https://medium.com/media/9cc0aea67ff17f147896c23c35f834da/href</a></iframe><p>Here, We are adding twitter login and showing their twitter username inside the TextView.</p><p>First, Let’s become Twitter Developers click here to go to website for getting started with twitter developers.</p><p>Sign up for <a href="https://developer.twitter.com/en/apply-for-access">Twitter API</a> it will send you verify mail on your registered mail id so verify it can get started with API</p><p>Now, go to the dashboard and follow the steps given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*5rajxSkl9Is0TQiemEXTlQ.png" /></figure><p>After you click on apps, you will be able to see a screen without any apps</p><p>So, click on create app, Enter all the information and when you reach Callback Url enter the following text:</p><p>twittersdk://</p><p>After following all the steps your screen will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*rLoNnKbpBTY9E061GnxrNw.png" /></figure><p>fill all the details and submit it. You will then able to access 2 keys</p><ul><li><strong>API key</strong></li><li><strong>API secret key</strong></li></ul><p>these 2 keys we are going to add in strings.xml so that we can access it later in app.</p><p>Before we add Button let’s add dependency for twitter core</p><pre>implementation &#39;com.twitter.sdk.android:twitter-core:3.1.1&#39;</pre><p>Now, let’s add Button and TextView..</p><p>TextView will be same as our Facebook’s TextView so below is the code:</p><pre>&lt;TextView<br>    <em>android:id</em>=&quot;@+id/twitter_user_id&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:textSize</em>=&quot;20sp&quot;<br>    <em>android:layout_margin</em>=&quot;16dp&quot;<br>    <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintTop_toBottomOf</em>=&quot;@+id/facebook_login&quot; /&gt;</pre><p>Now, adding Button in activity xml</p><pre>&lt;com.twitter.sdk.android.core.identity.TwitterLoginButton<br>    <em>android:id</em>=&quot;@+id/twitter_login&quot;<br>    <em>android:layout_width</em>=&quot;wrap_content&quot;<br>    <em>android:layout_height</em>=&quot;wrap_content&quot;<br>    <em>android:layout_marginTop</em>=&quot;16dp&quot;<br>    <em>app:layout_constraintEnd_toEndOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintStart_toStartOf</em>=&quot;parent&quot;<br>    <em>app:layout_constraintTop_toBottomOf</em>=&quot;@+id/twitter_user_id&quot;/&gt;</pre><p>Let’s start with setting up the button so that user can login successfully with twitter:</p><ul><li>Step 1: add twitter config before inflating layout/setting content view</li></ul><pre>TwitterConfig config = <em>new </em>TwitterConfig.Builder(<em>this</em>)<br>        .logger(<em>new </em>DefaultLogger(Log.<em>DEBUG</em>))<br>        .twitterAuthConfig(<em>new </em>TwitterAuthConfig(getResources().getString(R.string.<em>twitter_api_key</em>), getResources().getString(R.string.<em>twitter_api_secret_key</em>)))<br>        .debug(<em>true</em>)<br>        .build();<br>Twitter.<em>initialize</em>(config);</pre><ul><li>Step 2: adding callback for login into twitter and getting User name and adding it inside text view</li></ul><pre>twitterLogin.setCallback(<em>new </em>Callback&lt;TwitterSession&gt;() {<br>    @Override<br>    <em>public void </em>success(Result&lt;TwitterSession&gt; result) {<br>        Toast.<em>makeText</em>(MainActivity.<em>this</em>, &quot;Sucess&quot;, Toast.<em>LENGTH_SHORT</em>).show();<br>        TwitterSession session = TwitterCore.<em>getInstance</em>().getSessionManager().getActiveSession();<br>        String name = session.getUserName();<br>        twitterUserId.setText(name);<br>    }<br><br>    @Override<br>    <em>public void </em>failure(TwitterException exception) {<br>        Log.<em>e</em>(&quot;Twitter Login&quot;,&quot;&quot;+exception.getMessage());<br>        Toast.<em>makeText</em>(MainActivity.<em>this</em>, &quot;failed&quot;, Toast.<em>LENGTH_SHORT</em>).show();<br>    }<br>});</pre><ul><li>Step 3: adding button inside onActivityResult()</li></ul><pre>twitterLogin.onActivityResult(requestCode, resultCode, data);</pre><ul><li>Step 4: adding logout for twitter on app gets closed i.e Activity gets Destroyed</li></ul><pre>@Override<br><em>protected void </em>onDestroy() {<br>    <em>super</em>.onDestroy();<br>    TwitterCore.<em>getInstance</em>().getSessionManager().clearActiveSession();<br>}<br></pre><p>You have successfully added Twitter login and showing their User name inside the TextView</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fsrg19CG0cKMuI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fapplause-clapping-oscars-srg19CG0cKMuI&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fsrg19CG0cKMuI%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="245" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3b4ea475cf2e7fb7826cc0d6a528d46/href">https://medium.com/media/f3b4ea475cf2e7fb7826cc0d6a528d46/href</a></iframe><p>Bonus Time!!</p><p>I have added view Binding inside this project using ButterKnife</p><p>So, how to use it??</p><p>Add dependency inside app gradle</p><pre>implementation &#39;com.jakewharton:butterknife:10.2.1&#39;<br>annotationProcessor &#39;com.jakewharton:butterknife-compiler:10.2.1&#39;</pre><p>also add this compile Options inside android{…}</p><pre>compileOptions {<br>    sourceCompatibility JavaVersion.<em>VERSION_1_8<br>    </em>targetCompatibility JavaVersion.<em>VERSION_1_8<br></em>}</pre><p>Now, Let’s Bind the Views so that we can extend their scope</p><pre>@BindView(R.id.<em>facebook_login</em>)<br>LoginButton facebookLogin;<br></pre><p>Now, bind the view inside the onCreate()</p><pre>ButterKnife.<em>bind</em>(<em>this</em>);</pre><p>This will Bind Views and we can access it inside our class</p><p>Note: Twitter will be asking to authorise app after clicking on Login Button. So, press authorise app instead of cancel to get success.</p><p>Your app will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_B8sAj0J44gauME_UhUMtA.jpeg" /></figure><p>The GitHub repository has a separate branch for this new update as <a href="https://github.com/Horizon733/lets-connect/tree/twitter-login"><strong>Twitter</strong></a></p><p>You can connect with me on <a href="https://www.linkedin.com/in/dishant-gandhi/"><strong>LinkedIn</strong></a> and <a href="https://www.instagram.com/_dishant_733/"><strong>Instagram</strong></a></p><p>Don’t forget to clap for yourself because it is hard to integrate Twitter API with android</p><p>If you missed previous part here is the link -&gt; <a href="https://medium.com/@dishant_gandhi/integrate-social-media-with-android-app-facebook-1-3-9f95b867f4b4"><strong>Facebook</strong></a></p><p>Next Part will be Easiest and Amazing for you all!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=248a6c29accb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Social Media with Android app: Facebook 1/3]]></title>
            <link>https://medium.com/@dishant_gandhi/integrate-social-media-with-android-app-facebook-1-3-9f95b867f4b4?source=rss-490e77b1b024------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f95b867f4b4</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Dishant gandhi]]></dc:creator>
            <pubDate>Mon, 29 Jun 2020 13:37:33 GMT</pubDate>
            <atom:updated>2020-07-01T05:56:25.936Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrate Social Media with Android app: Part 1/3</h3><figure><img alt="Mobile" src="https://cdn-images-1.medium.com/max/1024/0*cZuvtgcvwBxZAuML" /><figcaption>Photo by <a href="https://unsplash.com/@dole777?utm_source=medium&amp;utm_medium=referral">dole777</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Many of you are making android apps with login and sign up pages. Users sometimes want easy way to login or sign up so that it can be fast and save a lot of time entering their details for the sign up.</p><p>So, lets integrate your app with social media platforms so that it can be easier to make sign ups for users.</p><h3>Part 1 : Facebook Login</h3><h3>Let’s start</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FLn2dAW9oycjgmTpjX9%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmemecandy-Ln2dAW9oycjgmTpjX9&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FLn2dAW9oycjgmTpjX9%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="219" frameborder="0" scrolling="no"><a href="https://medium.com/media/b068e8c6581e5c388843715cd6638291/href">https://medium.com/media/b068e8c6581e5c388843715cd6638291/href</a></iframe><p>Add a Facebook Login</p><p>Go to the <a href="https://developers.facebook.com/docs/android">Facebook Developer Android Docs</a> to get started with the Facebook API.</p><figure><img alt="Features for Android SDK" src="https://cdn-images-1.medium.com/max/844/1*LvRdG29flePIXnJMy8NEvA.png" /></figure><p>You will be able to see these options click on Login to get started with login part.</p><figure><img alt="Facebook Developers login" src="https://cdn-images-1.medium.com/max/853/1*JW-XxrKuTOT9GBkkreHUyA.png" /></figure><p>These are the options you will come up to and there will be a link to android SDK click on it and download the SDK for your project. You will have to sign in for getting API for your app</p><figure><img alt="SDK download" src="https://cdn-images-1.medium.com/max/955/1*-3Tb4wfLSdZBE21MU-lXYg.png" /></figure><p>After you have login for Facebook Developer to get Android SDK</p><p>Add the following dependency to your app.gradle file</p><pre>implementation &#39;com.facebook.android:facebook-android-sdk:[5,6)&#39;</pre><p>Add the Login button into your activity xml file</p><pre>&lt;com.facebook.login.widget.LoginButton        android:id=&quot;@+id/facebook_login&quot;        android:layout_width=&quot;wrap_content&quot;        android:layout_height=&quot;wrap_content&quot;        android:layout_marginTop=&quot;16dp&quot;        app:layout_constraintEnd_toEndOf=&quot;@+id/userName&quot;        app:layout_constraintStart_toStartOf=&quot;@+id/userName&quot;        app:layout_constraintTop_toBottomOf=&quot;@+id/userName&quot; /&gt;</pre><p>Then you will have to follow all the instructions for setting up your.</p><p>These would be the instructions for setting up your app for login:</p><ul><li>Adding Development Hashes to the site. You will be getting hashes from the following command in your terminal:</li></ul><pre>keytool -exportcert -alias androiddebugkey -keystore &quot;C:\Users\USERNAME\.android\debug.keystore&quot; | &quot;PATH_TO_OPENSSL_LIBRARY\bin\openssl&quot; sha1 -binary | &quot;PATH_TO_OPENSSL_LIBRARY\bin\openssl&quot; base64</pre><p>Here, PATH_TO_OPENSSL_LIBRARY = openssl folder path. You can get OpenSSL by clicking <a href="https://code.google.com/archive/p/openssl-for-windows/downloads">here</a></p><p>Add your jdk/bin into your environment variables so that you can run this command on any path.</p><ul><li>Next step will be, to edit your Resources and Manifest files. You will have to add codes that will be given you on that site.</li><li>Add the following import in your Activity</li></ul><pre><em>import </em>com.facebook.appevents.AppEventsLogger;</pre><p>There are some changes to the code that will be given to you on the site. In there appIntialization() is been deprecated since SDK is automatically initialised</p><pre>AppEventsLogger.<em>activateApp</em>(getApplication());</pre><p>You have to add only the above code snippet in you activity by replacing the following line: since this is deprecated</p><pre>AppEventsLogger.activateApp(this);</pre><p>add the following string.xml these will be provided to you by Facebook itself in the process</p><pre>&lt;string <em>name</em>=&quot;facebook_app_id&quot;&gt;Your app id&lt;/string&gt;<br>&lt;string <em>name</em>=&quot;fb_login_protocol_scheme&quot;&gt;your login protocol scheme&lt;/string&gt;</pre><p>At the time of adding Login Button in Activity you will have to write following code:</p><pre>final LoginButton facebookLogin = findViewById(R.id.<em>facebook_login</em>);</pre><p>the setReadPermissions() method is been deprecated so I have used setPermissions()</p><p>You have to add all the login code inside the OnClickListener. The code is below</p><pre><em>private static final </em>String <em>EMAIL </em>= &quot;email&quot;;<br>...<br><br>facebookLogin.setOnClickListener(<em>new </em>View.OnClickListener() {<br>    @Override<br>    <em>public void </em>onClick(View v) {<br>        facebookLogin.setPermissions(Arrays.<em>asList</em>(<em>EMAIL</em>));<br><br>        facebookLogin.registerCallback(callbackManager, <em>new </em>FacebookCallback&lt;LoginResult&gt;() {<br>            @Override<br>            <em>public void </em>onSuccess(LoginResult loginResult) {<br>               //Your code<br>            }<br><br>            @Override<br>            <em>public void </em>onCancel() {<br>               //your code<br>            }<br><br>            @Override<br>            <em>public void </em>onError(FacebookException exception) {<br>                //your code <br>            }<br>        });<br><br>    }<br>});<br></pre><p>this will only work with emulator so if you want to make it work with physical smart phones then you will have to do the follow steps:</p><ul><li>First add the PackageInfo and get the key hash from log and add to the developer Facebook dashboard</li></ul><pre><em>try </em>{<br>    PackageInfo info = getPackageManager().getPackageInfo(<br>            &quot;com.example.letsconnect&quot;,<br>            PackageManager.<em>GET_SIGNATURES</em>);<br>    <em>for </em>(Signature signature : info.signatures) {<br>        MessageDigest md = MessageDigest.<em>getInstance</em>(&quot;SHA&quot;);<br>        md.update(signature.toByteArray());<br>        Log.<em>d</em>(&quot;KeyHash:&quot;, Base64.<em>encodeToString</em>(md.digest(), Base64.<em>DEFAULT</em>));<br>    }<br>} <em>catch </em>(PackageManager.NameNotFoundException e) {<br>    e.getMessage();<br>} <em>catch </em>(NoSuchAlgorithmException e) {<br>    e.getMessage();<br>}</pre><figure><img alt="Facebook Developer DashBoard" src="https://cdn-images-1.medium.com/max/973/1*zEcZ_6VKDChJmoREVx8eKA.png" /></figure><p>where I have added orange line is place where you have to add that key and save changes</p><p>Now lets display Name of the user on the TextView, for this we will be creating a function with accesstoken. To get the AccessToken use the follow code</p><pre>AccessToken accessToken = AccessToken.<em>getCurrentAccessToken</em>();</pre><p>Now, Lets create that function!!</p><p>The following code will help you we will be using Graph API for fetching the JSON Object. We will be create a GraphRequest and then we will execute the request with the parameters and pass as Bundle. Now lets look at the function below:</p><pre><em>private void </em>getUserName(AccessToken accessToken) {<br>    GraphRequest request = GraphRequest.<em>newMeRequest</em>(accessToken, <em>new </em>GraphRequest.GraphJSONObjectCallback() {<br>        @Override<br>        <em>public void </em>onCompleted(JSONObject object, GraphResponse response) {<br>            TextView username = findViewById(R.id.<em>userName</em>);<br>            String name = <em>null</em>;<br>            <em>try </em>{<br>                <em>if </em>(object.has(&quot;first_name&quot;)) {<br>                    name = object.getString(&quot;first_name&quot;);<br><br>                }<br>                <em>if </em>(object.has(&quot;last_name&quot;)) {<br>                    name += &quot; &quot; + object.getString(&quot;last_name&quot;);<br>                }<br>            } <em>catch </em>(JSONException e) {<br>                e.printStackTrace();<br>            }<br>            <em>if </em>(name.isEmpty()) {<br>                username.setText(&quot;sorry no name&quot;);<br>            }<br>            username.setText(name);<br>        }<br>    });<br>    Bundle parameters = <em>new </em>Bundle();<br>    parameters.putString(&quot;fields&quot;, &quot;first_name,last_name&quot;);<br>    request.setParameters(parameters);<br>    request.executeAsync();<br>}</pre><p>Remember we are getting input as accessToken and returing void.</p><h3>Lets go on the Final part of this part 1</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FAuwBPJztsEWkw%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffinally-its-about-time-took-long-enough-AuwBPJztsEWkw&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2FAuwBPJztsEWkw%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="363" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f74f3c102cdcf27a020910f77abd953/href">https://medium.com/media/1f74f3c102cdcf27a020910f77abd953/href</a></iframe><p>We will be need onActivityResult if user come backs after quiting the app it should not log out them</p><pre>@Override<br><em>protected void </em>onActivityResult(<em>int </em>requestCode, <em>int </em>resultCode, @Nullable Intent data) {<br>    callbackManager.onActivityResult(requestCode, resultCode, data);<br>    <em>super</em>.onActivityResult(requestCode, resultCode, data);<br>}</pre><h3>Bonus!!!</h3><p>Lets keep our code to be crash free, So add an if/else statement to fix the issue if AccessToken is null</p><pre><em>if </em>(accessToken != <em>null</em>) {<br>    getUserName(accessToken);<br>} <em>else </em>{<br>    TextView username = findViewById(R.id.<em>userName</em>);<br>    username.setText(R.string.<em>default_text</em>);<br>}</pre><p>This will look into it and add string as Your FB Name is accessToken is null</p><p>This is the simple and clean app Screenshot:</p><figure><img alt="Let’s Connect" src="https://cdn-images-1.medium.com/max/1024/1*MsO9NIyN3e4EvUI2AEnOKA.jpeg" /></figure><p>Here is my Github Repo<a href="https://github.com/Horizon733/lets-connect"> Lets Connect</a></p><p>You can connect with me on <a href="https://www.linkedin.com/in/dishant-gandhi/">LinkedIn</a> and <a href="https://www.instagram.com/_dishant_733/">Instagram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f95b867f4b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>