[Vtigercrm-developers] vtiger integration with facebook messanger

Sutharsan J ajstharsan at gmail.com
Tue Apr 18 05:52:07 GMT 2023


Hi Rubén

Did you try ChatGPT?  Even 3.5, gives a lot of support on fb integration as
well as other common development areas.  I got this :)


// Set up variables
$page_access_token = 'YOUR_PAGE_ACCESS_TOKEN';
$recipient_id = 'USER_OR_PAGE_ID';
$message_text = 'Hello, World!';

// Create message payload
$message_data = array(
    'recipient' => array('id' => $recipient_id),
    'message' => array('text' => $message_text)
);

// Set up API endpoint and request options
$api_endpoint = 'https://graph.facebook.com/v13.0/me/messages';
$request_options = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-Type: application/json',
        'content' => json_encode($message_data)
    )
);

// Send message
$context = stream_context_create($request_options);
$result =
file_get_contents($api_endpoint.'?access_token='.$page_access_token, false,
$context);



Thanks
Sutharsan Jeganathan



On Tue, Apr 18, 2023 at 4:41 AM Rubén A. Estrada Orozco <rulotec1 at gmail.com>
wrote:

> Thanks Sutharsan,
>
> Your overview is great. It's a very good starting point.
>
> Saludos
>
> Rubén
>
>
> On Fri, Apr 14, 2023 at 10:37 PM Sutharsan J <ajstharsan at gmail.com> wrote:
>
>> Hi
>>
>> You have to determine the authentication, such as user based or single.
>> Here is the scenario I used with a single account, in this case server
>> to server
>> <https://developers.facebook.com/docs/development/create-an-app/server-to-server-apps>
>> authentication. Note, I did this long ago and FB APIs changes,  so not
>> sharing code
>>
>>    1. You may create a vtiger module such as "vtFbMessenger"
>>    2.
>>
>>    Create a Facebook App: Create a Facebook Ap
>>    <https://developers.facebook.com/docs/development/create-an-app>p in
>>    the Facebook Developer Console. This will allow you to authenticate your
>>    app and access the Messenger API
>>    3.
>>
>>     Web hook : Handle incoming messages: In your PHP application's
>>    webhook, handle incoming messages from the Messenger API.
>>    1. Subscribe to the Messenger API: In your app's Messenger settings,
>>       subscribe to the Messenger API by providing the URL of your PHP
>>       application's webhook.
>>       2. Set up a webhook: Create a webhook in your PHP application that
>>       listens for incoming messages from the Messenger API. When a message is
>>       received, your webhook will be notified.
>>    4.
>>
>>    Sending: You can use the Messenger API to send  messages, and to
>>    handle user input.
>>    1. Use an Action under vtFbMessenger module
>>       2.
>>
>>       Authenticate your app: Authenticate your app using a Facebook App
>>       Access Token or a Page Access Token.
>>       3. Write code to send message
>>
>> Refer
>> https://developers.facebook.com/docs/messenger-platform/overview#app-review
>>
>> Thanks
>> Sutharsan Jeganathan
>>
>>
>> On Sat, Apr 15, 2023 at 6:19 AM Rubén A. Estrada Orozco <
>> rulotec1 at gmail.com> wrote:
>>
>>> Hi everyone,
>>>
>>> A client asked me to integrate FB Messaner to Vtiger, so
>>> that vtiger users can chat using facebook messenger from within vtiger.
>>> Anybody has any experience with this? Any ideas on how/where to start?
>>>
>>> Saludos
>>>
>>> Rubén
>>> _______________________________________________
>>> http://www.vtiger.com/
>>
>>
>>
>> --
>> Development Manager
>> Radus28 Software Solution
>> [image: Radus28 Software Solution]
>> 123, Level 2, Mc Larens Building
>> Baudhaloka Mw.
>> Colombo 04
>> Sri Lanka
>> M : +94773795291
>> E  : sutharsan at radus28.com
>> W : www.radus28.com
>> _______________________________________________
>> http://www.vtiger.com/
>
> _______________________________________________
> http://www.vtiger.com/



-- 
Development Manager
Radus28 Software Solution
[image: Radus28 Software Solution]
123, Level 2, Mc Larens Building
Baudhaloka Mw.
Colombo 04
Sri Lanka
M : +94773795291
E  : sutharsan at radus28.com
W : www.radus28.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20230418/9be55631/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_web.png
Type: image/png
Size: 15612 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20230418/9be55631/attachment-0001.png>


More information about the vtigercrm-developers mailing list