<?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 Pam Lucas on Medium]]></title>
        <description><![CDATA[Stories by Pam Lucas on Medium]]></description>
        <link>https://medium.com/@pamlucas?source=rss-232e8b5c36db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gyCXKktE4xy5Slc5.</url>
            <title>Stories by Pam Lucas on Medium</title>
            <link>https://medium.com/@pamlucas?source=rss-232e8b5c36db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 16:24:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pamlucas/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[Building a weather bot just got easier with Converse.AI Chatflow system]]></title>
            <link>https://medium.com/state-of-the-conversation/building-a-weather-bot-just-got-easier-with-converse-ai-chatflow-system-86eaeb359e66?source=rss-232e8b5c36db------2</link>
            <guid isPermaLink="false">https://medium.com/p/86eaeb359e66</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[Pam Lucas]]></dc:creator>
            <pubDate>Fri, 09 Sep 2016 14:02:26 GMT</pubDate>
            <atom:updated>2016-09-09T14:02:26.428Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*65zNelr8Oyw-PRgmKIobsA.png" /></figure><p>This is a guide to building a simple bot to give you the weather forecast for today.</p><p>This is a step by step guide to building a weather bot in just a few minutes.</p><p>I’m building this using the Converse.AI designer, and @forecast.io’s weather API, which is built into our designer as a Chatflow module.</p><p>Firstly, Forecast.IO’s API requires a Latitude/Longitude pair for it to give an accurate weather forecast. I will also another of our modules, Google Geocode.</p><p>When you first go into the designer, a single state is created called ‘startstate’. Each state allows to you to either collect or deliver information, as questions and answers, and also run Chatflow modules as required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/1*-DxFEALMcmGNkke3n5oBEA.jpeg" /></figure><p>For the first startstate, we want to ask the user the location they need the weather for. So let’s do the following:</p><p>a) Rename your startstate to “city”</p><p>b) Change the question to be ‘Which city do you require the weather for’</p><p>c) Because the input could be almost anything, we want to accept anything as an input at this time, so lets add a context of sys-any, (don’t forget to hit return!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*Jgkm-f6CGFUb8XVQJj-4JA.jpeg" /></figure><p>Now drag the module over called “Geo Address or Lat/Long” from the left hand side (search for Geo if you can’t see it) and drop it underneath the first state.</p><p>This tells it to run immediately after getting an answer to the question in the first state.</p><p>If you haven’t used the Geocoding module before, it will pop up and ask you to register your API Key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*LafI7UGzqW0fp-R186i3aQ.jpeg" /></figure><p>To do this, you will need a API Key from Google, more details available from <a href="https://developers.google.com/maps/documentation/geolocation/intro">here</a> on how to retrieve this.</p><p>Once you have your key, Enter it under ‘Api Key’, hit save and close the Plugin window.</p><p>Now that the module is registered, we need to tell it how to reference the data collected from the ‘City’ question.</p><p>You can do this very simply using handlebars [Link to Handlebars docs here], in the form of {{states.statename.value}}, so in this case {{states.city.value}}.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*Btmjg7eznghMo-5I0asfUw.jpeg" /></figure><p>That’s all you need to do to get the city name Geocoded, now for the weather module.</p><p>Drag it over underneath the Geocode module in the designer, and again it will popup and ask you to register.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Kacv9Inthfy0Rk3Pv4k6-g.jpeg" /></figure><p>To register for the weather module go to <a href="https://developer.forecast.io/">https://developer.forecast.io</a> create an account, login and you will see your api key at the bottom of the website, copy this into the plugin registration page, save and close.</p><p>The designer layout should now look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*Ao_62GQTg19pev3lNLXtEw.jpeg" /></figure><p>Now we need to reference the geocoded data from the Geocode module to pass into Forecast.</p><p>As the Geocode module references the latitude and longitude as separate fields, we need to reference them both in turn. Luckily the handlebars system is clever enough to cope with strings, tables and any variation, so it’s simple enough to put</p><p>{{states.city.geo.geocode.results.0.geometry.location.lat}},{{states.city.geo.geocode.results.0.geometry.location.lng}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*OoMY7ngKKFy6F19Hn1GdhQ.jpeg" /></figure><p>NOTE: There is a comma separating the two sets of handlebars, to make it the classic lat,long format.</p><p>So now we have the pieces together to geocode and get the weather data from Forecast.io,</p><p>Almost there, but one small problem, to make this truly international, we need to show the weather in Centigrade/Celsius as well as Fahrenheit, which we receive back from Forecast.io. To do that we need to use Converse AI’s maths functions to convert from one to the other.</p><p>For anyone that doesn’t know, the standard mechanism for F to C is (F-32)/1.8 = C</p><p>So firstly we need to remove 32 from the Fahrenheit value, to do this drag over the Subtract module to the bottom of the designer, and in the remove field enter 32. (Not -32)</p><p>In the number field enter the handlebar reference to the current temperature from Forecast.io Which is {{states.city.weather.forecast.currently.temperature}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*vFNjYXMJWlccONJZvbaYHg.jpeg" /></figure><p>Now drag over a divide state and in the Divider field enter 1.8</p><p>In the number field enter the handlebar reference to the output from the subtract module {{states.city.maths.subtract}}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*pM3SzAJQPqiN6LGcmE8oCg.jpeg" /></figure><p>Now drag over the round module, set the round to 0 places and enter the handlebar {{states.city.maths.divide}} to tidy it up to a readable number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*JQLfwLf1Ci_EK05M77SF3Q.jpeg" /></figure><p>With that all done, we now have the current temperature available to us in Fahrenheit and Centrigrade</p><p>We also want to show the forecasted maximum and minimum temperatures in Centigrade as well. To avoid confusion of running the same modules twice in the same State, we are going to add another state for each of these, ‘weathermin’ and ‘weathermax’</p><p>Create ‘weathermin’ first by dragging ‘new state’ over from the side bar</p><p>Under your new state add the subtract module, set the subtract amount to 32, and the number reference using handlebars of {{states.city.forecast.weather.daily.data.0.apparentTemperatureMax}} (you will notice this handle bar is slightly different as we are looking for the max temperature for that day)</p><p>Now drag over the divide module, with Divider of 1.8 and Number reference of {{states.weathermax.maths.subtract}}</p><p>Drag over the round module with a round of 0 and Number reference of {{states.weathermax.maths.divide}}</p><p>Now drag a new state over for weathermin, and perform the same steps as above except use the following handlebars:</p><p>Subtract: {{states.city.weather.weather.daily.data.0.apparentTemperatureMin}}</p><p>Divide: {{states.weathermin.maths.subtract}}</p><p>Round: {{states.weathermin.maths.divide}}</p><p>Ok, we now have all the pieces together to get the data we need, so we just need to format the answer now. Again, we can do that using handlebars.</p><p>In the answer field of the weathermin state copy and paste the text below, as you will be able to see it references the data you have collected through the various states.</p><p>The current forecast in {{states.city.value}} is {{states.city.weather.forecast.hourly.summary}} The current temperature is {{states.city.weather.forecast.currently.temperature}}F / {{states.city.maths.round}}C</p><p>with a high of {{states.city.weather.forecast.daily.data.0.apparentTemperatureMax}}F / {{states.weathermax.maths.round}}C</p><p>and a low of {{states.city.weather.forecast.daily.data.0.apparentTemperatureMin}}F /</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*141Zf771T6GCi5Rb-t-bEQ.jpeg" /></figure><p>One last thing to do is add a trigger phrase, or phrases in this case I am going to add :</p><p>“Weather”</p><p>“Weather forecast”</p><p>“Forecast”</p><p>(To add your trigger phrase click on the icon top right that says “trigger phrases”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*kVUT_i-_Ivq2PPe8JOIthg.jpeg" /></figure><p>Lets try out our new bot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*BHHP8MKtuOgY3IAkd_ROxQ.jpeg" /></figure><p>And thats all there is to it!</p><p>Get started today! Head to <a href="http://www.converse.ai/">www.converse.ai</a> and sign up for an account to get going. Thanks for reading, please leave a comment or recommend us if you like what we are doing!</p><p>Converse.AI — enabling you and your customers success through messaging.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86eaeb359e66" width="1" height="1" alt=""><hr><p><a href="https://medium.com/state-of-the-conversation/building-a-weather-bot-just-got-easier-with-converse-ai-chatflow-system-86eaeb359e66">Building a weather bot just got easier with Converse.AI Chatflow system</a> was originally published in <a href="https://medium.com/state-of-the-conversation">State of the Conversation</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>