Chore: Add Facebook app set up documentation (#647)

Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-03-28 11:43:02 +05:30
committed by GitHub
parent 209e0a0fb4
commit a3c2d4e5bd
23 changed files with 211 additions and 38 deletions

View File

@@ -3,7 +3,7 @@ import ApiClient from '../ApiClient';
class FBChannel extends ApiClient {
constructor() {
super('facebook_indicators');
super('facebook_indicators', { accountScoped: true });
}
markSeen({ inboxId, contactId }) {
@@ -22,7 +22,7 @@ class FBChannel extends ApiClient {
create(params) {
return axios.post(
`${this.apiVersion}/callbacks/register_facebook_page`,
`${this.url.replace(this.resource, '')}callbacks/register_facebook_page`,
params
);
}

View File

@@ -5,9 +5,9 @@
import endPoints from './endPoints';
export default {
fetchFacebookPages(token) {
fetchFacebookPages(token, accountId) {
const urlData = endPoints('fetchFacebookPages');
urlData.params.omniauth_token = token;
return axios.post(urlData.url, urlData.params);
return axios.post(urlData.url(accountId), urlData.params);
},
};

View File

@@ -28,7 +28,9 @@ const endPoints = {
},
fetchFacebookPages: {
url: 'api/v1/callbacks/facebook_pages.json',
url(accountId) {
return `api/v1/accounts/${accountId}/callbacks/facebook_pages.json`;
},
params: { omniauth_token: '' },
},

View File

@@ -0,0 +1,15 @@
import fbChannel from '../../channel/fbChannel';
import ApiClient from '../../ApiClient';
describe('#FBChannel', () => {
it('creates correct instance', () => {
expect(fbChannel).toBeInstanceOf(ApiClient);
expect(fbChannel).toHaveProperty('get');
expect(fbChannel).toHaveProperty('show');
expect(fbChannel).toHaveProperty('create');
expect(fbChannel).toHaveProperty('update');
expect(fbChannel).toHaveProperty('delete');
expect(fbChannel).toHaveProperty('markSeen');
expect(fbChannel).toHaveProperty('toggleTyping');
});
});