mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
Chore: Add Facebook app set up documentation (#647)
Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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: '' },
|
||||
},
|
||||
|
||||
|
||||
15
app/javascript/dashboard/api/specs/channel/fbChannel.spec.js
Normal file
15
app/javascript/dashboard/api/specs/channel/fbChannel.spec.js
Normal 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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user