Project 15: Assignment Integromat

I am not able to implement “Project 15: Assignment Integromat”. Can someone please mention the detailed steps in order to complete the project, beginning from Creating a scenario on Integromat?

@meet.joshi.iitkgp Can you please share which step of the assignment you are facing an issue with?

@shoeb.ahmed Firstly, I am facing issue in task 2 step3 " Link the Facebook module to the webhooks module." I choose facebook > actions > Get a Post. what next?
I get a dropdown in post section. How can I write my own post? PFA the screenshot

Actually you have to choose facebook (legacy) module.

  1. when adding new module to the webhook click on “add another module”
  2. select facebook -> facebook(legacy)
  3. in this module you will get the option of “create a post” trigger to select.

ALERT - But don’t choose this module and “create a post” trigger because it won’t work. You will get the error - “403: OAuthException (200)” when you look at the history tab of your scenario in integromat.
Reason - facebook module is version 6 and facebook legacy module is version 5 ,i.e., the older one. Previously you could post on facebook through triggering webhook but now facebook has reviewed the auto-post feature and does not let anyone auto-post on facebook. That’s why the “create a post” feature is not available in the facebook module.

Have a look at the history of the scenario using twitter module’s “create a tweet” instead of facebook module’s “create a post” shown in the image below.

2 Likes

add twitter module instead.
choose ‘create a tweet’ trigger.
add the message "I am not getting enough light - sent by your Plant " in the status field of the trigger.
You will get the desired result as shown below.

Have a look at the history of the scenario using facebook shown in the image below.

1 Like

really nice!!! appreciate it

1 Like

Hi ,

Using your last assignment (project 14), you have to include the below function alone in mid of your code.
def trigger_integromat_webhook():
URL = “https://www.integromat.com/” # REPLACE WITH CORRECT URL
response = requests.request(“GET”, URL)
print response.text

Set up in integromat:

  1. Click https://www.integromat.com/
  2. Click “Create a new scenario”
  3. Click Webhooks and Twitter
  4. Click the “Question Mark”
  5. Click the Webhook – > Click Custom Webhook—>Click Add
  6. you will get a link
  7. copy and paste it somewhere
  8. Click “Add another module” (in webhooks right side)
  9. Click Twitter
  10. Configure and login your twitter
  11. Click “Create Tweet”
  12. In Status type “Someone have entered in your room - From BoltIoT”
  13. Click “Run Once” in bottom left
  14. Then open digitalOcean/ubuntu and configure the below code:

Full Code:
import conf, json, time, math, statistics,requests
from boltiot import Sms, Bolt
def compute_bounds(history_data,frame_size,factor):
if len(history_data)<frame_size :
return None

if len(history_data)>frame_size :
    del history_data[0:len(history_data)-frame_size]
Mn=statistics.mean(history_data)
Variance=0
for data in history_data :
    Variance += math.pow((data-Mn),2)
Zn = factor * math.sqrt(Variance / frame_size)
High_bound = history_data[frame_size-1]+Zn
Low_bound = history_data[frame_size-1]-Zn
return [High_bound,Low_bound]

mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SSID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)
history_data=[]

def trigger_integromat_webhook():
URL = “THE WEBHOOK LINK from INTEGROMAT”
response = requests.request(“GET”, URL)
print(response.text)

while True:
response = mybolt.analogRead(‘A0’)
data = json.loads(response)
if data[‘success’] != 1:
print(“There was an error while retriving the data.”)
print(“This is the error:”+data[‘value’])
time.sleep(10)
continue
print ("This is the value "+data[‘value’])
sensor_value=0
try:
sensor_value = int(data[‘value’])
except e:
print("There was an error while parsing the response: ",e)
continue

bound = compute_bounds(history_data,conf.FRAME_SIZE,conf.MUL_FACTOR)
if not bound:
    required_data_count=conf.FRAME_SIZE-len(history_data)
    print("Not enough data to compute Z-score. Need ",required_data_count,"$
    history_data.append(int(data['value']))
    time.sleep(10)
    continue

try:
    if sensor_value > bound[0] :
        print ("The light level increased suddenly. Sending an SMS.")
        response = sms.send_sms("Someone turned on the lights")
        trigger_integromat_webhook()
        print("This is the response ",response)
    elif sensor_value < bound[1]:
        print ("The light level decreased suddenly. Sending an SMS.")
        response = sms.send_sms("Someone turned off the lights")
        trigger_integromat_webhook()
        print("This is the response ",response)
    history_data.append(sensor_value);
except Exception as e:
    print ("Error",e)
time.sleep(10)

Let me know if any help required. please find the images for reference.

5 Likes

please explain what comes in the "$ .The code appears to be incomplete

It represents the continuation of line. If any of your statement does not fit in one line " $ " this symbol appears.


i am getting this can you help me debug this

Can you share your code if you still face the same issue?


showing request accepted Still i am not getting tweet on twitter