ActiveCampain API Crul

https://developers.activecampaign.com/reference/get-contact
https://developers.activecampaign.com/reference/create-contact-tag
を、参考にしてCurlで接続してみた

curl -v -H “Accept: application/json” \
-H “Content-type: application/json” \
-H “API-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxx287123dc”\
-X GET \
https://{youraccountname}.api-us1.com/api/3/accounts/1

curl –http1.1 -v -H “Accept: application/json” \
-H “Content-type: application/json” \
-H “API-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxx287123dc”\
-X POST \
-d ‘{“contactTag”:{“contact”: 1,”tag”: 2 } }’ \
https://{youraccountname}.api-us1.com/api/3/contactTags

Crulで、検証できると、とても解りやすい

ActiveCampaign AIP をPythonで操作 Ubuntu20.04

ActiveCampaignを外部連携するために、APIを使ってみた

$cat /etc/issue
Ubuntu 20.04.5 LTS
 
cd
# トップに戻って
python -V Python 3.8.10
#バージョンは 3.8.10

#作業エリアをactcmpとして
mkdir actcmp 
cd actcmp 

python -m venv env
#仮想環境を作り

source env/bin/activate

#ライブラリィーをインストール
  
pip install activecampaign-python

ファイルを作って
from activecampaign.client import Client
client = Client(URL, API_KEY)
response = client.contacts.list_all_contacts(email="johndoe@example.com")
sample.py
で格納
python sample.py
で、実行

やはり、Pythonは使いやすい

はじめ、PHPで行なおうとしたが
#https://github.com/ActiveCampaign/activecampaign-api-php
Composer
で、手間取ってしまい、pythonで行うことにした

Autometionで全体のながれを作り
外部ベージでイベントで、Tagを変更してコントロールしようと
考えている

PHP+Zaper+ActiveCampaign
では、連携はできたのであるが
せかっくなので、Zaperなしのシステムにしたいと思う

ubuntu 20 Apache2とPHPをインストール

Ubuntu 20のノートPCで、PHPのデバック環境を構築のために、ApachとPHPをインストールして、Web用のPHPの動作確認ができる環境を作ってみた




静的な、HTMLのサンプルプログラムを作ってみる

sudo vim /var/www/html/test.html

vimが入っていなかった

vim
sudo apt install vim
sudo vim /var/www/html/test.html


挿入
i

<html>

<hr>

hello

<hr>

</html>

esc :wq
保存終了

http://127.0.1.1/test.html

では、PHPをインストールしてみる

PHPと libapache2-mod-phpをインストール

sudo apt install php libapache2-mod-php

php -v

