facebook-send-api
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -62,2 +62,10 @@ import * as Promise from 'bluebird'; | ||
} | ||
export interface FacebookUser { | ||
first_name: string; | ||
last_name: string; | ||
profile_pic: string; | ||
locale: string; | ||
timezone: number; | ||
gender: string; | ||
} | ||
export declare class FBMessage { | ||
@@ -132,2 +140,3 @@ protected platform: FBPlatform; | ||
createQuickReply(title: string, payload: string): MessengerQuickReply; | ||
getUserProfile(id: string): Promise<FacebookUser>; | ||
} |
@@ -336,2 +336,6 @@ "use strict"; | ||
}; | ||
FBPlatform.prototype.getUserProfile = function (id) { | ||
return rp("https://graph.facebook.com/v2.6/" + id + "?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=" + this.token) | ||
.then(function (response) { return JSON.parse(response); }); | ||
}; | ||
return FBPlatform; | ||
@@ -338,0 +342,0 @@ }()); |
{ | ||
"name": "facebook-send-api", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Promise based module to speak to the facebook send api for the messenger platform", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -75,2 +75,11 @@ import * as Promise from 'bluebird'; | ||
export interface FacebookUser { | ||
first_name: string; | ||
last_name: string; | ||
profile_pic: string; | ||
locale: string; | ||
timezone: number; | ||
gender: string; | ||
} | ||
interface MessengerPostback { | ||
@@ -436,2 +445,7 @@ payload: string, | ||
} | ||
public getUserProfile(id: string): Promise<FacebookUser> { | ||
return rp(`https://graph.facebook.com/v2.6/${id}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=${this.token}`) | ||
.then((response: string) => JSON.parse(response) as FacebookUser); | ||
} | ||
} |
201225
4488