0 purchases
rapidpro
rapidpro #
Version: 0.0.1
A Flutter package to implement the RapidPro or TextIt firebase channel easily
First follow any of the below guide depending on your platform to add firebase in your project
Add Firebase to your iOS project
Add Firebase to your Android project
Usage
You have to configure on message event to handle incoming messages through firebase cloud message
For example:
firebaseMessaging.configure(
onMessage: (msg) async {
}
);
copied to clipboard
First import the package and create a RapidPro instance.
import 'package:rapidpro/rapidpro.dart';
copied to clipboard
RapidPro class accepts the firebaseChannel, firebaseToken, workspaceToken, urn, server and optionally a name parameter
RapidPro rapidPro = RapidPro(
server: "textit.in",
channel: "3gcr67-ascas32-41ac", // https://textit.com/c/fcm/3gcr67-ascas32-41ac/register
urn: "[email protected]", // Your urn,
fcmToken: "932v983bv298374vb237894v4982828uv2828", // Your own fcm token
workspaceToken: "2df472f3942b4v2424284",
name: "John Doe", // Optional
);
copied to clipboard
You can hold this instance by using any state management package like
provider, blocs etc for future use.
Now you are ready to register, start flow, send message using the above RapidPro instance
Some examples are below
rapidPro.register(
onSuccess: (String uuid){
// Now you have the uuid, that's typically like "345v345v-v5252b3-2v3523b-42vvv22v"
},
onError(e){
// Handle the error in your own way
}
);
copied to clipboard
To start a flow you need to know the flow uuid. Example: c2v-23c44-2v3424
rapidPro.startFlow(
flow: "c2v-23c44-2v3424",
onSuccess: (response){
},
onError: (e){
}
);
copied to clipboard
Sending a message is very easy
rapidPro.sendMessage(
message: "Hello",
onSuccess: (response){
},
onError: (error){
}
);
copied to clipboard
Contributors:
Any form of contribution will be appreciated
Feel free to reach me if you have any confusion or suggestions
[email protected]
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.