PHP 7.4.3 (cli) (built: Oct 25 2021 18:20:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

バージョンは7.4.3 

サンプルプログラムを作ってみる

sudo vim /var/www/html/info.php

挿入
i

<?php
  phpinfo();
?>

esc :wq
保存終了

ブラウザーから実行してみる

http://127.0.1.1/info.php

無事起動できた

apacheの状態がどうか確認、起動、停止は


apacheの状態がどうか確認するのは
sudo systemctl status apache2

apacheを停止するのは
sudo systemctl stop apache2

apacheを起動するのは
sudo systemctl start apache2

内容確認
$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor pres>
Active: active (running) since Sun 2021-12-12 10:31:30 JST; 1min 46s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 12169 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/>
Main PID: 12174 (apache2)
Tasks: 6 (limit: 6973)
Memory: 9.6M
CGroup: /system.slice/apache2.service
├─12174 /usr/sbin/apache2 -k start
├─12175 /usr/sbin/apache2 -k start
├─12176 /usr/sbin/apache2 -k start
├─12177 /usr/sbin/apache2 -k start
├─12178 /usr/sbin/apache2 -k start
└─12179 /usr/sbin/apache2 -k start

12月 12 10:31:30 Lenovo systemd[1]: Starting The Apache HTTP Server…
12月 12 10:31:30 Lenovo apachectl[12172]: AH00558: apache2: Could not reliably>
12月 12 10:31:30 Lenovo systemd[1]: Started The Apache HTTP Server.

画面が、表示状態なのでqで終了する

apache2を終了

$ sudo systemctl stop apache2

内容確認
$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor pres>
Active: inactive (dead) since Sun 2021-12-12 10:34:56 JST; 4s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 12169 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/>
Process: 12413 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SU>
Main PID: 12174 (code=exited, status=0/SUCCESS)

12月 12 10:31:30 Lenovo systemd[1]: Starting The Apache HTTP Server…
12月 12 10:31:30 Lenovo apachectl[12172]: AH00558: apache2: Could not reliably>
12月 12 10:31:30 Lenovo systemd[1]: Started The Apache HTTP Server.
12月 12 10:34:56 Lenovo systemd[1]: Stopping The Apache HTTP Server…
12月 12 10:34:56 Lenovo apachectl[12415]: AH00558: apache2: Could not reliably>
12月 12 10:34:56 Lenovo systemd[1]: apache2.service: Succeeded.
12月 12 10:34:56 Lenovo systemd[1]: Stopped The Apache HTTP Server.

もう一度、起動してみる
$ sudo systemctl start apache2

内容確認
$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor pres>
Active: active (running) since Sun 2021-12-12 10:35:28 JST; 4s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 12437 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/>
Main PID: 12441 (apache2)
Tasks: 6 (limit: 6973)
Memory: 10.1M
CGroup: /system.slice/apache2.service
├─12441 /usr/sbin/apache2 -k start
├─12442 /usr/sbin/apache2 -k start
├─12443 /usr/sbin/apache2 -k start
├─12444 /usr/sbin/apache2 -k start
├─12445 /usr/sbin/apache2 -k start
└─12446 /usr/sbin/apache2 -k start

12月 12 10:35:28 Lenovo systemd[1]: Starting The Apache HTTP Server…
12月 12 10:35:28 Lenovo apachectl[12440]: AH00558: apache2: Could not reliably>
12月 12 10:35:28 Lenovo systemd[1]: Started The Apache HTTP Server.

その他

/var/www/html/
にファイルを設置すると、Apacheに組み込むことができる

UbuntuのノートPCで、開発を行う場合

/var/www/html/
での操作にはroot権限が必要となるので
sudo nautilus
で、nautilusを起動してから
テキストエディタ(gedit)を起動することで、
ファイルの作成ができる

参考ページ

ttps://www.yokoweb.net/2020/08/14/ubuntu-20_04-apache-php/
ttps://ubuntu.perlzemi.com/blog/20200519084454.html

Paypalで決済リンクの作成

paypalを使って、メールやメッセンジャーなどで請求するリンク(決済リンク)の作り方をまとめてみた

ログインしたら、「お支払い・決済の受け取り」をクリックし

PayPalボタンを押下

「今すぐ購入」を押下

以前に作成したものを使う時には

「保存したボタンに移動」を、押下

作成済の一覧になるので、一覧を選択し、「内訳画面」へ

新規に作成する場合には

1.商品名

2.金額

を入力して「3.ボタンを作成」を、押下

内訳画面

内訳の画面になるので、「メールアドレス」のタブを

選択すると、リンクURLを取得することができます

これを、メールに貼り付けて、購入希望者に送付したり

申し込みフォームの自動返信メッセージに追加することで、決済を自動で促すことができる

Ubuntu 20 で、ファイル、フォルダーのショートカットアイコンを作成

Windowsのファイルやフォルダーのショートカットアイコンを作成してみる

ショートカットを保存するフォルダーと、ショートカット作成元のファイル、フォルダーを表示する
ファイルマネージャーで開く(2つのウインドウ)

ファイルマネージャは
Gnome
Nautilus
のどちらでもOK

CTR+Shiftを押して
ショートカット作成元のファイル、フォルダーをクリックして
ショートカットを保存するフォルダーへ
ドラッグしドロップすると
シュートカットが作成できる