goodbotai / karma

Experience sampling bot
BSD 2-Clause "Simplified" License
7 stars 0 forks source link

Separate aggregation and Ona modules to send data to another service at the end of a botkit flow #4

Closed pld closed 7 years ago

pld commented 7 years ago
  1. Write a module that aggregates data

When a flow ends, we want a module to group all the data collected in the flow together, including:

  1. Write a module that stores this data in Ona

Decoupled from the module that aggregates data, write a module that stores this data in Ona, can use the milia (and if we stick in JS for now the JS link to milia, @royrutto and @geoffreymuchai have used this)

urbanslug commented 7 years ago

How to do this: 1.

2.

An example facebook profile from FB looks like so

{ first_name: 'Bots',
  last_name: 'Maker',
  profile_pic: 'https://scontent.xx.fbcdn.net/v/t1.0-1/17426114_114715302399085_9126504909207438629_n.jpg?oh=ac5699635c68bccd07dc908b9dc93a03&oe=597A2513',
  locale: 'en_GB',
  timezone: 3,
  gender: 'female',
  is_payment_enabled: true}

We plan to POST to rapidpro JSON that looks like this:

'{
    "name": "Initial Contact",
    "urns": ["facebook:2334445454"],
    "fields": { "profile_pic": "https://scontent.xx.fbcdn.net/v/t1.0-1/17426114_114715302399085_9126504909207438629_n.jpg?oh=ac5699635c68bccd07dc908b9dc93a03&oe=597A2513",
                "locale": "en_GB",
                "timezone": 3,
                "gender": "female",
                "is_payment_enabled": true}
}'

3.

4.