VivochaCustomAction
@interface VivochaCustomAction : NSObject
Represents a custom action that can be implemented by the developer to send/receive events from custom apps in the Agent Desktop.
Usage example:
//Send a custom action
VivochaCustomAction *userLoggedIn = [VivochaCustomAction actionWithName:@"userLoggedIn" andJSON:@{
@"userID" : [MyApp getUserId],
@"eventKind" : @"login",
}];
[[Vivocha contact] sendCustomAction:userLoggedIn];
//Receive an action
[[Vivocha manager] bindAction:@"balanceUpdated" withBlock:^(VivochaCustomAction *action) {
//The balance was updated from the agent, let's refresh the APP UI
NSDictionary *payload = [action actionData];
NSString *balanceValue = [payload objectForKey:@"balance"];
[MyViewController updateBalanceUIWithValue:balanceValue];
}];
-
@property (nonatomic, retain) NSString *actionID;The action ID
-
@property (nonatomic, retain) NSString *actionName;The action ID
-
@property (nonatomic, retain) id actionData;The action payload (from the JSON)
-
+ (VivochaCustomAction *)actionWithName:(NSString *)actionName andJSON:(NSDictionary *)json;Factory method for a custom action object.
Parameters
actionNamethe action name
jsonthe action paylaod (a NSDictionary object)
Return Value
the custom action.